question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

How to translate routes without using locale prefix

See original GitHub issue

hI, 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:open
  • Created 3 years ago
  • Reactions:2
  • Comments:19

github_iconTop GitHub Comments

5reactions
thomas4Bitcraftcommented, Jun 18, 2020

Any updates on this? 🙂

2reactions
Expanddigitalcommented, Oct 5, 2022

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.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found