From eae50e0d50bbb774e98ceca5a91deb38065d9779 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jaime=20Pe=CC=81rez?= <jaime.perez@uninett.no> Date: Fri, 7 Oct 2016 13:12:18 +0200 Subject: [PATCH] Refactor translation methods for PHP's implementation of Gettext. --- lib/SimpleSAML/Locale/Translate.php | 4 ++-- lib/SimpleSAML/XHTML/Template.php | 7 +++++-- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/lib/SimpleSAML/Locale/Translate.php b/lib/SimpleSAML/Locale/Translate.php index 4f3abf901..a01ee48ff 100644 --- a/lib/SimpleSAML/Locale/Translate.php +++ b/lib/SimpleSAML/Locale/Translate.php @@ -469,7 +469,7 @@ class Translate } - public static function translateSingular($original) + public static function translateSingularPHPGettext($original) { $text = \Gettext\BaseTranslator::$current->gettext($original); @@ -483,7 +483,7 @@ class Translate } - public static function translatePlural($original, $plural, $value) + public static function translatePluralPHPGettext($original, $plural, $value) { $text = \Gettext\BaseTranslator::$current->ngettext($original, $plural, $value); diff --git a/lib/SimpleSAML/XHTML/Template.php b/lib/SimpleSAML/XHTML/Template.php index ee84beff0..268e6dc27 100644 --- a/lib/SimpleSAML/XHTML/Template.php +++ b/lib/SimpleSAML/XHTML/Template.php @@ -174,8 +174,11 @@ class SimpleSAML_XHTML_Template // set up translation if ($this->localization->i18nBackend === 'gettext/gettext') { - $options['translation_function'] = array('\SimpleSAML\Locale\Translate', 'translateSingular'); - $options['translation_function_plural'] = array('\SimpleSAML\Locale\Translate', 'translatePlural'); + $options['translation_function'] = array('\SimpleSAML\Locale\Translate', 'translateSingularPHPGettext'); + $options['translation_function_plural'] = array( + '\SimpleSAML\Locale\Translate', + 'translatePluralPHPGettext' + ); } // TODO: add a branch for the old SimpleSAMLphp backend $twig = new Twig_Environment($loader, $options); -- GitLab