i7eo / google-translate-select

🚀 A modern, high-performance monorepo project designed with Google Translate JS SDK. Vue and react are supported!
https://google-translate-select.i7eo.com
MIT License
369 stars 86 forks source link

How to set language dynamically? #13

Closed dipakdas99 closed 2 years ago

dipakdas99 commented 2 years ago

Hi @i7eo , I wanted to set the Chinese language by default when users log in to the platform. Example: <v-google-translate defaultLanguageCode="ar"></v-google-translate> While implementing the above code initially it shows the Arabian language then after the page loads, it is set to English. Any clue?

i7eo commented 2 years ago

Sorry to answer you so late, v-google-translate has prop fetchBrowserLanguage to control whether to automatically translate according to the browser language, in order to meet your needs, you can set the prop fetchBrowserLanguage to false.

See https://codesandbox.io/s/v-google-translate-demo-er3z8?file=/src/App.vue:171-191

You can try it out and contact me if you have any questions

dipakdas99 commented 2 years ago

Hi @i7eo , Thanks for the reply! Same issue. Initially, it changed to Chinese after that when page loads changed to English. I use the v-google-translate in the Navbar so that it would be consistent on all pages.

i7eo commented 2 years ago

Hi @i7eo , Thanks for the reply! Same issue. Initially, it changed to Chinese after that when page loads changed to English. I use the v-google-translate in the Navbar so that it would be consistent on all pages.

Can you provide an online example on codesandbox?

dipakdas99 commented 2 years ago

I did resolve that by setting up cookies in the browser.

i7eo commented 2 years ago

I did resolve that by setting up cookies in the browser.

alright👍