Reserved Keywords in i18n ?
Hello, I'm using Nuxt 2.15 with Vue2 in a bit old project, and I'm finding an issue with my i18n plugin, my config look like that :
Everythings work well with this configuration for German language but when I set the normal code 'de' it doesnt work for all my pages that start with de, for example /deals /deals/:id etc.. It goes to my fallback which is french. If I switch the language directly from this page, it works correctly but when I'm navigating to it it just fallback and go /deals instead of /de/deals.
I don't have any /de files that might conflict, I'm a bit new to Nuxt so maybe I missed something ?
Thanks
7 Replies
Check if the links that point to those pages are formatted correctly using the
localePath
API method?
This is how I switch languages, I refresh one time my application to load the new language, when I console.log the locale its the good one.
It seems like there is a conflict because of the name 'de' and 'deals' because it retrieve my content in french as well, so its the whole page that is in french (translation) + the content (I pass the variable i18n.locale), when I switch page from the bugged one, I still have my /de before my other pages, so its related to this page only.
What is weird is that if I switch the languages from the /deals page, it refresh and show me well the /de/deals with the good translation and content so I guess it is not my translation file the problem..
Not sure if I understand your question ?
Which version of nuxt i18n are you using?
I tried to reproduce your issue on my end, but it works fine. No issues. I’m on version 7.3.1
I think you should also consider refactoring the logic for switching locales and use the available API that the module provides
@nuxtjs/i18n
Lang Switcher
I will try refactoring the logic I think ! Thanks
Also works fine with your version 7.2.2
Alright I'll refacto the logic