Only UI schematic changed not labels and All others value, i used NSLocalizedString as well
Closed this issue · 6 comments
i tried this but it works only if you have 1 or 2 controller , i have many viewControllers, i implement to rabic language but only UI schematic get change not labels and all other things, i used NSLocalizedString as well but it won't work, but when i restart my app then it works, can i do it without restrting it?
please help me!!!
Hello,
You need to use the localiz()
method instead of NSLocalizedString, so, you need to replace NSLocalizedString("Your string", comment: "") to "Your string".localiz(), and did you add your strings to the Localizable.strings
?
hello,
i have added all the strings to Localizable.strings. and used . localiz() as well, but won't work,
after restarting app it is working how is it possible?,
i have separate storyBoard for English and Arabic, can that make problem for me?
Yes, you need to use 1 storyboard, and remember to set the root view controller again,
how do you navigate to your setting or the place you are changing the language from?
for example:
MainViewController
-> SettingsViewController
-> LanguageSettingViewController
Hello @Abedalkareem
First of all, i must say "Good Job".
You did it very well, its working fine but i'm getting the weird issue.
Let me first mention the flow of application like how it works
Splash Screen -> Main View (It contains the language Selection View ( English, Arabic) -> User selects the language, lets say Arabic -> Home View.
The issue is: It applies .forceRightToLeft semantic to all views on first start except UITextField
and the most weird thing is, when i force close the app and open it again then it works.
Could you please guide me like how it works and what should i do in this case?
Thanks.
@ibrar110,
As @Abedalkareem mentioned in the documentation, for UITextfield and UILabel you should align the text
textAlignment = LanguageManger.shared.isRightToLeft ? .right : .left.
thank you @nidhinp !