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

Multi-module support #18

Open
ilyasKerbal opened this issue Dec 8, 2023 · 2 comments
Open

Multi-module support #18

ilyasKerbal opened this issue Dec 8, 2023 · 2 comments
Labels
enhancement New feature or request

Comments

@ilyasKerbal
Copy link

Is your feature request related to a problem? Please describe.
The i18n extension doesn't support multi-modules. All the string resources must live inside the main app module.

Describe the solution you'd like
I don't have any ideas at the moment.

Describe alternatives you've considered
I use a simple Gradle script to merge all the string resources from different modules.

@ilyasKerbal ilyasKerbal added the enhancement New feature or request label Dec 8, 2023
@aymanizz
Copy link
Owner

aymanizz commented Dec 9, 2023

Thanks for submitting this feature request. Correct me if I am wrong, but I assume what you're asking for is essentially a way to merge multiple resource bundles into one when loading/reading them whether these come from multiple java/gradle/maven modules or even libraries. As far as I understand it, ResourceBundle uses a class loader to read the required resource and picks the first match, there's no builtin mechanism for merging multiple bundles. However, it should be possible to extend the ResourceBundle or ResourceBundle.Control to support this.

I don't think I'll have the time to implement this into the extension but you're welcome to contribute it if you want. The goal for this extension was to provide a base for implementing I18n support, while being flexible enough to allow extending it and changing the behaviour according to your needs. Thus, the loading and reading of resources is kept simple.

One can implement their own ResourceBundle.Control to customize loading of resources which provides an opportunity to merge multiple bundles together, then provide the implementation to the ResourceBundleMessageResolver. Alternatively, an implementation of MessageResolver (maybe based on ResourceBundleMessageResolver`) could implement custom functionality for the look up of a key in multiple resource bundles.

@ageorgousakis
Copy link

@ilyasKerbal
can you please share the Gradle script you use to merge all the string resources from different modules?

Regards

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants