--- navigation.title: Vue title: Internationalization (i18n) in a Vue app description: 'Learn how to internationalize your Vue app and support multi-directional support (LTR/RTL).' select: items: - label: Nuxt icon: i-logos-nuxt-icon to: /getting-started/i18n/nuxt - label: Vue icon: i-logos-vue to: /getting-started/i18n/vue --- ::note{to="/components/app"} Nuxt UI provides an [App](/components/app) component that wraps your app to provide global configurations. :: ## Locale Use the `locale` prop with the locale you want to use from `@nuxt/ui/locale`: ```vue [App.vue] ``` ### Custom locale You also have the option to add your locale using `defineLocale`: ```vue [App.vue] ``` ::tip Look at the second parameter, there you need to pass the iso code of the language. Example: * `hi` Hindi (language) * `de-AT`: German (language) as used in Austria (region) :: ### Dynamic locale To dynamically switch between languages, you can use the [Vue I18n](https://vue-i18n.intlify.dev/) plugin. ::steps{level="4"} #### Install the Vue I18n package ::code-group{sync="pm"} ```bash [pnpm] pnpm add vue-i18n@10 ``` ```bash [yarn] yarn add vue-i18n@10 ``` ```bash [npm] npm install vue-i18n@10 ``` ```bash [bun] bun add vue-i18n@10 ``` :: #### Use the Vue I18n plugin in your `main.ts` ```ts [main.ts]{2,6-18,22} import { createApp } from 'vue' import { createI18n } from 'vue-i18n' import ui from '@nuxt/ui/vue-plugin' import App from './App.vue' const i18n = createI18n({ legacy: false, locale: 'en', availableLocales: ['en', 'de'], messages: { en: { // ... }, de: { // ... } } }) const app = createApp(App) app.use(i18n) app.use(ui) app.mount('#app') ``` #### Set the `locale` prop using `useI18n` ```vue [App.vue] ``` :: ## Supported languages :supported-languages ## Direction Use the `dir` prop with `ltr` or `rtl` to set the global reading direction of your app: ```vue [App.vue] ``` ### Dynamic direction To dynamically change the global reading direction of your app, you can use VueUse's [useTextDirection](https://vueuse.org/core/useTextDirection/) composable to detect and switch between LTR and RTL text directions. ::steps{level="4"} #### Install the `@vueuse/core` package ::code-group{sync="pm"} ```bash [pnpm] pnpm add @vueuse/core ``` ```bash [yarn] yarn add @vueuse/core ``` ```bash [npm] npm install @vueuse/core ``` ```bash [bun] bun add @vueuse/core ``` :: #### Set the `dir` prop using `useTextDirection` ```vue [App.vue] ```