Вопрос

I wonder if some body know how can I connect my application language and NSLocalizeStrings, For example: my app is on fr, ru,ro but User device is on en, and when user turn on app it on en but in app settings there is ro or fr. How can I pass my app language in NSLocalizedString. Thanks.

UIAlertView *finishQuiz = [[UIAlertView alloc] initWithTitle:NSLocalizedString(@"Finished Quiz",@"Quiz finished")
                                                     message:NSLocalizedString(@"You answered to all quiestions. If you win you will be informed by e-mail" ,@"Information")
                                                    delegate:self 
                                           cancelButtonTitle:NSLocalizedString(@"Le menu principale",@"MainMenu")
                                           otherButtonTitles:nil, nil];
Это было полезно?

Решение

You don't. The application will look for the Localizable.strings under the appropriate localization according to the system language. If the user has set french as system language, the application will load its strings from fr.lproj\Localizable.strings when you use NSLocalizedString(...).

So NSLocalizedString(@"SomeTest", @"This is a test description"); will load this line from fr.lproj\Localizable.string

// Localizable.string (Francais)
"SomeTest" = "Un test";

For more info, read up at: Localizing String Resources.

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