lingui / js-lingui

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

RFC: Renovate the `remote-loader` #1551

Open andrii-bodnar opened 1 year ago

andrii-bodnar commented 1 year ago

@lingui/remote-loader is a package that allows loading and compiling message catalogs located somewhere remotely (for example, an external CDN endpoint).

For some reason, it was marked as private and the latest published version is 3.11.0.

Today, almost every Localization Management System has an Over-The-Air Content Delivery feature that allows translations to be distributed to a CDN (or other resources located on the web) and then applications can consume these translations directly from the remote endpoint. For example, this is how it works in Crowdin - Content Delivery.

In short, OTA Content Delivery allows new translations to be delivered without necessarily rebuilding or redeploying the application. So the Remote Loader would be a good complement to OTA technologies.

Possible steps to do:

timofei-iatsenko commented 1 year ago

Currently, the only one problem here, it doesn't support any other formats except of minimal. To make it work with all formats, custom formatters should be integrated in this loader.

By the way, Pofile would be tricky to bundle for for the browser because it has require('fs'), one more point for adopting and maintaining https://github.com/thekip/pofile under lingui org

andrii-bodnar commented 1 year ago

I wonder if this should be considered every time someone creates a custom formatter. What about other formatters? Are they compatible with this?

timofei-iatsenko commented 1 year ago

Yes, it should be considered when someone creates a custom formatter. Formatters shouldn't have any browser-incompatibile dependencies. Other official lingui formatters are compatible with browser.

andrii-bodnar commented 1 year ago

Are there any other currently supported pofile alternatives? Maybe it would be better to switch library

I've found https://www.npmjs.com/package/gettext-parser, but I'm not sure if it works in browsers

andrii-bodnar commented 1 year ago

@thekip I just thought if Pofile is a blocker in the current case, we probably can adopt its fork under the Lingui organization

andrii-bodnar commented 1 year ago

Now Crowdin can provide already compiled translations via OTA CDN - Lingui String Exporter