NSLocalizedString doesn't work
cocoa-touch, ios, localization, objective-c, xcode
Solution
`NSLocalizedString` uses `Localizable.strings` file by default. Change your `File.strings` name and try again.
Problem
I want to use NSLocalizedString in my app but it always failed. What i do is: - Define 3 Localizations in Project Properties (See screenshot bellow) - Create a new file: Resource Strings File - Check in the app bundle if file.strings is there Then I use NSLocalizedStrings as follow but it doesn't work! ``` - (void)applicationDidFinishLaunching:(NSNotification *)aNotification { // Insert code here to initialize your application NSString *v1 = NSLocalizedString(@"MyWindow", nil); //NSString *v1 = [[NSBundle mainBundle] localizedStringForKey:(@"MyWindow") value:@"" table:nil]; [label setStringValue:v1]; } ``` In my 3 .strings files I define the below key/value: "MyWindow" = "Ma Fenetre"; Normally, my label should display "Ma Fenetre" and not "MyWindows" You can download an example project here and tell me where is the issue. Bellow the content of Resources folder in my app bundle : ``` DerivedData om$ find test/Build/Products/Debug/test.app/Contents/Resources/ test/Build/Products/Debug/test.app/Contents/Resources/ test/Build/Products/Debug/test.app/Contents/Resources//de.lproj test/Build/Products/Debug/test.app/Contents/Resources//de.lproj/File.strings test/Build/Products/Debug/test.app/Contents/Resources//en.lproj test/Build/Products/Debug/test.app/Contents/Resources//en.lproj/File.strings test/Build/Products/Debug/test.app/Contents/Resources//fr.lproj test/Build/Products/Debug/test.app/Contents/Resources//fr.lproj/File.strings test/Build/Products/Debug/test.app/Contents/Resources//MainMenu.nib ``` Thanks Elfoiros