-
Notifications
You must be signed in to change notification settings - Fork 58
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Do no escape strings with double quotes in android strings.xml #1637
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
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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
xmllint
automatically once the npm script is complete.To test:
bundle/android/strings.xml
bundle/android/strings.xml
intoWordPress/src/main/res/values/strings.xml
in WPAndroid and build and run the app with those strings. You can boot the block editor in debug mode to seetranslations
being 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:check
Update release notes:
RELEASE-NOTES.txt
.