Last active
September 15, 2016 22:30
-
-
Save dodikk/5642176 to your computer and use it in GitHub Desktop.
Dynamic localization for iOS
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
@implementation NSBundle( Dynamic ) | |
-(NSString*)localizedStringForKey:(NSString*)key | |
value:(NSString*)value | |
table:(NSString*)table | |
locale:( NSLocale* )locale | |
{ | |
// TODO : implement this category | |
NSString* shortLocaleId = [ locale shortLocaleIdentifier ]; | |
// get en.lproj path somehow | |
NSString* path = [ self pathForResource: shortLocaleId | |
ofType: @"lproj"]; | |
NSBundle *languageBundle = [NSBundle bundleWithPath:path]; | |
NSString *str = [languageBundle localizedStringForKey: key value:value table:table]; | |
return str; | |
} | |
@end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment