From 64bb5b09ce3fc00a14be86c09229a1e579bfc710 Mon Sep 17 00:00:00 2001 From: Ryan Cramer Date: Wed, 15 Apr 2020 15:37:37 -0400 Subject: [PATCH] Fix issue processwire/processwire-issues#1139 --- .../LanguageSupport/LanguageParser.php | 46 +++++++++++-------- 1 file changed, 27 insertions(+), 19 deletions(-) diff --git a/wire/modules/LanguageSupport/LanguageParser.php b/wire/modules/LanguageSupport/LanguageParser.php index 3324ab56..59043290 100644 --- a/wire/modules/LanguageSupport/LanguageParser.php +++ b/wire/modules/LanguageSupport/LanguageParser.php @@ -211,7 +211,7 @@ class LanguageParser extends Wire { 2 => array(), // __('text', [textdomain]); 3 => array(), // _x('text', 'context', [textdomain]) or $this->_x('text', 'context'); 4 => array(), // _n('singular', 'plural', $cnt, [textdomain]) or $this->_n(...); - ); + ); if(!is_file($file)) return $matches; @@ -219,30 +219,38 @@ class LanguageParser extends Wire { $this->findArrayTranslations($data); // Find $this->_('text') style matches - preg_match_all( '/(>_)\(\s*' . // $this->_( - '([\'"])(.+?)(?_)\(\s*' . // $this->_( + '([\'"])(.+?)(?_x('text', 'context') style matches - preg_match_all( '/([\s.=>(]_x|^_x)\(\s*' . // _x( or $this->_x( - '([\'"])(.+?)(?(\\\\]_x|^_x)\(\s*' . // _x( or $this->_x( + '([\'"])(.+?)(?_n(...) style matches - preg_match_all( '/([\s.=>(]_n|^_n)\(\s*' . // _n( or $this->_n( - '([\'"])(.+?)(?(\\\\]_n|^_n)\(\s*' . // _n( or $this->_n( + '([\'"])(.+?)(?