K
K
Kamila Tuleubayeva2021-04-02 12:48:51
Vue.js
Kamila Tuleubayeva, 2021-04-02 12:48:51

How to switch languages ​​with one button?

6066e7df1712f283566885.png
I have a switch like this: when you hover the mouse over the button, a list of languages ​​\u200b\u200bappears, and you select it, and the page switches to this language. But I need it to automatically change to the next one when the button is clicked. Let's say it's Russian, I click, the change goes to English, I click, back to Russian, without a list. Help me please!

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alex, 2021-04-02
@tuleubayeva

More or less like this:

<button @click="setLocale($i18n.locale !== 'kk' ? 'kk' : 'ru')">{{ $i18n.locale !== 'kk' ? 'kk' : 'ru' }}</button>

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question