lingui / js-lingui

🌍 📖 A readable, automated, and optimized (3 kb) internationalization for JavaScript
https://lingui.dev
MIT License
4.6k stars 382 forks source link

Vanilla JavaScript/TypeScript improvements #951

Closed ljani closed 3 years ago

ljani commented 3 years ago

Is your feature request related to a problem? Please describe. Snowpack is an emerging [1,2] build tool for web frontends. It focuses on build performance by using esbuild and additionally by avoiding transpilation with babel. Thus, many Snowpack users try to avoid usage of babel in their development pipeline.

As lingui relies heavily on babel-plugin-macros, it would be nice to see an alternative, type-safe API without babel-plugin-macros to be used with for example Snowpack.

Describe proposed solution

Describe alternatives you've considered

Additional context See also: https://github.com/lingui/js-lingui/discussions/924, https://github.com/lingui/js-lingui/issues/944, https://github.com/lingui/js-lingui/pull/947

amankkg commented 3 years ago

I like the ... write an esbuild plugin option but it will add yet another snowpack related package, given #947

Anyway, good to have alternative solutions since there are many other use cases people work with, e.g. one can just use typescript plugin without esbuild or babel at all.

stale[bot] commented 3 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

villasv commented 3 years ago

Came here from #989 and just wanted to voice my support for this part of the proposal:

The first thing that came to my mind is using tagged templates. lingui used to support them (with i18n.t), but the support was removed in v3.

Having to adopt babel just for the sake of macros was really painful.

There's the low-level i18n._, but it's not very type-safe. It's easy to forget the parameters.

What I understood from #989 is that i18n._ won't produce a catalog when running lingui extract. Is that right?

BTW, any chance to ask stale-bot to ignore this issue?