How do I get a list of all available localizations?
I have an app with five localizations. I need to know whether the current locale is in that list and if not, create a fallback. But how do I find out if the current locale is in that list?
For me accepted solution didn't work, if Language was not supported - App simply fall back to English and, as English strings file contained "IsSupported" string - it returned "YES".
I had to use this solution
NSString* currentLanguage = [NSLocale preferredLanguages][0];
NSArray* supportedLocalizations = [[NSBundle mainBundle] localizations];
if ([supportedLocalizations containsObject:currentLanguage]) {
isLocalizedToCurrentLanguage = YES;
}
else {
isLocalizedToCurrentLanguage = NO;
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With