1
votes

i want to use NSLocalizedString() for different languages.

Code in Swift-file:

NSLocalizedString("Hoechstgeschwindigkeit", comment: "Höchstgeschwindigkeit");

Code in .strings file

Hoechstgeschwindigkeit="Höchstgeschwindigkeit";

It works , when i change my system language to spanish and english. It works also with german, but just when i edit the scheme and not when the system language is german and i don't know why. When i use german as system language the app returns the default.strings content of the keys.

(the german Storyboard .string file works with system language)

Thanks to everyone.

1

1 Answers

1
votes

Now i know the problem... For everyone having the same problem: i checked out the language code in the .swift file with:

var preferredLanguage = NSLocale.preferredLanguages()[0] as String

it returns "de-DE" and not as expected "de"

yet, i don't know how to solve it, but i know the problem