Project

General

Profile

« Previous | Next » 

Revision 1691

Added by darkviper over 12 years ago

ModLanguages:: fixed the order of loading languages

View differences:

branches/2.8.x/CHANGELOG
11 11
! = Update/Change
12 12
===============================================================================
13 13

  
14
10 Jun-2012 Build 1691 Werner v.d.Decken(DarkViper)
15
# fixed the order of loading languages
14 16
31 May-2012 Build 1690 Werner v.d.Decken(DarkViper)
15 17
! ModLanguage modified for auto fallback to DEFAULT_LANGUAGE
16 18
! globalExceptionHandler added AppException, SecurityException, SecDirectoryTraversalException
branches/2.8.x/wb/admin/interface/version.php
51 51

  
52 52
// check if defined to avoid errors during installation (redirect to admin panel fails if PHP error/warnings are enabled)
53 53
if(!defined('VERSION')) define('VERSION', '2.8.3');
54
if(!defined('REVISION')) define('REVISION', '1690');
54
if(!defined('REVISION')) define('REVISION', '1691');
55 55
if(!defined('SP')) define('SP', '');
branches/2.8.x/wb/framework/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