From dd7a6159c4224a6a3dda22a1f35f5fb13b06ec2e Mon Sep 17 00:00:00 2001 From: Gerrit Uitslag Date: Sun, 28 Sep 2014 13:27:05 +0200 Subject: use config cascade for loading of localizations --- inc/plugin.php | 24 ++++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-) (limited to 'inc/plugin.php') diff --git a/inc/plugin.php b/inc/plugin.php index dd374a4a4..f632e3dd0 100644 --- a/inc/plugin.php +++ b/inc/plugin.php @@ -114,17 +114,29 @@ class DokuWiki_Plugin { * this function is automatically called by getLang() */ function setupLocale() { - if ($this->localised) return; + if($this->localised) return; - global $conf; // definitely don't invoke "global $lang" - $path = DOKU_PLUGIN.$this->getPluginName().'/lang/'; + global $conf, $config_cascade; // definitely don't invoke "global $lang" + $path = DOKU_PLUGIN . $this->getPluginName() . '/lang/'; $lang = array(); // don't include once, in case several plugin components require the same language file - @include($path.'en/lang.php'); - if ($conf['lang'] != 'en') @include($path.$conf['lang'].'/lang.php'); - @include(DOKU_CONF.'plugin_lang/'.$this->getPluginName().'/'.$conf['lang'].'/lang.php'); + @include($path . 'en/lang.php'); + foreach($config_cascade['lang']['plugin'] as $config_file) { + if(@file_exists($config_file . $this->getPluginName() . '/en/lang.php')) { + include($config_file . $this->getPluginName() . '/en/lang.php'); + } + } + + if($conf['lang'] != 'en') { + @include($path . $conf['lang'] . '/lang.php'); + foreach($config_cascade['lang']['plugin'] as $config_file) { + if(@file_exists($config_file . $this->getPluginName() . '/' . $conf['lang'] . '/lang.php')) { + include($config_file . $this->getPluginName() . '/' . $conf['lang'] . '/lang.php'); + } + } + } $this->lang = $lang; $this->localised = true; -- cgit v1.2.3