meteor-universe-i18n
meteor-universe-i18n copied to clipboard
Roadmap to v2
This issue will be updated later.
Our main goal is to make the package lighter, more configurable, and easier to debug.
-
Lighter
- Remove locale and currency data. If needed, one can copy it from there.
- We did not update this list for a long time and don't intend to.
- This may require adjustments in the locale normalization as well as translation file names resolution.
- Remove React integration (including the old
getRefreshMixin
). The important part here is to create a guide on using the package with React. - Remove
createTranslator
andcreateReactiveTranslator
and create a short note on how to replace it. - Remove
purify
option. - Remove
parseNumber
.
- Remove locale and currency data. If needed, one can copy it from there.
-
More configurable
- Extract string interpolation into a separate, replacable function.
-
Easier to debug
- Simplify
getTranslation
fallbacking mechanism.- Consider implementing a callback for missing translations instead of only the
hideMissing
option.
- Consider implementing a callback for missing translations instead of only the
- Simplify
-
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.
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?
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.
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.
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, 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?
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?
purify
was removed. It won't work anymore. I will update Readme.
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.
What issue are you referring to? Can you send me a link?
Sorry for the confusion. It was this comment: https://forums.meteor.com/t/what-are-currently-the-most-optimal-i18n-tools/57865/6
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.
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.
Hi @dovydaskukalis, thanks for your feedback. I fixed that in v2.0.0-rc.2
v2.0.0
has been released!