1
votes

I have a problem with the localization of my app. I want to have french and english (default).

The localization seems to work with the Storyboard as text from there is translated to french (on simulator & iPhone in french). But the strings from Localizable.strings are not translated.

I checked the name of the file and it is correct "Localizable.strings". I validated the content of the files with "plutil -lint " and it was OK. Checking the target->build phases->copy bundle resources: the Localizable.strings is there.

In the code I am using:

NSLocalizedString("KEY", comment: "")

Checking the NSLocale of the simulator, it seems as the preferred language is french, so I do not understand why it is not working.

Any idea?

Thanks,

Henry

3
This is not a help in any way - just want to say thanks for mentioning that the file must be named: "Localizable.strings" .. I had (for unknown reasons) named it something else - and just couldn't understand why it didn't work - until now. Thanks :-P - Glenn Sønderskov
For change language "on the fly" you can use cocoapods.org/pods/L10n-swift. - Adrian Bobrowski

3 Answers

1
votes

You might be missing some settings in your scheme.

This tutorial on YouTube really helped me localize my last app. It's under 8 minutes. Hope it helps.

1
votes

I fixed my issue. There was a mistake in my Localizable.strings. I had the following for one line:

"..."; = "...";

It would be good if there was a tool to validate this.

Thanks for the effort,

Bye

0
votes

I faced same issue, but I found a mistake in Localizable.strings as user3900157. I missed semicolon at the end. After added semicolon to all sentences, it worked. Hope to help you.