Skip to main content

Documentation

In this documentation, you will find all the important information about the plugin – from installation and configuration to usage and extension.

Multilingual Support

In this post, we’ll walk you through:


Cevento is developed in English and ships with German translations (de_DE, de_AT, de_CH and de_DE_formal). The language is chosen automatically: the site language (Settings → General) on the website, and the language in the user’s profile in the WordPress admin.

As usual in WordPress, you can customize these translations or add new languages in an update-safe way. This applies to all plugin texts, including those displayed by Cevento’s JavaScript (booking form, form builder, admin notifications, …).

Texts you enter in the Cevento settings yourself (e.g. email templates or the booking button label) are stored as settings, not translations. Change them directly in the settings.

Where Translations Are Loaded From

WordPress looks for Cevento’s translations in two places, in this order:

  1. [wp_root]/wp-content/languages/plugins/: your own translations. This directory is not touched by plugin updates.
  2. [plugin_root]/languages/: the translations shipped with the plugin. This directory is replaced with every update, so never make changes here.

The file names must follow the pattern cevento-[locale_code].po / cevento-[locale_code].mo, e.g. cevento-de_DE.mo for German (Germany) or cevento-fr_FR.mo for French. You can find all locale codes in this list.

Important: your own file for a language replaces the shipped translation of that language completely; the two are not merged. So always start from a complete copy of the shipped file (see below). Texts missing from your file are displayed in English.

Requirements

To edit translation files, we recommend Poedit. It edits .po files and automatically creates the .mo file WordPress uses whenever you save.

Alternatively, you can use the command line tools of gettext: msgfmt compiles an edited .po file into a .mo file.

Adjusting Existing Translations

  1. Copy the .po file of the desired language from [plugin_root]/languages/, e.g. cevento-de_DE.po, into the directory [wp_root]/wp-content/languages/plugins/. The file name must match the language of your site. For an Austrian site (de_AT), for example, copy cevento-de_AT.po.

  2. Open the copied file and change the desired translations.

  3. Create the .mo file: Poedit does this automatically when saving. With gettext:

    msgfmt -o cevento-de_DE.mo cevento-de_DE.po
  4. Make sure both files are in [wp_root]/wp-content/languages/plugins/. WordPress only uses the .mo file; keep the .po file for future changes.

Your changes apply immediately to all texts, including those displayed by the plugin’s JavaScript. If a caching plugin is active, clear its cache afterwards.

If there is also a file cevento-[locale_code].l10n.php in [wp_root]/wp-content/languages/plugins/ (e.g. created by a translation tool), WordPress prefers it over the .mo file. In that case, delete it, or regenerate it after each change with wp i18n make-php.

After a Plugin Update

New or changed texts of a new Cevento version are not part of your own file yet and are therefore displayed in English. To add them to your file:

  • Poedit: open your .po file, choose Translation → Update from POT File… and select the file [plugin_root]/languages/cevento.pot. Translate the new entries and save.
  • WP-CLI: run

    wp i18n update-po [plugin_root]/languages/cevento.pot [wp_root]/wp-content/languages/plugins/cevento-de_DE.po

    then translate the new entries and create the .mo file again as described above.

Your existing translations are kept in both cases.

Changing Individual Texts

If you only want to change a few texts, you don’t need your own translation file. Use the gettext_cevento filter instead, e.g. in your (child) theme’s functions.php or in a small plugin:

add_filter('gettext_cevento', function ($translation, $text) {
    if ($text === 'Download iCAL') {
        return 'Add to calendar';
    }

    return $translation;
}, 10, 2);
  • $text is always the original English text of the plugin. You can find it as msgid in the file [plugin_root]/languages/cevento.pot.
  • The filter applies to all languages and also to the texts displayed by the plugin’s JavaScript. To change a text for one language only, additionally check determine_locale(), e.g. if ($text === 'Download iCAL' && determine_locale() === 'de_DE').
  • For texts with singular and plural forms (e.g. %d participants), use the ngettext_cevento filter instead, which also receives the number ($translation, $single, $plural, $number).

Adding a New Language

  1. Create a new translation from the template [plugin_root]/languages/cevento.pot:
    • Poedit: File → New from POT/PO File…, select cevento.pot and choose the language.
    • Manually: copy cevento.pot and rename the copy to cevento-[locale_code].po, e.g. cevento-fr_FR.po.
  2. Translate all texts and save the file as cevento-[locale_code].po in the directory [wp_root]/wp-content/languages/plugins/.
  3. Create the .mo file (Poedit does this automatically when saving):

    msgfmt -o cevento-fr_FR.mo cevento-fr_FR.po

As soon as the site (or the user profile) is set to this language, Cevento uses your translation, including for the texts displayed by its JavaScript. After plugin updates, add new texts as described in After a Plugin Update.