0
votes

i'm having a problem with the localizable.string file

to change the language of the label or button i have no problem i change it on the storyboard string without problem but when i have an alert to show i have to use the NSLocalizedString

i've created the localizable.strings file and clicked on the localize button to choose all the language that i needed in this file i've put the key i need to translate

for example in the french file

"FIELDS_MANDATORY" = "Tout les champs sont obligatoire";

which is called in the method

[[[UIAlertView alloc] initWithTitle:@"Confirmation" 
message:NSLocalizedString(@"FIELDS_MANDATORY", @"Message") 
delegate:nil cancelButtonTitle:@"Ok" otherButtonTitles:nil]show];

but when i launch the simulator it just show me "FIELDS_MANDATORY"

any idea why ?

1

1 Answers

0
votes

You've added it in correctly but not given file name properly,

Localized filename should always be named Localizable.strings, and that file is within the particular language folder, for English, en.lproj and for French fr.lproj like wise.

Other than your code looks good.