Page MenuHomePhabricator

\ does not roundtrip in AndroidXmlFFS
Closed, ResolvedPublic


\ is either not escaped properly in export or gone in import.

QA plan

Affected projects:
Pre-deployment testing: devs in development environment
Post-deployment testing: translation admin


Fixed broken handling of backslash character in translations exported from

Event Timeline

Restricted Application added a subscriber: Aklapper. · View Herald TranscriptApr 12 2018, 9:02 AM
Nikerabbit triaged this task as High priority.Apr 12 2018, 9:02 AM

Change 594940 had a related patch set uploaded (by Abijeet Patro; owner: Abijeet Patro):
[mediawiki/extensions/Translate@master] Fix roundtrip issue for backslash

Change 594940 merged by jenkins-bot:
[mediawiki/extensions/Translate@master] AndroidXmlFFS: Fix roundtrip issue for backslash

abi_ added a comment.May 14 2020, 9:05 AM

We've done a couple of things to properly handle this,

  1. When exporting translations, if the translations contain a \, escape it, so \\ gets exported out. To add backslash to source strings projects must use \\.
  2. Replace occurrences of \u1234 with the respective symbols. For example \u2022 would be converted to and then exported out to projects.

For the second change, we reviewed the existing Android string files to identify where backslashes are being used \ and found the following,

/resources/abi/ajapaik/app/src/main/res/values-ru/strings.xml:  <string name="tutorial_opacity_zoom">Прозрачность меняется движением влево\вправо.\nМасштаб меняется при одновременном сведении\разведении двух пальцев.</string>
/resources/abi/commons-android/app/src/main/res/values-is/strings.xml:  <string name="bullet">•  \</string>
/resources/abi/commons-android/app/src/main/res/values-is/strings.xml:  <string name="about_license">Wikimedia Commons forritið er opinn og frjáls hugbúnaður sem gerður er og viðhaldið af stuðningsaðilum og sjálfboðaliðum Wikimedia samfélagsins. Wikimedia Foundation sjálfseignarstofnunin kemur ekki að gerð, forritun eða viðhaldi forritsins. \</string>
/resources/abi/commons-android/app/src/main/res/values-is/strings.xml:  <string name="question">Spurning \</string>
/resources/abi/commons-android/app/src/main/res/values-is/strings.xml:  <string name="achievements_revert_limit_message">lágmarksfjöldi sem er krafist: \</string>
/resources/abi/kiwix-android/core/src/main/res/values-eu/strings.xml:  <string name="pref_hide_toolbar_summary">\u2022 On GNU/Linux and with the console: split —bytes=4000M my_big_file.zim</string>
/resources/abi/wikipedia-android/app/src/main/res/values-is/strings.xml:  <string name="onboarding_reading_list_sync_text_v2">Þú getur búið til leslista úr greinum til að lesa þær síðar, jafnvel án nettengingar. &lt;br/&gt;Skráðu þig inn á Wikipedia-notandaaðganginn þinn til að samstilla leslistana þína. &lt;a href=\"#login\"&gt;Skráðu þig á Wikipedia&lt;/a&gt; \</string>
/resources/abi/wikipedia-android/app/src/main/res/values-ne/strings.xml:  <string name="preference_summary_sync_reading_lists_from_account">अध्ययन सूची विकिपिडिया खाता \"%s\" मा सङ्ग्रह गरेर विभिन्न उपकरणहरूमा समक्रमण गर्नुहोस्         /string>
/resources/abi/wikipedia-android/app/src/main/res/values/strings.xml:  <string name="suggested_edits_encouragement_message">%s\, thanks for your edits. Below you can find more ways to contribute to Wikipedia.</string>
/resources/abi/wikipedia-android/app/src/main/res/values/strings.xml:  <string name="suggested_edits_onboarding_message"><![CDATA[<b>Hi %s\</b>, did you know that everyone can edit Wikipedia? Below you can find fun ways to help improve Wikipedia. Happy editing!]]></string>

This has been deployed to

Nikerabbit closed this task as Resolved.Tue, Jun 16, 8:22 AM

I did:

twn:/resources/caches/$ rm ru.cdb 
twn:/resources/caches/$ php /srv/mediawiki/workdir/extensions/Translate/scripts/processMessageChanges.php --group=ajapaik-app --name=niklas
Processing ajapaik-app
No changes found
twn:/resources/caches/$ ls -lah ru.cdb 
-rw-rw-r--+ 1 nike users 13K Jun 16 10:20 ru.cdb

This confirms that repository and wiki is fully in sync.