openscd / open-scd-core

Apache License 2.0
5 stars 8 forks source link

lit-localize cannot be used within plugins #121

Closed ca-d closed 9 months ago

ca-d commented 1 year ago

Lit-localize cannot be used by more than a single script on a website, meaning we can't use it in plugins and can't use it to translate text within components.

According to a helpful comment in the as yet unsolved issue #1661 on lit/lit a workaround that has been used in production for a while is https://github.com/weavedev/lit-i18next. The package consists in a trivially thin wrapper around the stable industrial strength i18next library, which comes with our much sought-after XLIFF support as a matter of course. Maybe we could investigate switching to that as a translation mechanism.

ca-d commented 9 months ago

After dabbling a bit it looks like i18next does not indeed come with XLIFF support built in. I therefore suggest - for the time being - to stick with lit-translate for translating individual plugins.