Git Product home page Git Product logo

Comments (8)

vsnig avatar vsnig commented on May 17, 2024 5

Catalog splitting is an absolutely necessary feature for any real world website or SPA. Is it planned to implement anytime soon?

from js-lingui.

tricoder42 avatar tricoder42 commented on May 17, 2024 1

@saravanan10393 end of August sounds reasonable, definitely mid September.

from js-lingui.

Photonios avatar Photonios commented on May 17, 2024

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.

saravanan10393 avatar saravanan10393 commented on May 17, 2024

@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.

tricoder42 avatar tricoder42 commented on May 17, 2024

@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.

saravanan10393 avatar saravanan10393 commented on May 17, 2024

@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.

chrischen avatar chrischen commented on May 17, 2024

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.

tricoder42 avatar tricoder42 commented on May 17, 2024

Closing in favor of #326 and #503. Both will land in v3.

from js-lingui.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.