jenkins-bot has submitted this change and it was merged. (
https://gerrit.wikimedia.org/r/331681 )
Change subject: AndroidXmlFFS: Handle ampersands in translations
......................................................................
AndroidXmlFFS: Handle ampersands in translations
Bug: T148549
Change-Id: Iabe816fad2d8fdc760051bd9d478bd02771d9612
---
M ffs/AndroidXmlFFS.php
M tests/phpunit/ffs/AndroidXmlFFSTest.php
2 files changed, 6 insertions(+), 0 deletions(-)
Approvals:
Nemo bis: Looks good to me, but someone else must approve
Niedzielski: Looks good to me, but someone else must approve
jenkins-bot: Verified
Siebrand: Looks good to me, approved
diff --git a/ffs/AndroidXmlFFS.php b/ffs/AndroidXmlFFS.php
index e96a95b..9c2c640 100644
--- a/ffs/AndroidXmlFFS.php
+++ b/ffs/AndroidXmlFFS.php
@@ -78,6 +78,9 @@
// Add backslash to escape it too.
$escaped = '\\' . $escaped;
}
+ // All html entities seen would be inserted by translators
themselves.
+ // Treat them as plain text.
+ $escaped = str_replace( '&', '&', $escaped );
return $escaped;
}
diff --git a/tests/phpunit/ffs/AndroidXmlFFSTest.php
b/tests/phpunit/ffs/AndroidXmlFFSTest.php
index 84792b7..c9fc378 100644
--- a/tests/phpunit/ffs/AndroidXmlFFSTest.php
+++ b/tests/phpunit/ffs/AndroidXmlFFSTest.php
@@ -36,6 +36,7 @@
</plurals>
<string name="has_quotes">Go to \"Wikipedia\"</string>
<string name="starts_with_at">\@Wikipedia</string>
+ <string name="has_ampersand">1&nbsp;000</string>
</resources>
XML;
@@ -51,6 +52,7 @@
'alot' => '{{PLURAL|one=bunny|bunnies}}',
'has_quotes' => 'Go to "Wikipedia"',
'starts_with_at' => '@Wikipedia',
+ 'has_ampersand' => '1 000',
);
$expected = array( 'MESSAGES' => $expected, 'AUTHORS' =>
array() );
$this->assertEquals( $expected, $parsed );
@@ -67,6 +69,7 @@
'ko=26ra' => 'wawe',
'foobar' => '!!FUZZY!!Kissa kala <koira> "a\'b',
'amuch' => '{{PLURAL|one=bunny|bunnies}}',
+ 'ampersand' => ' &foo',
);
$collection = new MockMessageCollection( $messages );
--
To view, visit https://gerrit.wikimedia.org/r/331681
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: Iabe816fad2d8fdc760051bd9d478bd02771d9612
Gerrit-PatchSet: 3
Gerrit-Project: mediawiki/extensions/Translate
Gerrit-Branch: master
Gerrit-Owner: Nikerabbit <[email protected]>
Gerrit-Reviewer: Nemo bis <[email protected]>
Gerrit-Reviewer: Niedzielski <[email protected]>
Gerrit-Reviewer: Siebrand <[email protected]>
Gerrit-Reviewer: jenkins-bot <>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits