Skip to content

How I can change locale when I use no_prefix strategy? #1826

Answered by kazupon
zozulinskyi asked this question in Q&A
Discussion options

You must be logged in to vote

@zozulinskyi
Hi!

The no_prefix strategy does not allow you to use the function returned by useSwitchLocalePath, i.e. switchLocalePath, to switch languages. As the docs say, you need to use setLocale to switch languages.
https://v8.i18n.nuxtjs.org/guide/routing-strategies#no_prefix

The behavior of switchLocalePath works the same behavior since nuxt i18n module v7.

switchLocalePath works if you use the no_prefix strategy and routing using pages.

Replies: 2 comments 4 replies

Comment options

You must be logged in to vote
2 replies
@zozulinskyi
Comment options

@ineshbose
Comment options

Comment options

You must be logged in to vote
2 replies
@kazupon
Comment options

@zozulinskyi
Comment options

Answer selected by zozulinskyi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
3 participants