Skip to content

Localisation (future)

roundabout-host.com edited this page Sep 16, 2025 · 1 revision

This article is a work in progress

Some components of Wayfire that display user-visible text are localised using gettext. These are the WCM and the plugins. Translation catalogues are installed in PREFIX/locale and the WCM looks for a catalogue/domain named wf-plugin-PLUGINNAME for each plugin, which will provide translations for the option names, description and enum value names in the XML file; these can be extracted to a pot file with itstool using the following ITS schema:

<?xml version="1.0" encoding="UTF-8"?>
<its:rules xmlns:its="http://www.w3.org/2005/11/its"
           version="2.0">
    <its:translateRule translate="no" selector="//*"/>
    <its:translateRule translate="yes" selector="//_short"/>
    <its:translateRule translate="yes" selector="//_long"/>
    <its:translateRule translate="yes" selector="//_name"/>
</its:rules>

Translator's workflow

  1. Extract your pot file as mentioned above
  2. Merge the pot into your po (mandatory, so you're aware of any new or changed strings
  3. Edit your po

Don't generate a mo because they will be made at build time and don't commit the pot. You can use the usual gettext commands or a graphical editor such as Poedit which will greatly simplify navigating the po files.

To translate wcm, do a similar process but use xgettext normally, extracting from all cpp and hpp files in the source directory.

For plugin authors

You don't need to do anything, the catalogues will be added for each translation as they appear, and the XML files are implicitly translatable. That is, unless your plugin displays user-visible messages somewhere else in which case it is recommended to use the same catalogue (with dgettext!) and instruct translators to also merge the translations from xgettext.

Clone this wiki locally