Vue
1.1M weekly downloads

Vue.js Localization with vue-i18n

The official i18n solution for Vue.js. Composition API support. Reactive translations. 1.1M weekly downloads. Built by the Vue core team.

Prerequisites

  • Vue 3 application
  • Node.js 18+
  • Vite or Vue CLI

Common Challenges

Problems developers face when localizing Vue apps—and how IntlPull helps.

Migration from v8 to v9

Significant API changes between Vue 2 (v8) and Vue 3 (v9). Migration requires code changes.

Bundle Size

Full library adds weight. Need to configure tree-shaking properly for production.

SSR Complexity

Server-side rendering requires careful setup. Nuxt users should use @nuxtjs/i18n instead.

vue-i18n Features

Why vue-i18n is a great choice for Vue localization.

Composition API

useI18n() composable for Vue 3. Reactive locale state. Tree-shakeable exports.

vs Options API only

Reactive Translations

Translations update automatically when locale changes. No manual re-renders needed.

vs imperative updates

Component Interpolation

Embed Vue components in translations. Rich text with interactive elements.

vs text-only interpolation

Datetime & Number

Built-in formatters for dates, times, numbers, and currencies. Locale-aware.

vs external libraries

Local Scope

Component-scoped translations. Override global messages per component.

vs global-only scope

Dev Tools

Vue DevTools integration. Inspect translations, missing keys, and locale state.

vs blind debugging

Quick Setup

Get vue-i18n running in your Vue project.

1

Install vue-i18n

Add vue-i18n to your Vue 3 project.

npm install vue-i18n@9
2

Create i18n Instance

Configure the i18n plugin.

import { createI18n } from 'vue-i18n';

const messages = {
  en: {
    hello: 'Hello World',
    greeting: 'Hello, {name}!'
  },
  es: {
    hello: 'Hola Mundo',
    greeting: 'Hola, {name}!'
  }
};

const i18n = createI18n({
  locale: 'en',
  fallbackLocale: 'en',
  messages,
});

export default i18n;
3

Register Plugin

Add i18n to your Vue app.

import { createApp } from 'vue';
import App from './App.vue';
import i18n from './i18n';

const app = createApp(App);
app.use(i18n);
app.mount('#app');
4

Use in Components

Access translations with useI18n or $t.

<script setup lang="ts">
import { useI18n } from 'vue-i18n';

const { t, locale } = useI18n();
</script>

<template>
  <h1>{{ t('hello') }}</h1>
  <p>{{ t('greeting', { name: 'Vue' }) }}</p>
  <select v-model="locale">
    <option value="en">English</option>
    <option value="es">Espanol</option>
  </select>
</template>

IntlPull Integration

Connect IntlPull to manage translations professionally.

1

Install IntlPull CLI

Add the CLI for translation management.

npm install -D @intlpull/cli
2

Extract Messages

Extract translation keys from your codebase.

npx intlpull extract --pattern 'src/**/*.vue' --output ./locales/en.json
3

Pull Translations

Download translations from IntlPull.

npx intlpull pull --format json --output ./src/locales
4

Configure Lazy Loading

Load translations dynamically.

import { createI18n } from 'vue-i18n';

const i18n = createI18n({
  locale: 'en',
  fallbackLocale: 'en',
  messages: {}, // Start empty
});

export async function loadLocaleMessages(locale: string) {
  const messages = await import(`./locales/${locale}.json`);
  i18n.global.setLocaleMessage(locale, messages.default);
  i18n.global.locale.value = locale;
}

export default i18n;

Frequently Asked Questions

Ready to Localize Your Vue App?

Start with our free tier. No credit card required.

    Vue.js Localization with vue-i18n | IntlPull | IntlPull