Add support for variables in translation (#250)

This commit is contained in:
Pierre Rudloff 2019-11-29 21:33:49 +01:00
parent 6fb1cbaa6c
commit 850fc80622
8 changed files with 145 additions and 101 deletions

View file

@ -140,7 +140,11 @@ class LocaleManager
*/
public function smartyTranslate(array $params, $text)
{
return $this->t($text);
if (isset($params['params'])) {
return $this->t($text, $params['params']);
} else {
return $this->t($text);
}
}
/**
@ -150,9 +154,9 @@ class LocaleManager
*
* @return string Translated string
*/
public function t($string)
public function t($string, array $params = [])
{
return $this->translator->trans($string);
return $this->translator->trans($string, $params);
}
/**