Setting for localizing language

Hello Friends,


I am trying to add language extension for my app, but nothing is happening, when i change language for user on simulator, Please help.


Below are my settings for project in Xcode:


MainStroyBoard:


Main.StoryBoard(Base) : Utilities -> localization -> Base (checked), English (Checked), Spanish (checked)

Main.Strings (English) : Utilities -> localization -> Base (checked), English (Checked), Spanish (checked)

Main.Strings (Spanish) : Utilities -> localization -> Base (checked), English (Checked), Spanish (checked)


Please suggest ideal settings for user to be able to see content in local language of device.


Pankaj Bansal

My recommendation here is that you first try out the basic process on a test app before trying to debug your main app. That way you'll have a concrete example of something that works, which is great in situations, like this, where you're exploring new territory.

To create such a test app, do this:

  1. Create a new project from the Single View Application template.

  2. In "Main.storyboard", add a label to the main view controller and change the text to English.

  3. In the project editor, in the Localizations slice, click the 'add' button and add "Spanish (es)" as a localisation.

  4. In the resulting sheet, leave both "Main.storyboard" and "LaunchScreen.xib" checked and click Finish.

  5. Main.storyboard should now have two localisations, Base and Spanish, where Spanish is just a strings file. Edit that strings file and change the label text to "Spanish".

  6. Run the app in the simulator. The label should show "English".

  7. Stop the app.

  8. In the simulator, in Settings > General > Language & Region > iPhone Language, select Spanish and confirm that change.

  9. Run the app in the simulator again. The label should show "Spanish" (it my case it showed "Spa…" because the text got truncated, but you get the idea).

If this works as described, you can then turn around and compare the settings in your test app to the settings in your real app to see what's different.

Share and Enjoy

Quinn "The Eskimo!"
Apple Developer Relations, Developer Technical Support, Core OS/Hardware

let myEmail = "eskimo" + "1" + "@apple.com"

Hi,


I, also, have problems localizing my WatchApp. For some reason [[NSLocale currentLocale] localeIdentifier] always returns en_US, no matter which language is set on the phone.

When running the companion app on the phone the correct locale identifier is returned.


BTW. I use NSLocalizedString only. But this applies for both the WatchApp and the iOS App.


Dirk

The locale is different from the language. The locale controls your date and time settings, your currency settings, and so on. The language controls, well, just that, the language.

To work out what’s happening with the language, dump NSLocale’s

preferredLanguages
property and NSBundle’s
localizations
and
preferredLocalizations
properties.

Finally, make sure you read QA1828 How iOS Determines the Language For Your App and check each of the on-disk structures it references.

Share and Enjoy

Quinn "The Eskimo!"
Apple Developer Relations, Developer Technical Support, Core OS/Hardware

let myEmail = "eskimo" + "1" + "@apple.com"
Setting for localizing language
 
 
Q