FallenMax / a18n

Automated I18n solution for JavaScript/TypeScript/React

Home Page:https://www.npmjs.com/package/a18n

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Share locale resource between a18n instances via specifying the same namespace

FallenMax opened this issue · comments

Proposal

From different a18n code/instances in same page, a18n.getA18n(sameNamespace) always yield same a18n instance (i.e. sharing locale/resource/cache)

a18n might store locale resources in global (window) underlying.

Background

In micro-frontend or application/components architecture, we might have multiple parts of system, each of which independently depends on a18n (probably with different versions) , but would like to share same locale resources for consistency.

To simplify the process of passing locale resources to each part, a18n could provide a mechanism to explicitly share global locale resources.

Limitation

Instances will not be shared across tab/worker/iframe, some user-land sharing solutions are still required in these scenarios.