Search code examples
objective-cioslocalizationlocalizable.strings

Localization in iOS


I'm trying to localize my App. But something is going wrong, and instead of displaying the content of my .string files. It is displaying just a key that I set in the NSLocalizedString. This is example:

-(void)viewDidLoad {
    [super viewDidLoad];
    self.passwordTextField.placeholder = NSLocalizedString(@"Password", nil);
}

In my Localizations(English) I did: "Password" = "Password";
In my Localization(Russian) I did: "Password" = "Пароль";

I checked the directories, I had ru.lproj and en.lproj. But anyway, it didn't work.

Can someone help me?

Thanks in advance!


Solution

  • This style has always served me well...

    NSString *text = NSLocalizedStringFromTable(@"text-key", currentLocale, @"");
    

    The locale must match the filename however. Such as: "en_US.strings"