yola / gulp-static-i18n

Gulp plugin for internationalization of static assets.
MIT License
5 stars 8 forks source link

Add escaping for translate strings #29

Closed burnjohn closed 6 years ago

stefanor commented 6 years ago

Why was this necessary in templategallery, and not elsewhere?

Will it not cause issues for other applications that we're using this for?

burnjohn commented 6 years ago

We have the issue with unescaped strings after babel code transpilling of react. The only change that is there is escaping. The only case when it can influence other apps is handlebars href tag.

Now we're checking it.

Maybe it's better to bumb major version?

Here is what that function does Converts the characters "&", "<", ">", '"', and "'" in string to their corresponding HTML entities.

Link to the docs: https://lodash.com/docs/4.17.10#escape

burnjohn commented 6 years ago

So we tried to test these changes but it is quite hard for us to check every translation. 


As I see escaping can break inserting tags to html. And it is better to avoid using this fix with old repositories.


So taking this risk into account I can propose several options:



  1. Create a major version with escaping translations text
  2. Use a dev version of this library for template gallery a/b testing and delete it after new react translation flow will be set up
  3. Escape 2 translation files in template gallery by hands and fix it later with new react translation flow

@stefanor What is the best option for you?

burnjohn commented 6 years ago

Close this due to quotes fix in https://github.com/yola/templategallery/pull/437