Internationalization
WARNING
From version
v0.8.0
, this module requires latest
@nuxtjs/i18n
Nuxt module:
^8.0.0
.
Install and configure @nuxtjs/i18n Nuxt module, and you're ready to use Vuetify internationalization features.
TIP
NOTE: You need to provide the translations by yourself. The module won't provide them automatically. You can include the translations from
vuetify/locale
or add your own ones.
Check Using Vuetify translations example.
Examples
The
@nuxtjs/i18n
module, from version
8.0.0.beta.13+
, requires splitting Nuxt (
@nuxtjs/i18n
) and Vue (
vue-i18n
) configuration files. In the previous beta versions, we could use a single configuration file, but now we need to split them, check the corresponding Nuxt configuration in the following examples.
If you want to run any playground in your local, check the contributing guide , download/clone to your local machine the GitHub repo (node 18+ required to build the Nuxt module).
WARNING
Before following the instructions below, read the Contribution Guide .
Using Vuetify translations
You should use lazy loading , check Lazy loading configuration example.
Nuxt configuration
Add the
@nuxtjs/i18n
and
vuetify-nuxt-module
modules and configure them using
i18n
and
vuetify
options respectively.
The following example is using json files for the internationalization messages:
Vue configuration
Add the
vue-i18n
configuration file, you can move it to the root folder (remember to update
i18n.vueI18n
option), following with the previous Nuxt configuration:
i18n folders
Vuetify messages must be added under the
$vuetify
key, adding your application messages to the root: you can access to Vuetify messages using
$vuetify.
prefix.
For example, to add the Vuetify messages along with the application messages included in the corresponding JSON (you can inline the application messages here):
Playground
You can check the Nuxt configuration in the Nuxt config file in the Vuetify locale playground folder, and the Vue configuration file inside the example root folder.
You can run the playground using:
-
run from root folder:
-
change to the
vuetify-locale-playground
folder: -
from the
vuetify-locale-playground
folder run:
You can find inside locales folder the TypeScript and JSON files used in the playground.
Lazy loading configuration
This example shows how to use the lazy loading option, using only json files, you can use also JavaScript or TypeScript files, loading also Vuetify translations.
Nuxt configuration
You will need to add the
@nuxtjs/i18n
and
vuetify-nuxt-module
modules, and then configure them using
i18n
and
vuetify
options respectively.
The following example using json files for the internationalization messages using JSON files (you can also use Javascript or TypeScript files, check i18n files :
Vue configuration
Add the
vue-i18n
configuration file, you can move it to the root folder (remember to update
i18n.vueI18n
option), following with the previous Nuxt configuration: