I have an app that includes two languages: Arabic (Right To Left) and English (Left To Right), I used Base Internationalization
with Auto Layout
to make things simple and use one storyboard (base storyboard) for this purpose, however, because I live in a country where Arabic is the primary language I started to design my base storyboard with an Arabic interface (RTL), I checked the option "Respect Language Direction" for each horizontal constraint.
After I added English language from project settings, translated its storyboard strings file, and ran the app on an English iPhone (Settings -> General -> International -> Language -> English), the interface never changed to LTR, is stays as is (RTL), I tried to uncheck the option "Respect Language Direction" but to no avail.
However, if the scenario is opposite everything would work fine, i.e. if I designed the interface on the base storyboard with English language (LTR) the interface will flip to RTL when I run the app on an Arabic iPhone.
how can I tell the base storyboard that I'm designing an RTL interface so it should flip this interface to LTR when the iPhone's language is (for ex.) English ?
p.s. the testing environment was on Xcode 5.1.1
and iPhone 4S
iOS 7.1
I believe "Respect Language Direction" depends on the currently set device language, as is suggested by Apple's documentation.
You might have better luck by manually setting the language detected by NSLinguisticTagger
or using this method
The problem might also be that Xcode's storyboard editor is reversing the Arabic text while keeping everything as LTR (documented here), in which case you might want to use a separate editor to set the text, or set the text programmatically rather than in the storyboard.
Try this one.
setTextAlignment:NSTextAlignmentNatural
This will solve your problem it set RTL for language like arabic and set interface to LRT language like English.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With