Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I implement iOS with RTL for Arabic Hebrew?

I'm developing an application on Xcode 5 target iOS 7.1 with single view having only two items image and label on it, the Auto layout is enabled and the constraint is set using 'add missing constraint' with trailing and leading attributes.

According to Apple site below, this component should flip when I change to Arabic language with no more modification in the code, only with the help of the Auto layout, but this did not work https://developer.apple.com/library/ios/documentation/UserExperience/Conceptual/AutolayoutPG/Introduction/Introduction.html#//apple_ref/doc/uid/TP40010853-CH13-SW1

I search for other member question here and found that other saying that I should implement different storyboard for each language like what is mentioned in that link https://developer.apple.com/library/ios/documentation/MacOSX/Conceptual/BPInternational/BPInternational.html#//apple_ref/doc/uid/10000171-SW1

In my main storyboard I can found under localization only Base and english, how to add Hebrew and Arabic?

I found the below questions but they do not add much support: Multi Language Design support in IOS Right to left and left to right languages in the same app?


Flip UIImageViews for Right to Left Languages


iOS : How to build a bi-language iOS native application


Using Constraints in Auto Layouts of Objective C to support RTL Languages


RTL (Right-to-left) via auto layout broken on iOS 6.1 / iOS 7.0?


Right to Left UI in iPhone (Hebrew)


This link is similar to my implementation but it did not work with me like that one AutoLayout + RTL + UILabel text alignment


like image 842
Mahmoud Ibrahim Avatar asked May 06 '14 14:05

Mahmoud Ibrahim


People also ask

Is Arabic RTL language?

Arabic, Hebrew and Persian are the most widespread RTL writing systems in modern times.

What is RTL in UI?

An arrow pointing right to left indicates forward motion: ← When a UI is changed from LTR to RTL (or vice-versa), it's often called mirroring. An RTL layout is the mirror image of an LTR layout, and it affects layout, text, and graphics.

What is language RTL?

In computer science, register transfer language (RTL) is a kind of intermediate representation (IR) that is very close to assembly language, such as that which is used in a compiler. It is used to describe data flow at the register-transfer level of an architecture.

What is RTL language in iOS apps?

Right to Left (RTL) Language Support in iOS Apps. Apple provides many languages to the users to be utilized in the apps which starts from left to right or right to left. The left to right language renders in the UI from the left while right to left language renders from the left side.

How do I support right-to-left languages like Arabic and Hebrew?

Support right-to-left languages like Arabic and Hebrew by reversing your interface as needed to match the reading direction of the related scripts. When people choose a language for their device — or just your app or game — they expect the interface to adapt in various ways (to learn more, see Localization ).

How to add Arabic localization to RTL project?

Now, lets add Arabic Localization in the app file for displaying RTL language in the label. Go to Project Folder, select the Project in the next panel (NOT the Target), and under the info tab you will see a section for Localization. Click the + and choose Arabic (ab).

Do different RTL languages use different number systems?

Different RTL languages can use different number systems. For example, Hebrew text uses Western Arabic numerals, whereas Arabic text might use either Western or Eastern Arabic numerals. The use of Western and Eastern Arabic numerals varies among countries and regions and even among areas within the same country or region.


2 Answers

Little late to the party, but iOS 9 has a lot of these things built-in for free.

As of iOS 9, standard UIKit controls are flipped automatically in right-to-left languages (such as UITabBar, UINavigationBar, UITableView etc.), which in conjunction with Auto Layout can make your app 'just work' on RTL.

iOS 9 also has API for flipping images that are directionally-tied, among a few other things.

More info here: https://developer.apple.com/library/prerelease/ios/documentation/MacOSX/Conceptual/BPInternational/SupportingRight-To-LeftLanguages/SupportingRight-To-LeftLanguages.html#//apple_ref/doc/uid/10000171i-CH17

like image 139
wakachamo Avatar answered Oct 29 '22 14:10

wakachamo


The best and the simplest way to enable RTL language support in your application is by defining constraints (Auto layout) rather than defining frames and bounds.

You can follow the link to kick-start auto layout implementation: Autolayout documentation by Apple

like image 34
Anu Mittal Avatar answered Oct 29 '22 14:10

Anu Mittal