Internationalization

Vuetify supports language internationalization of its components. When installing Vuetify you can specify available locales and the currently active locale with the lang option. See the Getting started section.

API

Name
current
Default
en
Type
string

undefined

Name
locales
Default
{ en: VuetifyLocale }
Type
Record<string, VuetifyLocale>

undefined

Name
t
Signature
(key: string, ...params: Array<string | number>): string
Type
Function

undefined

Getting started

To set the available locales or the current locale, supply the lang option when installing Vuetify. The provided locales property will be merged with the already existing locales. You can change the locale during runtime through the $vuetify object on the Vue instance.

import Vuetify from 'vuetify'
import sv from './i18n/vuetify/sv'

Vue.use(Vuetify, {
  lang: {
    locales: { sv },
    current: 'sv'
  }
})

...

Vue.component('my-component', {
  methods: {
    changeLocale () {
      this.$vuetify.lang.current = 'sv'
    }
  }
})

Create translation

To create your own translation, use the code below or copy and rename the file vuetify/src/locale/en.js to your project and make your changes.

export default {
  "dataIterator": {
    "rowsPerPageText": "Items per page:",
    "rowsPerPageAll": "All",
    "pageText": "{0}-{1} of {2}",
    "noResultsText": "No matching records found",
    "nextPage": "Next page",
    "prevPage": "Previous page"
  },
  "dataTable": {
    "rowsPerPageText": "Rows per page:"
  },
  "noDataText": "No data available"
}

Custom components

If you are building custom Vuetify components that need to hook into the internationalization engine, you can use the t function which exists both directly on the $vuetify object and on $vuetify.lang.

<template>
  <div class="my-component">
    {{ $vuetify.t('my-component.text') }}
  </div>
</template>

Vue i18n

If you are using the vue-i18n package, you can very easily integrate it with Vuetify. This allows you to keep all of your translations in one place. Simply create an entry for $vuetify within your messages and add the corresponding language changes. Then hook up vue-i18n to Vuetify by supplying a custom translation function (as seen in the example below). For a complete list of all available keys, navigate here.

An important note when using external localization plugins is that vuetify will not automatically fall back to using english if no localization exists for the current locale. So be sure to supply the plugin with the english localizations as well as your own.

import VueI18n from 'vue-i18n'
Vue.use(VueI18n)
const messages = {
  en: {
    $vuetify: {
      dataIterator: {
        rowsPerPageText: 'Items per page:',
        pageText: '{0}-{1} of {2}'
      }
    },
  },
  sv: {
    $vuetify: {
      dataIterator: {
        rowsPerPageText: 'Element per sida:',
        pageText: '{0}-{1} av {2}'
      }
    },
  }
}
// Create VueI18n instance with options
const i18n = new VueI18n({
  locale: 'sv', // set locale
  messages, // set locale messages
})
Vue.use(Vuetify, {
  lang: {
    t: (key, ...params) => i18n.t(key, params)
  }
})

RTL support

Vuetify supports RTL (right to left) languages through the rtl prop during bootstrap. This value is dynamic and will apply custom styles to change the orientation of your components.

import Vue from 'vue'
import Vuetify from 'vuetify'

Vue.use(Vuetify, {
  rtl: true
})

That's it! In order to change this value dynamically, you can modify the $vuetify.rtl property at any time within your application.