Вопрос

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!

Это было полезно?

Решение

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"

Другие советы

The most common reason developers see the English rather than the translation is not naming the localization file properly. It HAS to be Localizable.strings -- spelled exactly that way and no other.

Nothing else works! Also, make sure it is in the properly named directory (en.lproj, ru.lproj, etc.)

There is a complete tutorial here

It is too little information and it seems good... Please, see this step-by-step tutorial to check what is wrong on your settings (It takes only about 15 minits...)

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top