acoutts / flutter_libphonenumber

Leverages libphonenumber to allow for asynchronous and synchronous formatting of phone numbers in Flutter apps. Includes a TextInputFormatter to allow real-time AsYouType formatting.
MIT License
59 stars 72 forks source link

Change locale #53

Closed SFocus closed 1 year ago

SFocus commented 1 year ago

I'm trying to show a list of countries with phone numbers in some locale but can't do this. Library get country name in system locale. It is possible to change it?

acoutts commented 1 year ago

Can you give an example of what the output is now and what it should be?

SFocus commented 1 year ago

For example my device locale is German and it turns out that when I get the list of countries, they are in German locale, although in the application I need to show the list in English. I'm using getAllSupportedRegions()

acoutts commented 1 year ago

Right, i just want to better understand what the german locale vs english looks like for the country names.

SFocus commented 1 year ago

Okay, here's a better example:

Ukraine is "Україна" but should be Ukraine

acoutts commented 1 year ago

That's odd as that looks like ukranian not german.. I think you just need to do the translation yourself, but I would assume if a person has their phone set in german they'd be comfortable seeing the countries in german too. The limitation is from the PhoneNumberKit and libphonenumber packages - we can't specify the locale there, they just take the current device locale too.

SFocus commented 1 year ago

Okay, thanks for the explanation.