LouisMazel / vue-phone-number-input

A phone number input made with Vue JS (format & valid phone number)
https://louismazel.github.io/vue-phone-number-input
MIT License
607 stars 153 forks source link

Country names #77

Open webistomin opened 4 years ago

webistomin commented 4 years ago

Hi! Is there a way to translate country names?😢

https://github.com/LouisMazel/vue-phone-number-input/blob/master/src/VuePhoneNumberInput/assets/js/phoneCodeCountries.js

LouisMazel commented 4 years ago

What is the best ? Each country in the language of the country?

webistomin commented 4 years ago

What is the best ? Each country in the language of the country?

I think you should add language prop with type Array. Default value for the prop will be your array. So we can use it like this:

<template>
  <VuePhoneNumberInput v-model="yourValue" :language="language" />
</template>

<script>
  import { ru } from 'vue-phone-number-input/dist/locale'

  export default {
    data() {
     return {
       language: ru,
     }
    }
  };
</script>

People can contribute their own translation to your project.

NuwanDhanushka commented 4 years ago

How can I clear the VuePhoneNumberInput after form submitting? I tried to make model to null but the green border still exits even the number disappears. Is there any way of doing it thanks 👍

ahmadjaffal commented 2 years ago

@LouisMazel is there a way to translate the country names in the list?