Last active
December 11, 2015 14:39
-
-
Save shineycode/4615575 to your computer and use it in GitHub Desktop.
Intermittent NSLocalizedString issues
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions | |
{ | |
NSBundle *bundle = [NSBundle bundleForClass:[self class]]; | |
NSLog(@"Strings file: %@", [bundle pathForResource:@"Localizable" ofType:@".strings"]); | |
NSLog(@"Localizations: %@", [bundle localizations]); | |
NSLog(@"Local Dict: %@", [bundle localizedInfoDictionary]); | |
NSLog(@"localizedStringForKey: %@", [bundle localizedStringForKey:@"error.message.title"value:@"Wha Happened?" table:nil]); | |
NSLog(@"Localized String: %@", NSLocalizedString(@"error.message.title", @"Are you sure you want to start a new game?")); | |
// Rest of didFinishLaunchingWithOptions | |
} | |
// Contents of Localizable.strings | |
/* | |
"error.message.title" = "My Super Localized Text"; | |
// Gets printed every other time on app launch | |
/* | |
Local Dict: (null) | |
localizedStringForKey: My Super Localized Text | |
Localized String: My Super Localized Text | |
*/ | |
// Doesn't work | |
/* | |
Local Dict: (null) | |
localizedStringForKey: Wha Happened? | |
Localized String: error.message.title | |
*/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment