Skip to main content



These commands are for developers who want to contribute to Logto. If you just want to use Logto with custom translation, please refer to this guide.

Sync keysโ€‹

Let's say we made some changes to the translation keys in the en folder of the phrases package. We want to sync these changes to the pt-BR folder. Run the command below to sync translation keys and file structure:

pnpm cli translate sync-keys --target pt-BR

This command will read all translation keys from the source language folder (en by default) and sync them to the target language folder (pt-BR in this example).

  • If the target language folder doesn't exist, it will be created automatically;
  • If the target language folder already exists, it will be updated with new keys and removed with obsolete keys.

For each translation key:

  • If a key is missing in the target, it will be added with a comment to indicate that the phrase is untranslated (marked with // UNTRANSLATED);
  • If a key is missing in the baseline, it will be removed from the target;
  • If a key exists in both the baseline and the target, the value of the target will be used.

To sync keys for all languages in the phrases package, run the command below:

pnpm cli translate sync-keys --target all

Thus we can focusing on updating the translation keys in the source language folder, and the translation keys in other languages will be updated automatically.


This command executes for phrases package by default. You can specify the package name by --package option. For example, use --package phrases-ui to sync keys for the phrases-ui package.

After syncing keys, we can translate the keys using ChatGPT API.

Translte keys using ChatGPTโ€‹

Run the command below to translate keys using ChatGPT:

pnpm cli translate sync

This command will translate all untranslated keys (marked with // UNTRANSLATED) across all languages in the phrases and phrases-ui packages. Note an environment variable OPENAI_API_KEY is required to run this command.