Reputation: 435
I have an English resource bundle messages.properties
and a German resource bundle messages_de.properties
.
When I don't find a message in German bundle, but it's present in English bundle, REsourceBundle#getString()
method returns the message from English (it's set as German bundle's parent).
I want to temporarily disable this behavior when I am testing in which scenarios German messages are missing, so basically I want to throw an exception when a German message is not found, but English message is present (in my specific test environment).
What's the easiest way to do this? We are using Spring and looking up messages through application context.
In the image below, it shows how ResourceBundle implementation looks up in the parent map if it doesn't find it in itself (and there seems no simple way to change this behavior).
Upvotes: 1
Views: 1026
Reputation: 317
I think all you need to do is to set fallbackToSystemLocale
property of ReloadableResourceBundleMessageSource
to false
.
Upvotes: 0