# Fumadocs Core (the core library of Fumadocs): Configuration
URL: /docs/headless/internationalization/config
Source: https://raw.githubusercontent.com/fuma-nama/fumadocs/refs/heads/main/apps/docs/content/docs/headless/internationalization/config.mdx

Shared i18n configuration

<Callout title="Core API Only">
For framework integration guide, see [Internationalization](/docs/next/internationalization).
</Callout>

## Define Config [#define-config]

Fumadocs core provides necessary middleware and utilities for i18n support.

You can define a config to share between utilities.

```ts title="lib/i18n.ts"
import { defineI18n } from 'fumadocs-core/i18n';

export const i18n = defineI18n({
  defaultLanguage: 'en',
  languages: ['en', 'cn'],
});
```

### Hide Locale Prefix [#hide-locale-prefix]

To hide the locale prefix (e.g. `/en/page` -> `/page`), use the `hideLocale` option.

```ts
import { defineI18n } from 'fumadocs-core/i18n';

export const i18n = defineI18n({
  defaultLanguage: 'en',
  languages: ['en', 'cn'],
  hideLocale: 'default-locale',
});
```

| Mode             | Description                                        |
| ---------------- | -------------------------------------------------- |
| `always`         | Always hide the prefix, detect locale from cookies |
| `default-locale` | Only hide the default locale                       |
| `never`          | Never hide the prefix (default)                    |

<Callout type="warn">
On `always` mode, locale is stored as a cookie (set by the middleware), which isn't optimal for static sites.

This may cause undesired cache problems, and need to pay extra attention on SEO to ensure search engines can index your pages correctly.
</Callout>

### Fallback Language [#fallback-language]

The fallback language to use when translations are missing for a file, default to your `defaultLanguage`.

It accepts one of the languages in your `languages` array.

```ts
import { defineI18n } from 'fumadocs-core/i18n';

export const i18n = defineI18n({
  languages: ['en', 'cn'],
  defaultLanguage: 'en',
  // Chinese variant is used if a file is missing in English
  fallbackLanguage: 'cn',
});
```

To disable the fallback behaviour, set it to `null`:

```ts
import { defineI18n } from 'fumadocs-core/i18n';

export const i18n = defineI18n({
  languages: ['en', 'cn'],
  defaultLanguage: 'en',
  fallbackLanguage: null,
});
```

When disabled, no fallback will be used (including `meta.json`). You can still create a shared file for every locale with `$`:

<Files>
<File name="my-page.$.md" />

<File name="meta.$.json" />
</Files>