meteor-universe-i18n icon indicating copy to clipboard operation
meteor-universe-i18n copied to clipboard

Roadmap to v2

Open radekmie opened this issue 3 years ago • 13 comments

This issue will be updated later.


Our main goal is to make the package lighter, more configurable, and easier to debug.

  1. Lighter
  2. More configurable
  3. Easier to debug
  4. Future ideas
    • Create and maintain a proper changelog from v2.0.0 on.
    • Setup CI process.
      • With automated publishing, if possible.
    • TypeScript-safe translations, especially for getTranslation.
      • Maybe with a runtime validation for missing translations?
    • Provide an integration with the Intl API?
    • Consider adding a proper support for pluraziation.

radekmie avatar Nov 30 '21 13:11 radekmie

Why would you want to remove the purify option?

Sometimes you want to translate some HTML texts. Some use cases that come to mind:

  • Email templates
  • Having <b></b> as part of text data to let writers emphasis some keywords.

The default purify function html-encodes data, so it's not usable as HTML: the tags appear as text.

Currently, you can use this trick to bypass it: i18n.setOptions({purify: (s: string) => s}); But that global setting is ugly, while, prior to v1.32, you could conveniently pass _purify=false to specific texts.

What do you intend to do regarding those use cases?

Gwened avatar Jan 05 '22 16:01 Gwened

Hi @Gwened and thanks for taking the time for feedback!

We want to remove this option, as it doesn't make sense to have all translations purified. As you said, sometimes you want to translate email templates or other potentially data-sensitive texts. In our opinion, you should sanitize (purify) the text explicitly, in your code, according to your own rules and requirements. If you need one, I strongly recommend the sanitize-html package - we do use it in several projects and it serves us very well. Just keep in mind that it's relatively large.

Additionally, our current implementation yields unnecessary performance impacts that could be avoided.

radekmie avatar Jan 06 '22 11:01 radekmie

Thanks, makes sense. So from now on, I'll use the options to bypass it globally, and call my own purify fonction whenever dealing with user content or requiring to print HTML code.

Gwened avatar Jan 06 '22 19:01 Gwened

Hi, I can see there's a Readme for v2 somewhere, but I'm unable to access it. Can you possibly make this public?

jasongrishkoff avatar May 06 '22 05:05 jasongrishkoff

Hi, I can see there's a Readme for v2 somewhere, but I'm unable to access it. Can you possibly make this public?

Hi @jasongrishkoff, Readme was changed a little, but it is still available on the main page of the Github repo. Are you looking for something specific?

piotrpospiech avatar May 06 '22 08:05 piotrpospiech

From what I can see, one of the main changes is that you've removed purify, but the docs still reference is. Will it still work with this new version?

jasongrishkoff avatar May 06 '22 08:05 jasongrishkoff

purify was removed. It won't work anymore. I will update Readme.

piotrpospiech avatar May 06 '22 08:05 piotrpospiech

Okay great. And the issue with onChangeLocale on <T> has also been resolved? Was poking through the code for a reference to this but didn't see it.

jasongrishkoff avatar May 06 '22 08:05 jasongrishkoff

What issue are you referring to? Can you send me a link?

piotrpospiech avatar May 06 '22 08:05 piotrpospiech

Sorry for the confusion. It was this comment: https://forums.meteor.com/t/what-are-currently-the-most-optimal-i18n-tools/57865/6

jasongrishkoff avatar May 06 '22 11:05 jasongrishkoff

We described several ways to integrate this package with React. There is an approach with the meteor's ReactiveVar and useTracker. I think this is what you are looking for. You can read about it in the Readme at the very bottom of the "Integration with React" section.

piotrpospiech avatar May 06 '22 11:05 piotrpospiech

2.0 RC1 does not work and the build process crashes with ENOENT: No such file or directory on Windows because of 2 test files (meteor_practicalmeteor:sinon.d.ts and meteor_universe:i18n.d.ts) having a colon in the file name which is not allowed on Windows. Replacing it with _ fixes it but not sure if it affects anything else.

dovydaskukalis avatar Jul 28 '22 09:07 dovydaskukalis

Hi @dovydaskukalis, thanks for your feedback. I fixed that in v2.0.0-rc.2

piotrpospiech avatar Aug 19 '22 08:08 piotrpospiech

v2.0.0 has been released!

piotrpospiech avatar Oct 27 '22 11:10 piotrpospiech