matomo-for-wordpress
matomo-for-wordpress copied to clipboard
Use WordPress translations system
We could hook into Matomo translations and replace the translations class to use WordPress translations (__('', 'wp-matomo')). This way other WP plugins can hook into it and more importantly we don't need to ship all translations with the plugin see https://make.wordpress.org/polyglots/handbook/rosetta/theme-plugin-directories/#translating-themes-plugins
Basically, through DI we would be replacing Piwik\Translation\Translator class and whenever translate() method is called, that method will be calling __($matomoTranslationKey, 'wp-matomo').
This means we need to generate WP translation files (*.mo/.po) whenever we update Matomo core.
We need to see how this could work for plugins. I suppose for any none core plugin we wouldn't really want to do this and would need to fallback to Matomo logic?
See https://github.com/matomo-org/wp-matomo/pull/36 started some work of it. It'll be great if we could reduce the release file this way by needing only one language
Hello @tsteur
I guess with the closed PR, we can close this issue too?
I think that makes sense for now 👍