/ Published in: Objective C
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
//1. System change /* Example call: NSLocalizedString(@"Key", @""); Below should be implemented in main. Because the language needs to be set "sometime early in your application's startup" */ forKey:@"AppleLanguages"]; //2. Get information through bundle -- Useful !!! #define MyLocalizedString(key, alt) [Language get:key alter:alt] @implementation Language +(void)initialize { [self setLanguage:current]; } /* example calls: [Language setLanguage:@"it"]; [Language setLanguage:@"de"]; MyLocalizedString(@"Key", @""); */ NSLog(@"preferredLang: %@", l); } return [bundle localizedStringForKey:key value:alternate table:nil]; } @end
URL: http://stackoverflow.com/questions/1669645/how-to-force-nslocalizedstring-to-use-a-specific-language