Search code examples
iosxcodelocalizationlocalizable.strings

ios localizable strings are not working


I have made an ios app that is localized to two languages (english and danish, english being default).
I have made a Localizable.strings with two subfiles, en and da.
Everything should be made correctly, and i see the english texts load fine from the strings file. But the danish ones do not.

I have tried to check the preferred language via below code and it is danish.

[[NSLocale preferredLanguages] objectAtIndex:0];

I have tried clean + delete and rebuild with no luck.

I know that the Localizable.strings file is working since it is getting the english texts. and i know that it is seeing the danish localization via the above line of code. What am i missing?

Just to add a couple of examples:
from the EN:

"YesButton" = "Done";
"NoButton" = "Not yet!";
"NextButton" = "Next";
"BackButton" = "Back";
"EditButton" = "Edit";
"DoneButton" = "Done";  

and the DANISH:

"YesButton" = "Færdig";
"NoButton" = "Ikke endnu!";
"NextButton" = "Næste";
"BackButton" = "Tilbage";
"EditButton" = "Redigér";
"DoneButton" = "Færdig";

and the code for getting the text would be:

[yesButton setTitle:NSLocalizedString(@"YesButton", nil) forState:UIControlStateNormal];

which is returning "Done" even when preferredLang is da (danish)!

Hope somebody has an idea? :)

Thanks in advance.

EDIT:::
Something was wrong with the actual DANISH-DENMARK localization. i dont know if apple updated it or what they did but it went from being called "Danish-Denmark" to just "Danish". After making a whole new Danish localization and deleting the old one it worked! crazy stuff. keeps you scratching your head!


Solution

  • There was something wrong with the actual danish localization.
    When i started making the localization it was called "Danish-Denmark". After an update of ios and/or xcode, it is now only "Danish".
    So had to make a whole new localization.

    Thank you apple...... NOT!