Translations were stored in a
$GLOBALS array and handled by a static class
Piwik\Translate. Furthermore, handling of translations were spread all over the place, caching logic was mixed with translation logic, …
This refactoring contains:
Piwik\Translateis kept for BC and forwards call to the new
LoaderInterfacewith the following implementations:
LoaderCache: caches another loader by wrapping it (which would be the
devenvironment (= new DI config file) where translation cache is disabled: this environment can be used for other things as well
fr_CA(canadian french) would fallback to
frwhich would fallback to
Piwik\Translate\Writerand its subclasses to the LanguagesManager plugin because these classes were only used in that plugin
And I was able to unit tests the new classes, which is just an awesome feeling :)
There's still a lot of room for improvement, I'll keep working on that PR. Feedback welcome!
OK to review and merge (once tests are finished and green)
When merged, TODO:
OK I need to rebase again… Also this PR is for 2.11 so maybe don't merge yet?
It looks excellent, a nice clean code change for the new year :+1:
Cool you also updated everything else thanks!