How to translate a theme?


I use some words in my theme. I use translate() helper, and I achieved to generate .mo files (following module gulp i18n:module:template --module way gulp task).

However, these files aren’t used because I can’t specify their location because no PHP config file for the theme is read.

Is there a workaround?

Our themes are very short on their own strings, so we don’t currently have a system set up for S themes to load translations. It’s a bit of an issue just because the current translation loading system is designed to work with module config, which isn’t available to the themes. In some ways, the themes aren’t a particularly good match for Zend’s module system, since we want to only load the one we need for a particular site.

A crummy workaround that would work would be to have a module that just loads the translations, but that’s clearly far from ideal.

Thank you for your answer. :slight_smile:
I’ve added the config in local.config.php, it seems to work, whereas I thought it would override application translation.

'translator' => [
    'locale' => 'fr',
    'translation_file_patterns' => [
            'type' => 'gettext',
            'base_dir' => __DIR__ . '/../themes/myTheme/language',
            'pattern' => '',
            'text_domain' => null,

Since Omeka doesn’t seem to offer a simple route for a theme to provide its own translations, you can use the Translation plugin whose sole purpose is this. Just drop your .mo files in the plugin’s language directory.