Unicodesnowman has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/185672

Change subject: Allow underscores in insertable tvars
......................................................................

Allow underscores in insertable tvars

Bug: T71746
Change-Id: Ifa89870a2b360cda7e762c979bdb69452a6e0ed3
---
M insertables/TranslatablePageInsertablesSuggester.php
M tests/phpunit/insertables/TranslatablePageInsertablesSuggesterTest.php
2 files changed, 3 insertions(+), 2 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Translate 
refs/changes/72/185672/1

diff --git a/insertables/TranslatablePageInsertablesSuggester.php 
b/insertables/TranslatablePageInsertablesSuggester.php
index 25d9644..0af0851 100644
--- a/insertables/TranslatablePageInsertablesSuggester.php
+++ b/insertables/TranslatablePageInsertablesSuggester.php
@@ -17,7 +17,7 @@
                // allowed in a variable name, but here we are stricter to 
avoid too many
                // false positives.
                $matches = array();
-               preg_match_all( '/\$([a-zA-Z0-9-]+)/', $text, $matches, 
PREG_SET_ORDER );
+               preg_match_all( '/\$([a-zA-Z0-9-]+_)/', $text, $matches, 
PREG_SET_ORDER );
 
                $new = array_map( function ( $match ) {
                        // Numerical ones are already handled by parent
diff --git 
a/tests/phpunit/insertables/TranslatablePageInsertablesSuggesterTest.php 
b/tests/phpunit/insertables/TranslatablePageInsertablesSuggesterTest.php
index c508987..d0fb3f2 100644
--- a/tests/phpunit/insertables/TranslatablePageInsertablesSuggesterTest.php
+++ b/tests/phpunit/insertables/TranslatablePageInsertablesSuggesterTest.php
@@ -27,10 +27,11 @@
                                )
                        ),
                        array(
-                               'Insertables can $have-hyphens and $number9',
+                               'Insertables can $have-hyphens, $number9 and 
$under_scores',
                                array(
                                        new Insertable( '$have-hyphens', 
'$have-hyphens', '' ),
                                        new Insertable( '$number9', '$number9', 
'' ),
+                                       new Insertable( '$under_scores', 
'$under_scores', '' ),
                                )
                        ),
                );

-- 
To view, visit https://gerrit.wikimedia.org/r/185672
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ifa89870a2b360cda7e762c979bdb69452a6e0ed3
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Translate
Gerrit-Branch: master
Gerrit-Owner: Unicodesnowman <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to