Amire80 has uploaded a new change for review. https://gerrit.wikimedia.org/r/112668
Change subject: Allow capital letters in insertable tvars ...................................................................... Allow capital letters in insertable tvars Change-Id: I4d84161ef80b62ed7e23678db4e3bca3fe7f5829 --- M insertables/TranslatablePageInsertablesSuggester.php M tests/phpunit/insertables/TranslatablePageInsertablesSuggesterTest.php 2 files changed, 4 insertions(+), 2 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Translate refs/changes/68/112668/1 diff --git a/insertables/TranslatablePageInsertablesSuggester.php b/insertables/TranslatablePageInsertablesSuggester.php index 7acc35c..02a3ea7 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-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 if ( ctype_digit( $match[1] ) ) { diff --git a/tests/phpunit/insertables/TranslatablePageInsertablesSuggesterTest.php b/tests/phpunit/insertables/TranslatablePageInsertablesSuggesterTest.php index 64d4713..81a5326 100644 --- a/tests/phpunit/insertables/TranslatablePageInsertablesSuggesterTest.php +++ b/tests/phpunit/insertables/TranslatablePageInsertablesSuggesterTest.php @@ -18,9 +18,11 @@ public function getInsertablesProvider() { return array( - array( 'Hi $1, I am $myname.', array( + array( 'Hi $1, I am $myname $my-middle-name $myLastName.', array( new Insertable( '$1', '$1', '' ), new Insertable( '$myname', '$myname', '' ), + new Insertable( '$my-middle-name', '$my-middle-name', '' ), + new Insertable( '$myLastName', '$myLastName', '' ), ) ), ); } -- To view, visit https://gerrit.wikimedia.org/r/112668 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I4d84161ef80b62ed7e23678db4e3bca3fe7f5829 Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/Translate Gerrit-Branch: master Gerrit-Owner: Amire80 <amir.ahar...@mail.huji.ac.il> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits