ReactNativeLocalization
ReactNativeLocalization copied to clipboard
Country and variant doesn't work (for example, "zh-Hans")
The country specific variant doesn't work for me. For example, when I try to differentiate between Chinese Simplified and Chinese traditional on iOS, this library fails to pick the correct strings from "zh-Hans" and "zh-Hant"
I am using RN 0.42.3
I guess it depends from the iOS version... what version are you targeting? Because there've been some changes in the way the language is coded
zh-Hant
return [[NSLocale preferredLanguages] objectAtIndex:0]will always return the right language code.
on iOS 10 use currentLocale.languageCode miss Hant. maybe use [[NSLocale currentLocale] localeIdentifier]
I am running RN 50 on iOS. Just make sure that you put quotes for country and local variant, like so:
en:{ } 'fr-FR': { } 'fr-CA': { }
Further reference: https://developer.apple.com/library/content/documentation/MacOSX/Conceptual/BPInternational/LanguageandLocaleIDs/LanguageandLocaleIDs.html