Add context to 'Select' translation strings

This commit is contained in:
Tautvidas Sipavičius
2017-01-30 20:44:40 +02:00
parent af2a6b2559
commit bedfc4f80c
8 changed files with 24 additions and 16 deletions

View File

@@ -24,6 +24,7 @@ class I18n extends \Twig_Extension {
'localize' => 'localize',
'__' => 'translate',
'_n' => 'pluralize',
'_x' => 'translateWithContext',
'date' => 'date'
);
@@ -63,6 +64,12 @@ class I18n extends \Twig_Extension {
return call_user_func_array('_n', $this->setTextDomain($args));
}
function translateWithContext() {
$args = func_get_args();
return call_user_func_array('_x', $this->setTextDomain($args));
}
function date() {
$args = func_get_args();
$date = (isset($args[0])) ? $args[0] : null;
@@ -88,4 +95,4 @@ class I18n extends \Twig_Extension {
}
return $args;
}
}
}