Languages
Enable multi-language support in your app using Nuxt I18n so your app can support users around the world
Tools
- Nuxt I18n – Locale and translation management
Setup
English (en) is enabled by default. To add another language:
- Register the new locale in
shared/config.ts
This tells the app that the language exists and can be used.shared/config.tsi18n: { defaultLocale: 'en', locales: [ { code: 'en', language: 'en-US', file: 'en.json', name: 'English' }, { code: 'es', language: 'es-ES', file: 'es.json', name: 'Spanish' }, // New ], } - Create the translation file for that locale
Every key in this file should match the keys used in your app.locales/es.json
{ "pages.home.title": "Bienvenidos a ShipAhead", "common.siteTagline": "Tu Boilerplate SaaS", "common.siteDescription": "Una solución poderosa para tu proyecto." } - (Optional) Configure routing and language detection in
nuxt.config.tsDo this if you want URL prefixes (for example/es/...) or automatic language switching based on the user’s browser.i18n: { strategy: 'prefix_except_default', // /es/about but / for default locale detectBrowserLanguage: { useCookie: true, cookieKey: 'shipahead_language', fallbackLocale: 'en' }, langDir: 'locales' }
Usage
- Translate text
UseuseI18n()and reference your translation keys.const { t } = useI18n(); console.log(t('pages.home.title')); // "Welcome to ShipAhead" (en) // "Bienvenidos a ShipAhead" (es) - Switch languages
Use the built-inLocaleTogglercomponent so users can change language from the UI.index.vue<template> <LocaleToggler /> </template>
When a language is selected, the site updates immediately. - Default behavior
English is pre-configured. To support another language, add it inshared/config.tsand create a matching JSON file inlocales/. - Browser detection
- If enabled, the app tries to match the user’s browser language.
- If no match exists, it falls back to the default locale.
- Tip
Keep translation keys consistent (for examplebuttons.save,errors.required) so they are easier to maintain across languages.
Configure transactional email in your ShipAhead app for verification links and password resets. Learn how to set up the provider and send app emails.
SEO
Configure SEO in your ShipAhead Nuxt app with page titles, descriptions, structured data, and social previews so search engines can understand your pages.