Comments (8)
Catalog splitting is an absolutely necessary feature for any real world website or SPA. Is it planned to implement anytime soon?
from js-lingui.
@saravanan10393 end of August sounds reasonable, definitely mid September.
from js-lingui.
I have been thinking of a solution to catalog splitting for our rather large SPA. The approach I came up with assumes that you're using webpack.
During the webpack build, you know which message is where. Even better, webpack already understands the concept of code splitting.
One could develop a webpack loader that is chained to your other loaders that extracts all the messages in the file currently passing through the loader. All the messages would collected during this process would be aggregated into a structure that maps webpack chunks to a list of messages. For example:
messages = {
'chunka.js': [
'My test string',
'Another string',
],
'chunkb.js': [
'String in another chunk',
]
};
At the end of the webpack build, a plugin would run that matches the messages extracted during the build against the translations stored in the catalog. Essentially, building a new catalog for each chunk, containing only the messages contained in that chunk.
Pros
No additional configuration would be needed for people already using webpack. They'd have to configure the special loader and plugin. These would extract the messages per chunk, or entry point (both are possible).
Cons
Does not work for people not using Webpack. This is solve-able. Lingui could ship with a tool that takes some special configuration, generates a webpack config, runs webpack with the loader and plugin and spits out splitted translations.
from js-lingui.
@Photonios Is there plugin or loader your have mentioned available. I am in need of this feature. without this, i can not go further and use this project. Any help.
from js-lingui.
@snegostup I'm planning to work on it after I release jsLingui 3.0 next week. ETA late August
@Photonios That's exactly what I'm working on at the moment!
@saravanan10393 Sorry, it's not available right now. I'm working on it though and it should be available by the end of the month. Could you please share what's your use case? How do you use namespaces in your project?
TL;DR: I don't want to add namespaces to this project just for the sake of having it. Instead, I want to focus on solving problems which aren't solved in any i18n lib yet. Namespaces are just a byproduct of such effort.
I'm rushing to release 2.4, then cleanup the lib and add integration tests for CRA before releasing 3.0 (which is mostly ready, but there're few minor problems I need to solve). After that, I'll start coding working on this one. Stay tuned!
from js-lingui.
@tricoder42 , My first concern for having namespaces is to having separate separate resource files per module ( to extend per bundle where one module can have multiple bundles since my app is growing large ) to make the translation process to different language easier and maintainable. Verifying JSON file with 2000 lines, will be harder than having 200 lines per bundle. Another advantage i am seeing is that faster page loading by reducing initial file size load by loading only translation content.
@tricoder42, So Can i proceed with believe that i will get this feature in the end of August.
from js-lingui.
Is catalog splitting planned for 3.0? Currently my app is setup to dynamically split based on components so bundle size never grows beyond the core libs, except for the js-lingui catalog, which will still grow as the app grows.
from js-lingui.
Closing in favor of #326 and #503. Both will land in v3.
from js-lingui.
Related Issues (20)
- `Nextjs` `swc` plugin example not working HOT 3
- Macro: t inside t causing ReferenceError: t is not defined HOT 3
- why not working plural macro? please help me...
- Improve React syntax with useLingui HOT 13
- [SIMPLE PATCH READY] Simple hack for compatibility with Turbopack (NextJS) HOT 2
- Missing auto-generated `id` for `<Trans>` macro when using Typescript HOT 4
- ERROR in ./node_modules/@lingui/macro/dist/index.mjs 347:24 Module parse failed HOT 7
- a special message cant compile. HOT 1
- `lingui` can be null HOT 2
- Compile messages to JSON HOT 5
- Support Gatsby HOT 2
- Cannot find type definition file for './node_modules/@lingui/macro/global'. HOT 2
- Next.js tutorial HOT 3
- The `catalogsMergePath` option is missing in the documentation
- Support backup messages HOT 3
- Extract removes manual comments from po files HOT 1
- React Fragment (`<>`) inside `<Plural>` is not working HOT 5
- Impossible to use with Vite? HOT 1
- definePlural macro HOT 4
- rspack now supports wasm plugins, lingui integration example could be improved HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from js-lingui.