Skip to content

Updating Interface Translations

Interface translations for WissKI modules live next to each module as Gettext .po files under translations/. German (de) translations are maintained in the repository.

When source strings change (new t() calls, changed labels, removed text), those .po files need to be refreshed so translators can see new and obsolete strings without losing work that is already done.

Refreshing .po files

Inside the WissKI devcontainer, the potx module is available as a development dependency. From a site with Drush and potx discoverable, refresh translations for one module, several modules, or every non-legacy WissKI module.

Refresh a single module:

drush wisski-devel:update-translations wisski_core

Refresh several modules in one run:

drush wisski-devel:update-translations wisski wisski_core

Omit the module arguments to refresh every discovered module under the WissKI package root except those in legacy/:

drush wisski-devel:update-translations

For each module, the command:

  1. Extracts the module's current translatable strings via potx PHP APIs (nested modules and non-source trees such as tests/ are skipped).
  2. Prints any potx translatability warnings collected during that pass (for example non-literal t() / logger messages, or empty localized strings). .po updates still proceed.
  3. Merges that extraction into every existing translations/*.po file under the module, keeping translations whose source strings still match.
  4. Drops entries that are no longer present in the sources (unless you pass --keep-orphans).
  5. Appends newly extracted sources with an empty msgstr.
  6. Creates translations/{project}.de.po when the module has no .po files yet ({project} comes from interface translation project in the module info when set, otherwise the machine name).

To retain manual or shared entries that potx does not extract from a module's sources (for example a “Common terms” section), run:

drush wisski-devel:update-translations wisski_core --keep-orphans

--keep-orphans applies to every module processed in that run.

After running the command

Review the resulting Git diff:

  • New msgid entries need a German (or other) msgstr.
  • Removed entries were dropped because they are no longer in the module sources (unless --keep-orphans was used).
  • Formatting of long strings and POT-Creation-Date may change even when translations did not; that is expected.

Commit the updated .po files together with the code change that introduced the new or changed strings.

This command only updates the files in the repository. Importing them into a running site's translation database is a separate step (for example drush locale:import).