vue-tel-input icon indicating copy to clipboard operation
vue-tel-input copied to clipboard

Get country name from drop down list in given language

Open DurandSacha opened this issue 2 years ago • 2 comments

Hello, I would like to know if it is possible to configure a language in which the country names will be displayed.

In my use case, I would like all countries to be displayed with their French names, but I can't find the required configuration, is it possible to implement this? Or give a solution to this use case?

Thank you very much, I am using version 5.7.0

DurandSacha avatar Jun 06 '22 13:06 DurandSacha

At the moment, I found one bad solution :

  1. add a ref in component
  2. change value in Vue object...

//set FR dropdown this.$refs.telInput[0]._props.allCountries[2].name = 'Algérie'; this.$refs.telInput[0]._props.allCountries[19].name = 'Belgique'; this.$refs.telInput[0]._props.allCountries[43].name = 'Chine'; this.$refs.telInput[0]._props.allCountries[79].name = 'Allemagne'; this.$refs.telInput[0]._props.allCountries[104].name = 'Italie'; this.$refs.telInput[0]._props.allCountries[144].name = 'Maroc'; this.$refs.telInput[0]._props.allCountries[150].name = 'Pays-Bas'; this.$refs.telInput[0]._props.allCountries[171].name = 'Portugal'; this.$refs.telInput[0]._props.allCountries[176].name = 'Russie'; this.$refs.telInput[0]._props.allCountries[202].name = 'Espagne'; this.$refs.telInput[0]._props.allCountries[209].name = 'Suisse'; this.$refs.telInput[0]._props.allCountries[229].name = 'Royaume-Uni';

DurandSacha avatar Jun 06 '22 14:06 DurandSacha

@DurandSacha I did the same and I think that's the right way to go. In docs it says if you want to change countries then override allCountries props.

I basically import database of dial codes and iso2, then I translate it to list of country names.

kamilwylegala avatar Jul 05 '22 21:07 kamilwylegala