Catalog namespaces
See original GitHub issueI’ve been thinking about namespaces for a while and https://github.com/i18next/react-i18next/issues/199#issuecomment-281654374 made me to write it down.
Multiple namespaces
Sometimes are messages split in several message catalogs. Both catalogs might contain message with the same ID and it that case it would be overwritten without namespacing messages from different catalogs.
This feature already exists in most i18n libs.
Local namespaces
What’s more interesting and what I actually would like to do are local namespaces. There’re two possible use cases:
- Reusable components
- Code splitting
Reusable components
Imagine you have a React component and you want to ship translations with it. Ideally, developer using this component should just spin up it’s own i18n provider to activate language, but the messages should be loaded directly from component. All translations inside this components should be tied to the component only.
lingui-cli
should only extract messages from 3rd party components if it isn’t translated in some language, otherwise it should ignore it
Code spliting
As we split the code, we should be able to split the message catalog. This should be fully automated: only messages in bundled code are added to the bundle.
Issue Analytics
- State:
- Created 7 years ago
- Reactions:11
- Comments:8 (3 by maintainers)
Top GitHub Comments
Catalog splitting is an absolutely necessary feature for any real world website or SPA. Is it planned to implement anytime soon?
@saravanan10393 end of August sounds reasonable, definitely mid September.