Revision 1691
Added by darkviper over 12 years ago
ModLanguage.php | ||
---|---|---|
102 | 102 |
{ |
103 | 103 |
// now load and merge the files in order SYSTEM - DEFAULT - CURRENT |
104 | 104 |
$this->_aLanguageTable = array(); |
105 |
// at first search SYSTEM_LANGUAGE |
|
106 |
$this->_loadLanguage($sLangDir, $this->_sSystemLanguage); |
|
107 |
// at second merge DEFAULT_LANGUAGE |
|
108 |
if(!in_array($sDefaultLanguage, $this->_aLoadedLanguages)) { |
|
109 |
$this->_loadLanguage($sLangDir, $sDefaultLanguage); |
|
110 |
} |
|
111 |
// at third merge CURRENT_LANGUAGE |
|
105 |
// at first load DEFAULT_LANGUAGE |
|
106 |
$this->_loadLanguage($sLangDir, $sDefaultLanguage); |
|
107 |
// at second merge CURRENT_LANGUAGE to front if not already loaded |
|
112 | 108 |
if(!in_array($sCurrentLanguage, $this->_aLoadedLanguages)) { |
113 | 109 |
$this->_loadLanguage($sLangDir, $sCurrentLanguage); |
114 | 110 |
} |
111 |
// at last merge SYSTEM_LANGUAGE to background if not already loaded |
|
112 |
if(!in_array($this->_sSystemLanguage, $this->_aLoadedLanguages)) { |
|
113 |
$this->_loadLanguage($sLangDir, $this->_sSystemLanguage, true); |
|
114 |
} |
|
115 | 115 |
// if no predefined language was fond, search for first available language |
116 | 116 |
if(sizeof($this->_aLanguageTable) == 0) { |
117 | 117 |
// if absolutely no language was fond, throw an exception |
... | ... | |
139 | 139 |
* @param string $sLangDir |
140 | 140 |
* @param string $sLanguage |
141 | 141 |
*/ |
142 |
private function _loadLanguage($sLangDir, $sLanguage) |
|
142 |
private function _loadLanguage($sLangDir, $sLanguage, $bLoadSystemLanguage = false)
|
|
143 | 143 |
{ |
144 | 144 |
if(is_readable($sLangDir.$sLanguage.'.php')) { |
145 |
$this->_aLanguageTable = array_merge($this->_aLanguageTable, |
|
146 |
$this->_importArrays($sLangDir.$sLanguage.'.php')); |
|
145 |
$aTemp = $this->_importArrays($sLangDir.$sLanguage.'.php'); |
|
146 |
if($bLoadSystemLanguage) { |
|
147 |
$this->_aLanguageTable = array_merge($aTemp, $this->_aLanguageTable); |
|
148 |
}else { |
|
149 |
$this->_aLanguageTable = array_merge($this->_aLanguageTable, $aTemp); |
|
150 |
} |
|
147 | 151 |
$this->_aLoadedLanguages[] = $sLanguage; |
148 | 152 |
} |
149 | 153 |
} |
Also available in: Unified diff
ModLanguages:: fixed the order of loading languages