diff options
author | Matthieu Aubry <matt@piwik.org> | 2015-02-10 02:45:45 +0300 |
---|---|---|
committer | Matthieu Aubry <matt@piwik.org> | 2015-02-10 02:45:45 +0300 |
commit | 36d87593bc0dfbad4126ef1ed4845be3f30e54dc (patch) | |
tree | f799641c9cce9b077d0a2429fccba63f4b5084e6 /plugins | |
parent | 25409d6d66524f71cc1379c409d73cefbd72ae59 (diff) | |
parent | 3bf35892dd9c42d7765c3e79906abc06cc6f350b (diff) |
Merge pull request #7156 from piwik/translation-id-language
Added a new "Development" language that shows the raw translation IDs
Diffstat (limited to 'plugins')
-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]); + } + } + } } |