capacitor-plugins icon indicating copy to clipboard operation
capacitor-plugins copied to clipboard

feat(app): Add 'getAppLanguageCode' and 'getAppLanguageTag'

Open philet opened this issue 2 years ago • 2 comments

Solves https://github.com/ionic-team/capacitor-plugins/issues/1693

philet avatar Jul 19 '23 12:07 philet

I've addressed the changes requested by Mike and added two buttons on the test app for testing https://github.com/ionic-team/capacitor-testapp/pull/628

But I've noticed that getAppLanguageTag() is also returning a 2 language code on iOS instead of the documented "IETF BCP 47 language tag". Bundle.main.preferredLocalizations.first will return a matching code on CFBundleLocalizations if there is one, which is usually a 2 letter code, or if there isn't one that matches, then it will return the CFBundleDevelopmentRegion, which is a 2 or 3 letter ISO code. So I don't think the getAppLanguageTag method is needed, and also, I don't think the getAppLanguageCode should return a 2 letter code as it could also be a 3 letter ISO code. I think it should just be getAppLanguage() and return the whole value of Bundle.main.preferredLocalizations.first

jcesarmobile avatar Aug 23 '23 18:08 jcesarmobile