Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Base storyboard considers only LTR interfaces in a multi-language app

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

like image 313
JAHelia Avatar asked May 19 '14 12:05

JAHelia


2 Answers

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.

like image 126
jaggedcow Avatar answered Oct 23 '22 23:10

jaggedcow


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.

like image 34
Dharmesh Vaghani Avatar answered Oct 23 '22 23:10

Dharmesh Vaghani