From bbadb0b75c6feac679badf42b65ba73f261bb887 Mon Sep 17 00:00:00 2001 From: Johannes Meyer Date: Wed, 16 Sep 2015 14:16:40 +0200 Subject: [PATCH] Add support for no-op translations refs #5600 --- library/Icinga/Application/functions.php | 17 +++++++++++++++++ .../Util/GettextTranslationHelper.php | 1 + 2 files changed, 18 insertions(+) diff --git a/library/Icinga/Application/functions.php b/library/Icinga/Application/functions.php index 3ae0c7ba9..0ec120a8c 100644 --- a/library/Icinga/Application/functions.php +++ b/library/Icinga/Application/functions.php @@ -3,6 +3,23 @@ use Icinga\Util\Translator; + +/** + * No-op translate + * + * Supposed to be used for marking a string as available for translation without actually translating it immediately. + * The returned string is the one given in the input. This does only work with the standard gettext macros t() and mt(). + * + * @param string $messageId + * + * @return string + */ +function N_($messageId) +{ + return $messageId; +} + + if (extension_loaded('gettext')) { /** diff --git a/modules/translation/library/Translation/Util/GettextTranslationHelper.php b/modules/translation/library/Translation/Util/GettextTranslationHelper.php index c3a6d206e..142de8db2 100644 --- a/modules/translation/library/Translation/Util/GettextTranslationHelper.php +++ b/modules/translation/library/Translation/Util/GettextTranslationHelper.php @@ -290,6 +290,7 @@ class GettextTranslationHelper '--keyword=t:1,2c', '--keyword=tp:1,2', '--keyword=tp:1,2,4c', + '--keyword=N_', '--sort-output', '--force-po', '--omit-header',