Skip to main content

Internationalisation

The plugin uses Docusaurus's i18n locale when choosing FAQ files. For a non-default locale, it checks a locale-specific directory. If that directory doesn't exist, it uses the configured path.

Locale directory​

For a locale named fr, the plugin checks:

i18n/fr/docusaurus-plugin-faqs/

If that directory exists, it is used instead of the configured path. If it does not exist, the plugin falls back to the configured path (the default-locale files).

Setup​

  1. Enable your locale in docusaurus.config.ts:

    i18n: {
    defaultLocale: 'en',
    locales: ['en', 'fr'],
    }
  2. Create the locale directory and add translated YAML files:

    i18n/
    └── fr/
    └── docusaurus-plugin-faqs/
    ├── my-first-faq.yaml
    └── my-second-faq.yaml
  3. Build the French locale:

    docusaurus build --locale fr

The translated FAQ page is served at the locale's URL prefix (e.g. /fr/faqs).

Partial translations​

If the locale directory exists, the plugin uses only the files in that directory. It does not merge them with the default-locale files, even if the locale directory contains fewer entries.