Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save yauhenidrobau/a327423153683929124eea3a63c992f4 to your computer and use it in GitHub Desktop.

Select an option

Save yauhenidrobau/a327423153683929124eea3a63c992f4 to your computer and use it in GitHub Desktop.
/*Im Macros*/
#define LocalizedString(key, comment) [LanguageUtils getLocalizedStringForKey:(key)]
/*In Language Utils class*/
+ (NSString *)getLocalizedStringForKey:(NSString *)key {
NSString *oldLocalization = [NSBundle.mainBundle localizedStringForKey:(key) value:@"" table:nil];
if (oldLocalization.length > 0) {
return oldLocalization;
}
NSString *newLocalization = [[NSBundle bundleWithPath:[[NSBundle mainBundle] pathForResource:@"en" ofType:@"lproj"]] localizedStringForKey:(key) value:@"" table:nil];
return newLocalization;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment