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

resourcebundle basenames order not respected #11795

Open
robertoschwald opened this issue May 2, 2021 · 1 comment · May be fixed by #11796
Open

resourcebundle basenames order not respected #11795

robertoschwald opened this issue May 2, 2021 · 1 comment · May be fixed by #11796

Comments

@robertoschwald
Copy link

robertoschwald commented May 2, 2021

Steps to Reproduce

Define the PluginAwareResourceBundleMessageSource in resources.groovy and set the basenames array.

Expected Behaviour

Grails respects the order of basenames defined, so one is able to overwrite existing keys with new ones in a separate bundle.
This is especially useful if you migrate a project with thousands of translations in many languages and need to re-define key texts. For this, you use a basename which is defined first in the list.
Of course you can play around with bundle naming, as this is the default behaviour of the PluginAwareResourceBundleMessageSource, but the AbstractMessageSource.setBasenames() doc says:
"The associated resource bundles will be checked sequentially when resolving a message code".
Also, Spring ReloadableResourceBundle uses a similar functionality.

Actual Behaviour

Grails ignores the basenames order, so you cannot overwrite bundle keys in bundles you defined to be resolved first.

Environment Information

  • Operating System: Doesn't matter. macOS 11 in this case
  • Grails Version: Grails 3 and 4 affected
  • JDK Version: 8 or 11
  • Container Version (If Applicable): Doesn't matter.

Example Application

https://github.com/robertoschwald/GrailsPluginAwareBasenamesOrderBug

@robertoschwald
Copy link
Author

PR follows.

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

Successfully merging a pull request may close this issue.

1 participant