Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Translator] Filter dumped domains #1225

Closed
stof opened this issue Oct 23, 2023 · 5 comments · Fixed by #1930 · May be fixed by #1927
Closed

[Translator] Filter dumped domains #1225

stof opened this issue Oct 23, 2023 · 5 comments · Fixed by #1930 · May be fixed by #1927

Comments

@stof
Copy link
Member

stof commented Oct 23, 2023

In my project where I'm using https://github.com/willdurand/BazingaJsTranslationBundle currently, I'm using the js domain for translation keys used in JS code instead of keeping them in the messages domain. This allows me to reduce the size of the dumped translation a lot by including only this domain in the dumped JS code (I have less than 100 keys in the JS file, while I have more than 2000 keys in the messages domain).
It would be great if the bundle could have a configuration setting to define the list of domains to dump for the JS code instead of dumping them all (the default could still be to dump them all).

@stof
Copy link
Member Author

stof commented Oct 23, 2023

Btw, this can help with the fact that AssetMapper does not have tree-shaking features.

@smnandre
Copy link
Member

It would be great if the bundle could have a configuration setting to define the list of domains to dump for the JS code instead of dumping them all (the default could still be to dump them all).

Great idea!

Btw, this can help with the fact that AssetMapper does not have tree-shaking features.

We could create a separate "module" per domain, and use assetmapper to generate the file used to preload/register them ?

Pseudo-code

// translations.js

import { validation } from "domain/validation.js"
import { blog } from "domain/blog.js"
import { domains } from "domains.js" 

domains.register('validation', validation)
domains.register('blog', blog)

@carsonbot
Copy link

Thank you for this issue.
There has not been a lot of activity here for a while. Has this been resolved?

@carsonbot
Copy link

Friendly reminder that this issue exists. If I don't hear anything I'll close this.

@smnandre
Copy link
Member

Let's keep it open for now :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
5 participants