Skip to content
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

Fix escaped characters in translations #569

Merged
merged 13 commits into from
Jan 9, 2019
Merged

Fix escaped characters in translations #569

merged 13 commits into from
Jan 9, 2019

Conversation

ralphtheninja
Copy link
Member

@ralphtheninja ralphtheninja commented Jan 9, 2019

Closes #544, closes #515

screenshot from 2019-01-09 15-28-28
screenshot from 2019-01-09 15-28-53

@ralphtheninja
Copy link
Member Author

A tonne of erroneous translations. For now I have adjusted the xml resources as well, but we should probably tweak the conversion script later to handle all the edge cases (some translators add xml tags inside the resources, such as <br/> and <em>foobar</em>).

<string name="welcome_intro4_headline">Güçlü</string>
<string name="welcome_intro4_message">Sınırsız sohbetler, görüntüler, videolar, sesli iletiler ve daha fazlası. Çoklu istemci yetenekli.</string>
<!-- Translators: "free" as in freedom here, not "free" as in "free beer" -->
<string name="welcome_intro5_headline">Özgür</string>
<!-- Translators: "free" as in freedom here, not "free" as in "free beer" -->
<string name="welcome_intro5_message">Delta Chat sonsuza dek özgürdür.<br/>Açık kaynaklı. Reklâm yok. Abonelik yok. Satıcı kilidi yok.</string>
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This doesn't have a new line in the original

json = require(file)
} catch (e) {
console.error(e.message)
return false
Copy link
Member Author

@ralphtheninja ralphtheninja Jan 9, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

First test makes sure the file is valid json.

console.error(e.message)
return false
}
return Object.keys(json).every(k1 => {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For every resource ..

}
return Object.keys(json).every(k1 => {
const v1 = json[k1]
return Object.keys(v1).every(k2 => {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

.. every key of that resource (e.g. "message" etc) ..

)
return false
}

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It should be a string ..

if (!testString('\\\\n')) return false
if (!testString("\\\\'")) return false
if (!testString('\\\\\\"')) return false
if (!testString('\\\\')) return false
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And it shouldn't contain these.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could probably refactor this into one return statement. Up to you guys.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's fine with multiple returns to me

@ralphtheninja ralphtheninja changed the title Escaped characters Fix escaped characters in translations Jan 9, 2019
@ralphtheninja
Copy link
Member Author

It would be nice to merge this today. It kills two bugs.

@r10s
Copy link
Member

r10s commented Jan 9, 2019

It would be nice to merge this today. It kills two bugs.

i just pulled new translations from transifex - are these already the changes from this pr?

just asking because it is a bit dangerous to push sources to transifex as this will always overwrite all work of the translators (transifex is not line bases afaik) since the last pull (16 hours ago in this case).
but probably you know this best :)

for android, therefore, i never edit the strings-LANG.xml files locally but do this always in the web-frontend.

@ralphtheninja
Copy link
Member Author

ralphtheninja commented Jan 9, 2019

@r10s I didn't push these to Transifex. I edited them on Transifex and pulled them.

@Jikstra Jikstra merged commit 2732585 into master Jan 9, 2019
@Jikstra Jikstra deleted the escaped-characters branch January 9, 2019 17:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Some characters are escaped (chat list) xml to json convert script bugs when _text node is an array
3 participants