From 65fc51d08f6d415a42c8bb34ce11220617d3ce0f Mon Sep 17 00:00:00 2001 From: Simone Alers Date: Wed, 9 Aug 2017 16:39:43 +0200 Subject: [PATCH] Add dn__ function to both extractors and functions scanner --- src/Extractors/JsCode.php | 2 ++ src/Extractors/PhpCode.php | 2 ++ src/Utils/FunctionsScanner.php | 8 ++++++++ 3 files changed, 12 insertions(+) diff --git a/src/Extractors/JsCode.php b/src/Extractors/JsCode.php index 2b3f9e14..18b56899 100644 --- a/src/Extractors/JsCode.php +++ b/src/Extractors/JsCode.php @@ -22,6 +22,8 @@ class JsCode extends Extractor implements ExtractorInterface 'p__' => 'pgettext', 'dgettext' => 'dgettext', 'd__' => 'dgettext', + 'dngettext' => 'dngettext', + 'dn__' => 'dngettext', 'dpgettext' => 'dpgettext', 'dp__' => 'dpgettext', 'npgettext' => 'npgettext', diff --git a/src/Extractors/PhpCode.php b/src/Extractors/PhpCode.php index 47fe13fe..3d2ca627 100644 --- a/src/Extractors/PhpCode.php +++ b/src/Extractors/PhpCode.php @@ -28,6 +28,8 @@ class PhpCode extends Extractor implements ExtractorInterface 'p__' => 'pgettext', 'dgettext' => 'dgettext', 'd__' => 'dgettext', + 'dngettext' => 'dngettext', + 'dn__' => 'dngettext', 'dpgettext' => 'dpgettext', 'dp__' => 'dpgettext', 'npgettext' => 'npgettext', diff --git a/src/Utils/FunctionsScanner.php b/src/Utils/FunctionsScanner.php index 506f76ac..9eb24e7e 100644 --- a/src/Utils/FunctionsScanner.php +++ b/src/Utils/FunctionsScanner.php @@ -94,6 +94,14 @@ public function saveGettextFunctions(Translations $translations, array $options) list($domain, $context, $original, $plural) = $args; break; + case 'dngettext': + if (!isset($args[3])) { + continue 2; + } + + list($domain, $original, $plural) = $args; + break; + default: throw new Exception(sprintf('Not valid function %s', $functions[$name])); }