Skip to main content
gettext uses POT files as source message templates and PO files as locale catalogs. These catalogs can include message context and plural forms. For CLI generation, prepare a source-language .po with populated msgstr values. Direct .pot translation is not supported. Supported extensions: .po.

Source file

Save this example as locales/en-US/messages.po.

Configure your files

Use this i18n.yml for the example, or add its file mapping to your existing bucket. See path templates for other layouts.

Translate

Install the CLI and set OPENAI_API_KEY in your project’s .env.local or shell. You can also configure another AI provider.
The dry run previews the work. The second command writes translations to the configured target path and updates the lockfile.

Behavior and limitations

  • Uses msgid as the entry key and msgstr as its value; multiline quoted continuations are supported.
  • Use a source-language PO with populated msgstr values for generation, as shown here. .pot is not a registered translation file extension.
  • The header entry is skipped. Context (msgctxt) does not distinguish keys, so avoid duplicate IDs distinguished only by context.
  • Plural handling maps only msgstr[0]; this is not full locale-specific plural generation. Writeback preserves PO structure and replaces mapped values.

Next steps