Multilingual Storyboard English to Persian(Iran) - ios

I am working on VOIP application. My base storyboard is in english language. I used multiplier constraint for leading, trailing, height, width, top, bottom.... for all so that UI can work for all devices according to their screen size.
It is working for the english but I have to convert it for Persian(Iran) language as well. I added Persian Storyboard by clicking on Localization and converted all the text in Persian. When I changed my device language english to Persian and launch the app text changed according to device language but UI layout not displaying properly due to multiplier constraint.
Layout in english language:
Layout in persian language:
And it spoils entire UI when I change the device language to Persian.
this is the way how i am giving constraint
So please help me how I can set the UI layout if language is R to L (Persian)

Related

Change NavigationBar Reveal direction in iOS for RTL

Im creating a bilingual app in iOS. My app support English and Arabic languages. The app works fine in both languages according to Device language.
LeftToRight direction for English and RightToLeft direction for Arabic.
Now I've created a setting in my app for users to switch the language irrespective of the device language i.e. user can switch app language from english to arabic and arabic to english without changing the device language.
All viewControllers are working fine with LTR and RTL directions but the only issue is with NavigationBar Controller.
when app is in english (correct navigationbar behaviour)
When app is in Arabic (incorrect layout direction)
When device and app are in arabic(correct behaviour)
any help is appreciated.

iOS app does not change to RTL language

I want to test my iOS app in right-to-left layout on device. When I set "Edit Scheme > Application Language > Right-To-Left Pseudo Language" in Xcode and run on device, the layout is flipped to RTL. However, if I leave "System language" in Xcode and then change the system language to Hebrew in iPhone settings (General > Language and region > iPhone language > Hebrew) my app is not displayed in RTL mode (all other apps do).
Why isn't my app layout changed to RTL when I change the iPhone's language to Hebrew?
I'm using Xcode 8.3.
I found what the problem was. I needed to add the Hebrew language internationalization in Project > Info section. After I re-ran on device, all layout appeared flipped (that is, in the right-to-left layout).
If it is text alignment please try the following
First try getting layout direction by
if ([UIView userInterfaceLayoutDirectionForSemanticContentAttribute:view.semanticContentAttribute] == UIUserInterfaceLayoutDirectionRightToLeft) {
}
Then set the text alignment as follows.
enter code here
[[(NSMutableParagraphStyle *)paraStyle setAlignment:NSNaturalTextAlignment];

Layout problems on different ios devices

I'm using a storyboard with some compoments like labels and buttons. The problem is that the captions are too big for my mobile display so the last words will be cutted.
I noticed that the font size seems a little bit bigger than in other apps so I want to ask what the default font size is?
And if I reduce the font, however, there may be problems on various devices, e.g. the presentation on an iPhone or an iPad?
Is it necessary to create different storyboards, each one for every device or what is the usual procedure?
There is an option called "minimum font scale" which may be useful, and there is this built-in functionality to adapt your UI to different devices:
https://developer.apple.com/library/content/featuredarticles/ViewControllerPGforiPhoneOS/TheAdaptiveModel.html#//apple_ref/doc/uid/TP40007457-CH19-SW1
And a tutorial from a site that has helped me wrap my head around a lot of iOS concepts (this is the one I used, got updated for ios11)
https://www.raywenderlich.com/162311/adaptive-layout-tutorial-ios-11-getting-started
Solution With Xcode 9:
Xcode story board has an options to separate configuration for User Interface Elements for different size (iPad & iPhone) and different orientation (Landscape and Portrait), which are Any, Compact, Regular integrated with Size Class.
Size class also allows to set different font size for iPhone & iPad.
Follow these steps, for easy under standing, how to use Size class to solve your problem.
Add label in your story board - view controller layout
Select label and open 'Attribute Inspector'
There is a small '+' icon on left side of 'Font' attribute. Click on '+' icon. It will give you a small popover with size options for your label font.
For iPhone it will show you compact width and regular height by default set/selected. Now change/set height and width both as Regular and Click on 'Add Variation', which will add a new variation for font size for iPad (a device with regular height and width).
Change font size from 17 to 40 for variation with 'wR x hR' (As shown in this snapshot)
Here is result of variation in iPhone and iPad

IOS setting the Storyboard built layout as rtl

I have built a storyboard as a RTL layout in consideration for use in a single language(hebrew),
Now i need to add an english option but the autolayout is mirroring in opposite as natively the storyboard is LTR,
In sum, i have an RTL on a LTR storyboard and i can't find a way to change the storyboard setting from the default LTR to RTL so that the auto mirroring will match the languages,
The language in my info.plist is set to "he",
I have edited the project files so the development language is hebrew,
Is there any way to fix the situation without re-building all the story board?
Thanks,

Constraints not working properly when iPhone language is Arabic for iOS version 9.0 and 9.1

When iPhone language is English all the constraints are working fine and properly for every iOS version but when I change the iPhone language to Arabic, views either disappears or goes to negative x coordinates (checked this by view hierarchy debugger) it shows the view's x coordinates is in -values.
and this happens only for iOS Version 9.0 and 9.1 with device language as Arabic.
I have changed the constraints from centre x to leading but it only shows view like this.
Check your constraints for the correct usage of "left / right" vs. "leading / trailing". "Left" means "left" and "right" means "right", always. "Leading" is on the left side for left-to-right text like English, but on the right side for right-to-left text like Arabic. If you mix them up, all kinds of things can go horribly wrong.

Resources