Skip to content

resourcebundle basenames order not respected #11795

Open
@robertoschwald

Description

@robertoschwald

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    Status

    No status

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions