Project

General

Profile

« Previous | Next » 

Revision 1929

Added by darkviper over 11 years ago

added new method to class Translate. it gives possibility to handle translations with additional replacements.

View differences:

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

  
14
21 Jun-2013 Build 1929 Werner v.d.Decken(DarkViper)
15
! added new method to class Translate. it gives posibility to handle translations with additional replacements.
14 16
20 Jun-2013 Build 1928 Werner v.d.Decken(DarkViper)
15 17
# class WbDatabase fixed select_db() in multiconnect modus
16 18
10 Jun-2013 Build 1927 Werner v.d.Decken(DarkViper)
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', '1928');
54
if(!defined('REVISION')) define('REVISION', '1929');
55 55
if(!defined('SP')) define('SP', '');
branches/2.8.x/wb/framework/Translate.php
223 223
		throw new TranslationException('tried to set a readonly or nonexisting property ['.$name.']!! ');
224 224
	}
225 225
/**
226
 * Get translation text with replaced placeholders
227
 * @param type $sKey
228
 * @param type $aArguments
229
 * @return type
230
 */
231
    public function __call($sKey, $aArguments)
232
    {
233
		$sRetval = '';
234
		foreach($this->aActiveTranslations as $oAddon) {
235
			if(isset($oAddon->$sKey)) {
236
			// search the last matching translation (Core -> Addon)
237
				$sRetval = $oAddon->$sKey;
238
			}
239
		}
240
		if(sizeof($aArguments) > 0 && $sRetval != '') {
241
			foreach($aArguments as $iKey=>$sArgument) {
242
				if(is_string($sArgument)) {
243
					$sRetval = preg_replace('/\{'.$iKey.'\}/', $sArgument, $sRetval);
244
				}
245
			}
246
		}
247
		return ($sRetval != '' ? $sRetval : ($this->bRemoveMissing ? '' : '#'.$sKey.'#'));
248
    }
249

  
250
/**
226 251
 * Return complete table of translations
227 252
 * @return array
228 253
 * @deprecated for backward compatibility only. Will be removed shortly

Also available in: Unified diff