My understanding is that the device language should be set via: Settings > General > Language & Region. My device shows "English" as the language, however when I open my app, certain text such as the Apple sign-in method, and the "back" button for navigation links is in Arabic. I checked this by printing out the NSLocale.current.languageCode value, and ensured it was "ar", which did not match my expectation of "en".
I tried toggling the language from english to french, and back again to english, but the words never changed from arabic to anything else. I've also tried rebooting the simulator, erasing all content and settings, and using different target devices (iphone 13 and 11).
After adding the "Localizations" node in the info.plist file, and setting the first item to "English", the formatting now looks as expected. Thanks for the comment #HangarRash. Still not exactly sure why this is needed since I expected it should be pulled from the simulator's language setting
Related
I have multi-language enabled in my project. In previous Xcode versions, it was working perfectly fine but in new Xcode 10, Arabic storyboard is not being loaded.
instead of (Arabic storyboard) views, it's only loading/replacing the Arabic text in LTR(English storyboard) views.
I don't know if its due to the change in New Localization Pattern introduced in Xcode 10, XLIFF?
Or is it a bug in new Xcode?
I've also filed a bug report to Apple 44931689.
It's quite old, but I think the issue was related to the hardcoded language set in Project Scheme.
Go to Product -> Scheme -> Edit Schemes
OR beside simulator selection click on your project name and select Edit Scheme.
Select "Options" and check the app language, if it's other than "System Language" then this issue could occur.
I'm trying to have the launchScreen.storyboard to change according to the language of the device.
I made storyboards with each one having a different background color for UIImageView at the top see sample...
these storyboards are localized versions of the storyboard, so each one would be chosen according to the language of the device
the problem is :-
it always shows the english version for example when I switch the language of the iPhone's Simulator to Arabic, how can I make each one show up for the language it's localized for?
Unfortunatelly, you won't be able to achieve this. Launch screens are static and it's content is not a subject to localization.
Refering to the Apple human interface guidelines
Avoid including text on your launch screen. Because launch screens are static, any displayed text won’t be localized.
This piece of storyboard was intended to save you from creating a separate launch image for each screen resolution. iOS doesn't translate launch screen storyboards as it didn't give you a way to provide launch image for each of the supported languages.
However, you can find some workaround in this post.
Just to be sure, have you set support for those languages in Project settings(under Localizations) ?
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];
I have localized LaunchScreen.xib, through which the LaunchScreen is divided in two parts.
i.e. LaunchScreen.xib(English) and LaunchScreen.xib(Portugese), but when I change device language to Portuguese then LaunchScreen.xib(English) is also loaded.
Add multiple "LaunchScreen.storyboard" for each language from "Add New File" menu in project. (Lets say for spanish - Launch Screen_sp)
Localize your "Info.plist" from identity inspector menu as InfoPlist.strings (Base) , InfoPlist.strings(Spanish) for each language you want to use.
Now as example: in InfoPlist.strings (spanish)
add following key :
"UILaunchStoryboardName" = "LaunchScreen_sp";
and you are done. Do not forget to set "LaunchScreen" as your Launch Screen File in "General" settings of your project.
The answer is: you cannot localize launch screen
In the Human Interface Guideline, they pointed out:
Avoid including text on your launch screen. Because launch screens are static, any displayed text won’t be localized.
Text cannot be localized.
What about images?
I have tried localising, and as of April 2017, I concluded that localization doesn't work. The localized storyboard will be ignored.
As user: Samewize pointed out, the User Interface Guidelines advise against localizing text on the Launch Screen.
Avoid including text on your launch screen. Because launch screens are
static, any displayed text won’t be localized.
To add to that, as of September 2019, even with localization of asset catalogs (WWDC 2019 Video), I've been unable to localize images that appear on the Launch screen. I'm assuming the Launch screen is statically generated and does not take Localization into account.
As per Apple we can't localise splash screen
here is the link:-
https://developer.apple.com/design/human-interface-guidelines/patterns/launching#launch-screens/
I have just started working on localization of this application. Starting with three tab bar button titles, I have Localization.strings files like these:
// English
// Tab Bar Controller Buttons
"Settings_Tab_Title" = "Settings";
"Results_Tab_Title" = "Results";
"Map_Tab_Title" = "Map";
and
// French
// Tab Bar Controller Buttons
"Settings_Tab_Title" = "Paramétres";
"Results_Tab_Title" = "Résultats";
"Map_Tab_Title" = "Plan";
When I change the device language to French, the proper button names show up. When I change the device language to English, the keys are showing instead of the values or contents.
This problem doesn't occur in the iOS 5 simulator or on an iOS 5 iphone. I don't have an iOS 4.3 device to test it on.
Is there something I am doing wrong?
File name could be wrong !!
Localization.strings
must be
Localizable.strings
It should occur on the 4.3 simulator too.
Are your files for the english texts in the directory en.lproj? Is the directory added to your project?
Do you have an entry en in the Localization native development region in your target info settings?