Reference

Supported frameworks

TolkBot recognizes your i18n framework and finds your locale files in the repository.

There are no per-framework default paths. Whatever framework TolkBot finds, the source pattern comes from the locale files it finds in your repository: messages/en.json becomes messages/{locale}.json, and public/locales/en/common.json becomes public/locales/{locale}/{namespace}.json.


next-intl

For Next.js applications using next-intl.

TolkBot looks for next-intl in package.json, its configuration (i18n/request.ts, i18n/routing.ts, or the plugin in next.config) and the locale files in a messages/ directory.

What TolkBot does in a next-intl project, with an example: TolkBot for next-intl.

// messages/en.json
{
    "HomePage": {
        "title": "Welcome",
        "description": "This is the home page"
    }
}

next-i18next

For Next.js applications using next-i18next.

TolkBot looks for next-i18next in package.json and reads next-i18next.config.js for the locales and the locale path.


react-i18next and i18next

For React applications using react-i18next, and JavaScript or Node.js applications using i18next on its own.

TolkBot looks for react-i18next or i18next in package.json and reads the i18next configuration (src/i18n.ts, i18n/index.ts and similar) for the languages.

Namespace-based file splitting is supported:

public/locales/en/common.json
public/locales/en/dashboard.json

What TolkBot does in an i18next project, with an example: TolkBot for i18next and react-i18next.


Expo

For React Native applications built with Expo that use i18n-js.

TolkBot detects Expo projects through i18n-js: it looks for i18n-js in package.json (or expo-localization together with expo) and follows the files that import it to find your translations.


vue-i18n

For Vue.js applications using vue-i18n, including Nuxt with @nuxtjs/i18n.

TolkBot looks for vue-i18n or @nuxtjs/i18n in package.json and reads the configuration (i18n.config.ts, src/i18n/index.ts, nuxt.config.ts).


Other setups

A repository that uses none of these can still be translated. TolkBot looks for locale files in directories named locales, locale, messages, i18n, translations, lang or languages. If it finds nothing, the project asks you for a source pattern when you create it. See Supported formats for the file formats it reads.


Detection

When you create a project in the dashboard, or run tolkbot init in the CLI, TolkBot:

  1. Checks package.json for i18n library dependencies
  2. Reads framework-specific configuration files
  3. Scans the repository for locale files
  4. Infers locale codes from directory and file names
  5. Determines the base language (prefers en if found)

The dashboard shows the detected framework on the project's Settings → Languages page; you can't change it there, and nothing you can set depends on it. If the source pattern or the base language is wrong, change those on the same page. The CLI's tolkbot init takes a --framework flag.

Previous
Supported formats