How to translate routes without using locale prefix
See original GitHub issuehI, I’m trying to do an app which works in Spanish and English, I need it can be accesed with page name and translated name, i.e: I have about.vue
in pages
folder and I need to access it with /about and /nosotros. I’ve tried with your plugin but it causes an /es/nosotros route and I need it to work without locale prefix.
Adding no_prefix
strategy to nuxt-i18n
config in nuxt.config.js
doesn’t work too.
I’ve set the following code in about.vue
without success:
export default {
nuxtI18n: {
paths: {
es: '/nosotros',
en: '/about'
}
},
}
nuxt.config.js:
modules: [
['nuxt-i18n', {
strategy: 'no_prefix',
lazy: true,
parsePages: false, //Tried with true and does not work
locales: [
{
name: 'Español',
code: 'es',
file: 'es/locale.json'
},
{
name: 'English',
code: 'en',
file: 'en/locale.json'
}
],
langDir: '/locales/',
defaultLocale: 'en'
}]
]
Issue Analytics
- State:
- Created 3 years ago
- Reactions:2
- Comments:19
Top Results From Across the Web
How to translate routes without using locale prefix #735 - GitHub
hI, I'm trying to do an app which works in Spanish and English, I need it can be accesed with page name and...
Read more >Laravel localization in routes without prefix - Stack Overflow
Okay so i took a small break and figured out a possible solution which seems to be working perfectly. $locales = array("en_US","de_DE" ...
Read more >Advanced Features: Internationalized Routing - Next.js
Next.js has built-in support for internationalized routing and language detection. Learn more here. ... The default locale does not have a prefix.
Read more >Translator master - Lavalite
It returns a route, localized to the desired locale using the locale passed. If the translation key does not exist in the locale...
Read more >Best Practices for Angular Localization with SSR
To fix this, we will make the language to be anchor tags to direct to the current URL in the other language, and...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Any updates on this? 🙂
Can’t believe this still isn’t fixed, kind of a key features for most software. Why would you use a prefix if you are going to translate the slugs.