Found me on Upwork? If you found me through Upwork and want to work together, please contact me through Upwork. Messages from Upwork clients sent outside Upwork will not be answered.
Localization notes🌏 Localization

Vue.js and Nuxt.js i18n for Vietnamese: setup guide

Vietnamese has no grammatical plural: one message per key. Configure vue-i18n locales, Nuxt hreflang, and lazy-loading to build a Vietnamese-ready web app.

Dao Huy (Lucas)5 min read8 sections
Vue.js and Nuxt.js i18n for Vietnamese: setup guide
💡 TL;DR: Add vi as a locale in vue-i18n and set language: 'vi-VN' in Nuxt to generate correct hreflang tags. Vietnamese has no grammatical plural: Unicode CLDR assigns it only the "other" category, so a single message string covers every count. Enable lazy-loading per locale and call useLocaleHead() in your root layout to auto-inject <link rel="alternate" hreflang="vi-VN"> for multilingual SEO.

Key takeaways

  • Use vi in vue-i18n; set language: 'vi-VN' in Nuxt to generate BCP 47 hreflang tags that Google accepts.
  • Vietnamese has no grammatical plural: Unicode CLDR "other" only, so no pluralizationRules option is needed.
  • Lazy-load with file: 'vi.json' per locale to keep Vietnamese strings out of the initial JS bundle.
  • Save all locale JSON files as UTF-8 without BOM - a BOM can corrupt Vietnamese diacritics in some JSON parsers.
  • Call useLocaleHead({ addSeoAttributes: true }) in your root layout to inject hreflang, canonical, and OG locale tags in one composable.

Why Vietnamese pluralization is simpler than English

Vietnamese expresses quantity with numerals and classifiers, not by changing noun forms. "1 sản phẩm" and "10 sản phẩm" are structurally identical. Unicode CLDR assigns Vietnamese only the "other" plural category, meaning you need exactly one message string per key regardless of count.

Compare this to English, which needs "one" and "other", or French, which also uses two forms. Your vi.json message file simply omits the pipe-separated variants English and French require:

// en.json
{
  "cartItems": "No items | One item | {count} items"
}

// vi.json - single form, no pipe needed
{
  "cartItems": "{count} sản phẩm"
}

If a business rule requires a special zero-count message (e.g., "Giỏ hàng trống"), handle it in component logic rather than via vue-i18n's pluralization. Vietnamese conventionally uses conditional phrasing rather than grammatical plural endings.

How do you configure the Vietnamese locale in vue-i18n?

Use vi as the locale code. W3C guidance recommends keeping BCP 47 tags as short as possible: the -VN regional subtag adds no functional distinction for vue-i18n matching, since there is only one standard written Vietnamese orthography. Configure it in createI18n():

import { createI18n } from 'vue-i18n'

const i18n = createI18n({
  locale: 'vi',
  fallbackLocale: 'en',
  messages: {
    vi: {
      welcome: 'Chào mừng, {name}!',
      cartItems: '{count} sản phẩm',
      checkout: 'Thanh toán ngay'
    }
  }
})

No pluralizationRules option is needed. Vue i18n's default rule returns "other" for all numeric values, which is the correct behavior for Vietnamese.

Nuxt i18n hreflang for Vietnamese: config and routing

Nuxt i18n v10 uses the @nuxtjs/i18n module. For hreflang, set the language property on each locale object to a BCP 47 tag and provide a baseUrl so alternate URLs are fully qualified:

// nuxt.config.ts
export default defineNuxtConfig({
  modules: ['@nuxtjs/i18n'],
  i18n: {
    locales: [
      { code: 'en', language: 'en-US', file: 'en.json' },
      { code: 'vi', language: 'vi-VN', file: 'vi.json' }
    ],
    defaultLocale: 'en',
    baseUrl: 'https://your-domain.com',
    strategy: 'prefix_except_default'
  }
})

The prefix_except_default strategy gives English the root URL and Vietnamese a clean /vi/ prefix, so Google indexes them as separate language versions. Avoid no_prefix for multilingual sites: it forces Google to infer the language from content alone, which delays Vietnamese indexing by weeks.

Call useLocaleHead({ addSeoAttributes: true }) in your root layout. The composable auto-generates <link rel="alternate" hreflang="vi-VN"> for every page, plus the x-default alternate, the canonical URL, and the og:locale meta tag.

