How can I implement iOS with RTL for Arabic Hebrew?
Asked Answered
S

3

9

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


Sidewinder answered 6/5, 2014 at 14:28 Comment(3)
When you say "it does not work", what do you mean exactly? Is the text written left-to-right? If so, does the text have the RTL mark? Does that label not have the right size? Is it positioned wrong? Please be more specific. A short code example would also be a good idea (edit your question and add a string that is displayed "wrong").Berkowitz
when I say "it does not work" I mean that the screen is not mirrored, it does not flip, the layout of the component does not effect by the change of the language.Sidewinder
I have also add a storyboard for Hebrew and Arabic, but it is still the same result, the layout does not flip or mirrored when change the languageSidewinder
K
2

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

Kendy answered 25/6, 2015 at 22:9 Comment(0)
D
1

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

Dastardly answered 8/5, 2018 at 3:12 Comment(1)
The link you shared is not active any more please update it or remove it with more details explaining your answer.Burette
S
0

I have followed the instruction in this link to get this work, it is now working In addition to using the constraints of the auto layout.

Sidewinder answered 3/8, 2014 at 15:40 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.