Skip to main content
Aikeedo uses gettext. Wrap your user-facing strings in the translation functions, ship .po catalogs inside your package, and Aikeedo merges them into the dictionary for every request.

Wrap your strings

The functions are global, so they work in PHP, and they’re registered as Twig functions and filters too.
In JavaScript that ships with your plugin, the same __() helper is available on pages that load Aikeedo’s bundles.
Use a context for every short UI string. p__('button', 'Open') and p__('label', 'Open') can be translated differently, which matters in languages where verbs and adjectives don’t share a form.

Catalog layout

  • One directory per locale, named with the xx-XX code Aikeedo uses.
  • The file is always messages.po.
  • Set the X-Domain header to messages, so your strings merge into the default dictionary and plain __() calls resolve. Without that header the catalog is loaded under the plugin domain, and your __() calls won’t find their translations.
locale/de-DE/LC_MESSAGES/messages.po
Aikeedo loads catalogs for every installed plugin, active or not, for the language it resolved for the request.

Extract strings

Run the console command from the installation root, and point it at your package:
It scans your .twig, .php and .js files, creates or updates the catalogs, removes entries that no longer exist in the source, and rebuilds the browser catalogs. Developing outside the installation directory works the same way:

Translate

Aikeedo can machine-translate the missing entries with a model:
Review machine translations before release, especially short UI strings where context matters.

Rebuild browser catalogs

Strings used from JavaScript are compiled into per-language files served to the browser:
Extracting and translating already do this, and clearing the cache from the admin panel rebuilds them too.

Ship the catalogs

Include the locale/ directory in your release archive. Nothing generates translations at install time, so a package without catalogs shows English to everyone.

Checklist

Every user-visible string goes through __(), p__() or n__().
Navigation labels use the nav context.
Catalogs live at locale/{code}/LC_MESSAGES/messages.po.
Every catalog sets X-Domain: messages.
You re-ran extraction after the last wording change.
The locale/ directory is in your release archive.