Skip to content

Internationalization Updates

Mark Sujew edited this page Jul 26, 2023 · 2 revisions

Theia has internationalization features that make use of the vscode language packs, which contain key/value pairs that belong to their respective vscode version. Installing a language pack that doesn't belong to the currently version might leave some parts of the application untranslated. We perform two kinds of regular updates to translation files to prevent this issue.

Localization Metadata File

As Theia regularly updates the vscode API version, we consequently also regularly update the version of supported language packs. To keep the key/value pairs that are used throughout the application in sync, we keep a nls.metadata.json file in the repo. When calling nls.localizeByDefault, the metadata file is used to pick the correct key for the selected language pack. As with the support language pack version, the version of the nls.metadata.json file needs to be aligned with the vscode API version.

This file is a by-product of compiling vscode:

  1. Clone vscode from https://github.com/microsoft/vscode and switch to the desired tag.
  2. Install the required dependencies with yarn install.
  3. Execute the build with npx gulp --max-old-space-size=8192 vscode-translations-export.

The nls.metadata.json will appear in the build/out-vscode directory of the repository. Updating the file might lead to linting errors, as values used in the nls.localizeByDefault might no longer be valid. The repository contains linting rules that provide automatic fixes for minor changes in values used in nls.localizeByDefault. If values have been removed, then changing to nls.localize is recommended.

Theia translations

Everything that cannot be translated through language packs is translated by additional translation files that are bundled into the @theia/core package. We update these files before every release using a GitHub Action. This workflow can be triggered manually here and results in a pull request that commits all newly added translations to the repo.