diff options
author | Matthieu Napoli <matthieu@mnapoli.fr> | 2015-02-09 05:09:51 +0300 |
---|---|---|
committer | Matthieu Napoli <matthieu@mnapoli.fr> | 2015-02-10 00:23:22 +0300 |
commit | 3bf35892dd9c42d7765c3e79906abc06cc6f350b (patch) | |
tree | 53bccdc99d95f08ee3c2ff577176e0e8092a8e2d /plugins/LanguagesManager | |
parent | e084b065d0b8abd8684fb74be4d1e0e66db33f74 (diff) |
#7094 Added a new "Development" language that shows the raw translation id
This language is shown when development mode is enabled.
Diffstat (limited to 'plugins/LanguagesManager')
-rw-r--r-- | plugins/LanguagesManager/API.php | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/plugins/LanguagesManager/API.php b/plugins/LanguagesManager/API.php index f3f50ad57f..ca491892ed 100644 --- a/plugins/LanguagesManager/API.php +++ b/plugins/LanguagesManager/API.php @@ -10,10 +10,12 @@ namespace Piwik\Plugins\LanguagesManager; use Piwik\Db; +use Piwik\Development; use Piwik\Filesystem; use Piwik\Piwik; use Piwik\Cache as PiwikCache; use Piwik\Plugin\Manager as PluginManager; +use Piwik\Translation\Loader\DevelopmentLoader; /** * The LanguagesManager API lets you access existing Piwik translations, and change Users languages preferences. @@ -66,6 +68,8 @@ class API extends \Piwik\Plugin\API } } + $this->enableDevelopmentLanguageInDevEnvironment($languages); + /** * Hook called after loading available language files. * @@ -295,4 +299,14 @@ class API extends \Piwik\Plugin\API $this->availableLanguageNames = $languagesInfo; } + + private function enableDevelopmentLanguageInDevEnvironment(&$languages) + { + if (!Development::isEnabled()) { + $key = array_search(DevelopmentLoader::LANGUAGE_ID, $languages); + if ($key) { + unset($languages[$key]); + } + } + } } |