Skip to content
Snippets Groups Projects
Commit 2c8a557c authored by hahn's avatar hahn
Browse files

use lang code XX-XX in plugins

parent aecf7139
No related branches found
No related tags found
1 merge request!195534 add docker
......@@ -30,13 +30,20 @@ class rollout_base implements iRolloutplugin{
* @var type
*/
protected $_aLang=false;
/**
* set language; 2 letter code, i.e. "de"; default language is "en" ; a
* file "lang_en.json" is required in the plugin dir
* @var string
*/
protected $_sLang = 'en';
protected $_sFallbackLang = 'en-en';
/**
* set language; 2 letter code, i.e. "de"; default language is "en" ; a
* file "lang_en.json" is required in the plugin dir
* @var string
*/
protected $_sLang = 'en-en';
/**
* string with phase of project; one of preview|stage|live
......@@ -336,7 +343,7 @@ class rollout_base implements iRolloutplugin{
* translated texts can be done with $this->_t("your_key")
*
* @see _t()
* @param string $sLang language code, i.e. "de"
* @param string $sLang language code, i.e. "de-de"
* @return boolean
*/
public function setLang($sLang=false){
......@@ -344,6 +351,10 @@ class rollout_base implements iRolloutplugin{
$oReflection=new ReflectionClass($this);
$sFile=dirname($oReflection->getFileName()) . '/lang_'.$this->_sLang.'.json';
if (!file_exists($sFile)){
$sFile=dirname($oReflection->getFileName()) . '/lang_'.$this->_sFallbackLang.'.json';
$this->_sLang=$this->_sFallbackLang;
}
$this->_aLang=(file_exists($sFile)) ? json_decode(file_get_contents($sFile), 1) : $this->_aLang;
return true;
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment