NeoIQ Localize

PO (Gettext)

NeoIQ Localize supports PO files, the widely-used Gettext localization format. This format is popular in many programming environments, particularly in Linux applications and PHP frameworks, offering support for context, plurals, and translator comments.


Setting Up

First, make sure you've got a neoiq-localize.json config file in your project root. Here's an example:

{
  "locale": {
    "source": "en",
    "targets": ["sv", "de", "fr"]
  },
  "files": {
    "po": {
      "include": ["locales/[locale]/LC_MESSAGES/messages.po"]
    }
  }
}

Translating

With your config set, run:

npx @neoiq/localize@latest translate

When you run this command, NeoIQ Localize will:

  • Load your source PO file (e.g., locales/en/LC_MESSAGES/messages.po)
  • Detect any new or modified translation strings
  • Generate translations for your target languages
  • Create or update the target language PO files (e.g., locales/sv/LC_MESSAGES/messages.po)
  • Preserve metadata, contexts, and plural forms
  • Maintain translator comments and reference information

How is this guide?

Edit on GitHub

Last updated on

On this page