Skip to content

Latest commit

 

History

History
71 lines (53 loc) · 2.39 KB

File metadata and controls

71 lines (53 loc) · 2.39 KB

Internationalization (Nuxt i18n + Crowdin)

This project uses @nuxtjs/i18n with lazy-loaded locale files in i18n/locales and Crowdin for translation management.

Routing Strategy

  • Strategy: prefix_except_default
  • Default locale: en
  • Enabled locales: en, es, fr, de, nb, vi
  • Blog is intentionally excluded from localized route generation via defineI18nRoute(false) in:
    • app/pages/blog/index.vue
    • app/pages/blog/[...slug].vue

Locale Files

  • Source locale file: i18n/locales/en.json
  • Target locale files:
    • i18n/locales/es.json
    • i18n/locales/fr.json
    • i18n/locales/de.json
    • i18n/locales/nb.json
    • i18n/locales/vi.json

Crowdin Setup

  1. Create a Crowdin project.
  2. If you want to run Crowdin CLI commands locally, configure these environment variables:
    • CROWDIN_PROJECT_ID
    • CROWDIN_PERSONAL_TOKEN
  3. Use the scripts below for manual local sync.

Local Crowdin Commands

npm run i18n:crowdin:upload
npm run i18n:crowdin:download
npm run i18n:crowdin:sync

Localhost Smoke Test (No Crowdin Token Needed)

Use this to verify Nuxt i18n loading and locale switching without Crowdin CLI credentials.

  1. Add a visible marker in one locale file (example in i18n/locales/es.json):
    • "common": { "language": "Idioma (localhost-test)" }
  2. Run the app:
    • npm run dev
  3. Open a page with the language switcher and enable probe mode:
    • http://localhost:3000/?i18nTest=1
    • http://localhost:3000/es?i18nTest=1
  4. Confirm:
    • / shows English probe text (Language)
    • /es shows Spanish probe text (Idioma (localhost-test))
    • Changing the language in the switcher updates both URL prefix and probe text.

GitHub Integration (Crowdin Native)

This repository uses Crowdin's native GitHub integration (configured in Crowdin UI), not a GitHub Actions sync workflow.

Recommended Crowdin integration settings:

  • Integration target: this repository's default branch (main)
  • Source file: i18n/locales/en.json
  • Translation files: i18n/locales/%two_letters_code%.json
  • Export pattern: keep locale JSON files in the same folder structure
  • PR updates: enabled (Crowdin creates PRs with translated locale changes)

Important:

  • Do not enable a second automated sync path in GitHub Actions for Crowdin, or you may get duplicate PRs/commits.
  • Keep .crowdin.yml in the repo because Crowdin uses it for file mapping.