Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Provide a way to find out language variant of current locale #799

Closed
marcelklehr opened this issue Jan 29, 2022 · 3 comments
Closed
Labels
enhancement New feature or request platform: android platform: ios plugin: device type: feature request A new feature, enhancement, or improvement

Comments

@marcelklehr
Copy link

Feature Request

Description

Device.getLanguageCode() only returns a two letter code, which is not enough in the case of chinese for example.

Platform(s)

  • Android
  • iOS

Preferred Solution

Maybe a Device.getLanguageVariant() or Device.getFullLanguageCode() method. I'm not too particular about this.

@jcesarmobile jcesarmobile transferred this issue from ionic-team/capacitor Feb 1, 2022
@jcesarmobile jcesarmobile added the enhancement New feature or request label Feb 1, 2022
@jcesarmobile jcesarmobile added this to the @capacitor/device 2.0.0 milestone Feb 1, 2022
@jcesarmobile
Copy link
Member

as workaround you can use navigator.language, it returns the whole code, or also navigator.languages, this one returns an array of all the languages added to the device, in case the first one is not supported you can fallback to the following

@jcesarmobile
Copy link
Member

4.0.0 beta 0 has a new getLanguageTag function available

@ionitron-bot
Copy link

ionitron-bot bot commented Sep 30, 2022

Thanks for the issue! This issue is being locked to prevent comments that are not relevant to the original issue. If this is still an issue with the latest version of the plugin, please create a new issue and ensure the template is fully filled out.

@ionitron-bot ionitron-bot bot locked and limited conversation to collaborators Sep 30, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request platform: android platform: ios plugin: device type: feature request A new feature, enhancement, or improvement
Projects
None yet
Development

No branches or pull requests

3 participants