moko-resources icon indicating copy to clipboard operation
moko-resources copied to clipboard

Escaped double quotes

Open asapha opened this issue 2 years ago • 0 comments

Hi, I'm wondering if the library could handle reading xml files which have escaped double quotes.

Currently, adding a string such as <string name="audio_effects_title">\"Audio effects\"</string> will be rendered as \Audio effect\ in an Android app.

I could remove the backslash from the english [...]/base/strings.xml file but, I'm using Crowdin for the translations. Crowdin treats the files as Android string files. And when I ask it to generate/export the translations, it automatically adds backslashes (e.g in a [...]/fr/strings.xml file).

To recap what I'm seeing, when you have

  • [...]/base/strings.xml <string name="audio_effects_title">\"Audio effects\"</string>

moko generates

  • [...]/androidMain/values/strings.xml <string name="audio_effects_title">\\&quot;Audio effects\\&quot;</string>

  • [...]/xxx__mokoBundle.properties audio_effects_title = \\"Audio effects\\"

which is shown as \Audio effect\ in Android.

What do you think?

PS: As the translated files are auto-generated, I can use a command such as find $RESOURCES_FOLDER -type f -name "*.xml" -exec sed -i '' 's/\\"/"/g' {} \; as a workaround.

asapha avatar Apr 29 '22 18:04 asapha