Revision 1929
Added by darkviper over 12 years ago
| 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
added new method to class Translate. it gives possibility to handle translations with additional replacements.