The storyboard database only considers LTR interfaces in a multilingual application

I have an application that includes two languages: Arabic (from right to left) and English (from left to right), I used Base Internationalization with Auto Layout to make things simple and use one storyboard (basic storyboard) for this, however, since I live in a country where Arabic is the main language, I started developing my basic storyboard with the Arabic interface (RTL), I checked the "Respect Language Direction" parameter for each horizontal constraint.
After I added the English language from the project settings, translated its storyboard line file and launched the application on the English iPhone (Settings โ†’ General โ†’ International โ†’ Language โ†’ English), the interface never changed to LTR, it remains as it is (RTL) , I tried unchecking "Respect Language Direction", but to no avail.
However, if the scenario is the opposite, everything will work fine, i.e. If I developed an interface based on the basic English language storyboard (LTR), the interface will flip to RTL when I launch the app on the Arabic iPhone.

how can I tell the basic storyboard that I am developing an RTL interface so that it translates this interface into LTR when the language is iPhone (for example, English)?

ps test environment was on Xcode 5.1.1 and iPhone 4S iOS 7.1

+6
source share
2 answers

Like me you should try

setTextAlignment: NSTextAlignmentNatural

This will solve your problem and it will install RTL for a language such as Arabic and install an interface for LRT such as English.

+1
source

I believe that โ€œRespect Language Directionโ€ depends on the currently installed device language, as suggested by Apple's documentation .

You may be lucky to manually set the NSLinguisticTagger language or using this method

The problem may also be that the Xcode storyboard editor changes the Arabic text, saving everything as LTR ( here) , in which case you can use a separate editor to set the text, or set the text programmatically, rather than in the storyboard.

+1
source

Source: https://habr.com/ru/post/969521/


All Articles