From cb92e86b9985334c6e816ed33cc99943fd6d89b6 Mon Sep 17 00:00:00 2001 From: Johannes Meyer Date: Thu, 20 May 2021 09:28:12 +0200 Subject: [PATCH] functions: Use ipl-i18n in functions `t`, `tp`, `mt` and `mtp` --- library/Icinga/Application/functions.php | 31 ++++++++++++------------ 1 file changed, 16 insertions(+), 15 deletions(-) diff --git a/library/Icinga/Application/functions.php b/library/Icinga/Application/functions.php index 6144c729b..0fc99f836 100644 --- a/library/Icinga/Application/functions.php +++ b/library/Icinga/Application/functions.php @@ -1,7 +1,8 @@ translate($messageId, $context); } /** - * (non-PHPDoc) - * @see Translator::translate() For the function documentation. + * @see Translator::translateInDomain() For the function documentation. */ function mt($domain, $messageId, $context = null) { - return Translator::translate($messageId, $domain, $context); + return StaticTranslator::$instance->translateInDomain($domain, $messageId, $context); } /** - * (non-PHPDoc) * @see Translator::translatePlural() For the function documentation. */ function tp($messageId, $messageId2, $number, $context = null) { - return Translator::translatePlural($messageId, $messageId2, $number, Translator::DEFAULT_DOMAIN, $context); + return StaticTranslator::$instance->translatePlural($messageId, $messageId2, $number, $context); } /** - * (non-PHPDoc) - * @see Translator::translatePlural() For the function documentation. + * @see Translator::translatePluralInDomain() For the function documentation. */ function mtp($domain, $messageId, $messageId2, $number, $context = null) { - return Translator::translatePlural($messageId, $messageId2, $number, $domain, $context); + return StaticTranslator::$instance->translatePluralInDomain( + $domain, + $messageId, + $messageId2, + $number, + $context + ); } } else { /** - * (non-PHPDoc) * @see Translator::translate() For the function documentation. */ function t($messageId, $context = null) @@ -74,7 +76,6 @@ if (extension_loaded('gettext')) { } /** - * (non-PHPDoc) * @see Translator::translate() For the function documentation. */ function mt($domain, $messageId, $context = null) @@ -83,7 +84,6 @@ if (extension_loaded('gettext')) { } /** - * (non-PHPDoc) * @see Translator::translatePlural() For the function documentation. */ function tp($messageId, $messageId2, $number, $context = null) @@ -91,11 +91,11 @@ if (extension_loaded('gettext')) { if ((int) $number !== 1) { return $messageId2; } + return $messageId; } /** - * (non-PHPDoc) * @see Translator::translatePlural() For the function documentation. */ function mtp($domain, $messageId, $messageId2, $number, $context = null) @@ -103,6 +103,7 @@ if (extension_loaded('gettext')) { if ((int) $number !== 1) { return $messageId2; } + return $messageId; }