---
title: "i18n"
description: "A guide to set up internationalization (i18n) for your Nuxt Starter Kit"
canonical_url: "https://nnsvn.me/products/nuxt-starter-kit/api/configuration/i18n"
---

> Index of every page on this site: [llms.txt](https://nnsvn.me/llms.txt)

## Configuring internationalization

<ct-steps>

### Add `i18n` Configuration

First, you need to add the `i18n` configuration to your Nuxt.js project. Open your `nuxt.config.ts` file and add the following configuration:

```ts [nuxt.config.ts]
export default defineNuxtConfig({
  // Other nuxt configurations ...
  i18n: {
    defaultLocale: 'en',
    locales: [
      {
        code: 'en',
        name: 'English',
        language: 'en-US',
      },
      {
        code: 'xx', // language 2 letters code (e.g. 'fr')
        name: 'Xxxxx', // language name (e.g. 'Français')
        language: 'xx-XX', // language ISO code (e.g. 'fr-FR')
      },
    ],
  },
};
```

### Organize Your Content Files

To support multiple languages, you need to organize your content files in a specific directory structure. Follow this file tree structure:

<ct-file-tree :tree="[{"content":["index.md",{"xx":["index.md"]}]}]">



</ct-file-tree>

- The `content` directory contains your default language content files.
- The `xx` directory inside `content` contains the translations of your content files,`xx` being the language code (e.g., `fr/index.md` for French).

<ct-alert title="Note" type="info">

If you are using language codes that are not two letters (e.g., `zh-CN` and `en-US`), your content folder name should be in **lowercase**.

Alternatively, you can set `content.respectPathCase: true` in `nuxt.config.ts` to use the same case as the language code.

```ts [nuxt.config.ts]
export default defineNuxtConfig({
  content: {
    respectPathCase: true,
  },
};
```

</ct-alert>

### Create `i18n/i18n.config.ts`

Next, create a new file named `i18n/i18n.config.ts`. This file will contain the configuration for your i18n messages to translate. Add the following code to the file:

```ts [i18n/i18n.config.ts]
import { defineI18nConfig } from '@nuxtjs/i18n';

export default defineI18nConfig(() => ({
  legacy: false,
  locale: 'en',
  messages: {
    en: {
      // Add here all english strings defined in docs.config.ts e.g. titles in header.nav or toc.title
      // Default UI strings are already translated out of the box

      shiki: 'shiki', // for example: site title
    },
    xx: {
      // Add here all translation

      shiki: '式', // for example: site title
    },
  },
}));
```

### UI Translation

The UI locale will follow the selected language in the language switcher. UI translations are provided out-of-the-box for the following languages:

- `en` (English)
- `vi` (Tiếng Việt)

<ct-alert icon="lucide:git-pull-request-arrow" to="https://github.com/No-Name-Studio-VN/Homepage/issues">

If you want to add more UI locales, feel free to contribute to the project.

</ct-alert>

Or if you want to add your own translations, you can do so by following the structure in the [`i18n/i18n.config.ts`](https://github.com/No-Name-Studio-VN/Homepage/blob/main/i18n/i18n.config.ts) file. Just add the translations for the keys you want to translate in the respective language object.

</ct-steps>

## Sitemap

See the full [sitemap](https://nnsvn.me/sitemap.md) for all pages.
