mirror of
https://github.com/humhub/humhub.git
synced 2025-01-18 06:38:14 +01:00
Added translation callback
This commit is contained in:
parent
47463518bc
commit
52c0a9e958
@ -36,6 +36,15 @@ class I18N extends BaseI18N
|
||||
*/
|
||||
public $unsupportedYiiLanguages = ['an'];
|
||||
|
||||
/**
|
||||
* Called before the translate method is executed.
|
||||
* e.g. to modify translations on the fly.
|
||||
*
|
||||
* @since 1.4
|
||||
* @var callable
|
||||
*/
|
||||
public $beforeTranslateCallback;
|
||||
|
||||
/**
|
||||
* Automatically sets the current locale and time zone
|
||||
*/
|
||||
@ -131,6 +140,11 @@ class I18N extends BaseI18N
|
||||
$category = 'humhub.yii';
|
||||
}
|
||||
|
||||
if (is_callable($this->beforeTranslateCallback)) {
|
||||
list($category, $message, $params, $language) =
|
||||
$this->beforeTranslateCallback->call($this, $category, $message, $params, $language);
|
||||
}
|
||||
|
||||
return parent::translate($category, $message, $params, $language);
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user