Should you lazy-load Vietnamese translations?

Yes. If Vietnamese is not your default locale, bundling its strings into the initial JS chunk wastes bandwidth for non-Vietnamese visitors. The file key in each locale object enables lazy-loading: Nuxt i18n fetches vi.json only when a user navigates to a Vietnamese route, then caches it for the session.

// locales/vi.json
{
  "home": {
    "hero": "Giải pháp dịch thuật chuyên nghiệp",
    "cta": "Yêu cầu báo giá"
  },
  "nav": {
    "about": "Giới thiệu",
    "contact": "Liên hệ"
  }
}

One encoding note: save all locale JSON files as UTF-8 without BOM. Vietnamese diacritics (U+1E00 to U+1EFF) encode as 3-byte UTF-8 sequences. Windows editors sometimes add a byte-order mark that some JSON parsers fail on, producing garbled Vietnamese text. VS Code shows the encoding in the status bar: look for "UTF-8", not "UTF-8 with BOM".

What can you handle in-house, and when does a Vietnamese specialist save you money?

The technical setup above - vue-i18n wiring, Nuxt config, hreflang, and lazy-loading - is fully in-house work. Machine translation tools such as DeepL and Google Translate handle straightforward Vietnamese UI strings reliably.

A native Vietnamese specialist is worth bringing in for:

  • Register decisions: Vietnamese has distinct formal (kính/quý khách) and informal (bạn) registers. The wrong register in a fintech or medical app erodes trust with Vietnamese users immediately.
  • Sino-Vietnamese terminology: Finance, legal, and medical vocabulary often has two valid Vietnamese translations - a Sino-Vietnamese term (formal, technical) and a pure-Vietnamese equivalent (accessible, colloquial). Choosing between them is a cultural judgment that MT consistently gets wrong.
  • Short UI strings without context: Button labels and error messages that lack surrounding context are where MT fails hardest in Vietnamese. A reviewer with the live app open catches these before launch.

A one-day review pass by a native Vietnamese professional on a machine-translated first draft typically costs far less than re-translating after user feedback. The Vietnamese website and app localization service at this site pairs engineering-aware review with human QA for Vue and Nuxt projects.

FAQ

Should I use vi or vi-VN as the locale code in vue-i18n?

Use vi in vue-i18n's locale setting and in filenames (vi.json). Set language: 'vi-VN' in the Nuxt i18n locales array to generate the BCP 47 hreflang tag. The two settings serve different purposes: vue-i18n message matching vs. HTML and HTTP language signaling to search engines.

Do I need custom pluralizationRules for Vietnamese in vue-i18n?

No. Vietnamese has no grammatical plural: Unicode CLDR assigns it only the "other" category. Vue i18n's default pluralization rule returns "other" for every numeric value, which is exactly correct for Vietnamese. Skip the pluralizationRules option and write single-form message strings.

How do I test that my Vietnamese hreflang tags are correct?

Build your site and check the page source for <link rel="alternate" hreflang="vi-VN"> tags. The href must be a fully-qualified URL (https://...). Use Google Search Console's URL Inspection tool to confirm Google parsed the hreflang after deploying. Also verify an x-default alternate exists pointing to your default-locale page.

My Vietnamese strings display as garbled characters. What is wrong?

The most common cause is a UTF-8 BOM in locale JSON files. Check VS Code's status bar for "UTF-8 with BOM" and re-save as "UTF-8". Another frequent cause: files read with Windows PowerShell 5.x Get-Content, which defaults to Windows-1252 and silently corrupts multi-byte Vietnamese diacritics. Use Node.js fs functions (readFileSync(path, 'utf8')) to read and write locale files.

Can I reuse the same vue-i18n messages in both a Vue SPA and a Nuxt app?

Yes. Vue i18n is the underlying library in both. The JSON message file format, interpolation syntax, and plural rules are identical. Nuxt adds routing, hreflang, and lazy-loading on top. If you migrate from a Vue SPA to Nuxt, your existing locales/vi.json files work without changes.

Official Sources

Dao Huy (Lucas)
Dao Huy (Lucas)
Graduate, University of Foreign Language Studies, University of Da Nang. Signs a certificate of accuracy on every certified translation (USCIS, IRCC).

Written by Dao Huy (Lucas), Vietnamese translator and localization specialist (English, Chinese and French into Vietnamese). See translation services →

Get QuoteWhatsApp