Skip to content
This repository has been archived by the owner on Jan 23, 2019. It is now read-only.

Bug: Stringlate adds additional escaping to Strings containing quotes #209

Closed
NotSoImportant opened this issue Apr 27, 2018 · 5 comments
Closed

Comments

@NotSoImportant
Copy link
Contributor

NotSoImportant commented Apr 27, 2018

Example:

-    <string name="showPrevNextButtonsTitle">Zeige Schaltflächen "hoch"/"runter"</string>
+    <string name="showPrevNextButtonsTitle">Zeige Schaltflächen \"hoch\"/\"runter\"</string>
@Lonami
Copy link
Member

Lonami commented Apr 27, 2018

This escaping is necessary. The original string was indeed "wrong".

@Lonami Lonami closed this as completed Apr 27, 2018
@Lonami
Copy link
Member

Lonami commented Apr 27, 2018

Quotes inside a string should be escaped, but they have a different meaning if they wrap a string entirely (from beginning to end, e.g. <string ...>"some string"</string>. Namely, it's made to support leading and trailing spaces. So you can do <string ...>" some \"quoted\" string "</string>.

Also it's a bit more complicated than that. HTML tags are taken into consideration so that attribute values are not escaped, e.g. <a href="..."> will not escape the quotes. Thanks for taking the time to investigate so much into the application :P

@Lonami
Copy link
Member

Lonami commented Apr 27, 2018

FWIW, unescaped quotes may also be used within the string to preserve whitespace:
image

Now this is getting tricky! How would we differentiate when it is a typo by the original developer and when it is intended?

@NotSoImportant
Copy link
Contributor Author

My humble opinion?
Make Stringlate not care for what the developer maybe thought. Don't touch things that are not implicitly changed by the user.
If the original string is wrong that is not a problem of translation, but of the app development.

@Lonami
Copy link
Member

Lonami commented Apr 27, 2018

Is this a problem with the translation or the original strings though? Look. The big deal here is that the translated format is lost. To support what you're suggesting, we would need to somehow merge the original translation style with the translated one, prefer to preserve the already-translated one, and then to keep the same order as the original translation, apply only new strings to the original style… Very complex! "What strings are new" is not even implemented at all. See #205 for that.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants