Skip to main content

Internationalization (i18n) for plugins

Headlamp plugins can include translations. Use the headlamp-plugin CLI to set up i18n, extract translatable strings, and add locales.

Minimal steps:

  • Add an npm script to run the extractor (if missing):

    "scripts": {
    "i18n": "headlamp-plugin i18n"
    }
  • Then you can start adding new translations by running the i18n script with a language code. For example:

    npm run i18n -- es
  • The command above will:

    1. Create a new i18n section to the package.json of the plugin:
    "headlamp": {
    "i18n": ["es"]
    }
    1. Create the translation file for that locale in locales/es/translation.json. This is the file you will need to translate.
  • To update the locales after a string addition or change, run npm run i18n.