Do no escape strings with double quotes in android strings.xml#1637
Do no escape strings with double quotes in android strings.xml#1637Tug merged 9 commits intorelease/1.20.0from
Conversation
… it is not supported by GlotPress
…droid-strings-xml
…droid-strings-xml
👋 @Tug , where is that file? |
|
@hypest It's at the root of the project, you should have it after running |
|
Tried out manually adding |
|
Actually the POT format supports character escaping using backslash so So the POT parser will have removed those when the string is given to So basically: (POT => XML) |
|
I see. The PR looks good to me @Tug , let's bring it up to date with develop to fix the conflicts and I'll do last review pass afterwards. |
…droid-strings-xml
|
@hypest updated! |
…droid-strings-xml
…droid-strings-xml
|
I merged in |
…lify-android-strings-xml
hypest
left a comment
There was a problem hiding this comment.
LGTM! Feel free to merge when CI turns green!
Wrapping strings in double quotes such as
Will import the string in glotpress as
"\n This is my string.\nHello"instead of\n This is my string.\nHello.In order not to update glotpress and translate.wordpress.org which would be costly, let's revert to using simple escaping of xml entities and not use
"". In theory we should only lose the ability to have leading and trailing whitespace characters in a string, which is not something that happens frequently. So the resulting sting in glotpress will beThis is my string.\nHello.To make sure the created xml is valid we run
xmllintautomatically once the npm script is complete.To test:
bundle/android/strings.xmlbundle/android/strings.xmlintoWordPress/src/main/res/values/strings.xmlin WPAndroid and build and run the app with those strings. You can boot the block editor in debug mode to seetranslationsbeing printed in the consolegutenberg-android.pot, adding special characters to it such as<,>,",\n..., then run./bin/po2android.js gutenberg-android.pot bundle/android/strings.xml, it should create a valid xml file. Validate file withyarn genstrings:android:checkUpdate release notes:
RELEASE-NOTES.txt.