---
title: "next-international"
description: "The preset for next-international. It reads useI18n, useScopedI18n and their server versions, and TS locale files."
canonical_url: "https://x18n.dev/presets/next-international"
---
# next-international

> The preset for next-international. It reads useI18n, useScopedI18n and their server versions, and TS locale files.

The `next-international` preset supports [next-international](https://next-international.vercel.app).

## Detection

The preset applies when the project depends on `next-international`.

```ts [x18n.config.ts]
import { defineConfig } from '@x18n/core'

export default defineConfig({
  presets: ['next-international'],
})
```

## Locale files

If your config has no `resources`, the preset uses `locales/{locale}.{ext}` and `src/locales/{locale}.{ext}`.

next-international keeps messages in TS modules. The `js` format reads a module whose default export is an object literal, also with `as const`, and writes edits back into the literal:

```ts [locales/en.ts]
export default {
  hello: 'Hello {name}',
  settings: { title: 'Settings' },
} as const
```

This file has the keys `hello` and `settings.title`.

## Supported syntax

`useI18n` and `getI18n` return a translate function. `useScopedI18n` and `getScopedI18n` return one with a key prefix, from their first argument:

```tsx [app/page.tsx]
import { useI18n, useScopedI18n } from '../locales/client'

function Page({ name }: { name: string }) {
  const t = useI18n()
  const scopedT = useScopedI18n('settings')
  return (
    <>
      <h1>{t('hello', { name })}</h1>
      <p>{scopedT('title')}</p>
    </>
  )
}
```

`scopedT('title')` is a usage of `settings.title`.

## Placeholders

Braces: `{name}`.

## Extraction templates

| Kinds                      | Template                    |
| -------------------------- | --------------------------- |
| `jsx-text`                 | `{t('{key}'{args})}`        |
| `jsx-attribute`            | `{attr}={t('{key}'{args})}` |
| `js-string`, `js-template` | `t('{key}'{args})`          |


## Sitemap

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