I’ve got a few .ftl templates I’m bundling with an extension in the src/main/resources/theme-resources/ directory, so that they can be used with by my extension independently of deploying a theme with it. I’m trying to find out if messages properties files are supported with this approach, but I can’t figure out where to put them so they get picked up. I tried src/main/resources/theme-resources/messages/messages_en.properties, but that doesn’t seem to work. Any ideas?
Don’t know if you solved your issue or if it’s still valid…
But I recognized something similar yesterday in my environment (17 Quarkus):
As soon as I have more than one custom JAR deployment with a, e.g., messages_en.properties file, only the one from the JAR which is loaded first will be used. Any other messages_en.properties file from JARs which will be loaded afterwards will be ignored, as there is already a custom `messages_en.properties_ loaded and available in the classpath.
So, if you have multiple custom provider JARs containing several messages_en.properties, only the first will be considered. Either you’ll have to deploy all providers together in one JAR with one messages_en.properties or you’ll have to overwrite the keys in a custom theme which isn’t deployed via JAR, but in the folder structure directly.
Thanks for following up on this. I still see the same behavior you describe. I’ll test to see if it’s deployment order that causes the override. Do you think we should submit a bug report for this?
Don’t know if this is really a “bug”, but at least an “unpleasant behavior”
We can try to start a discussion first and then see how the team responds (if).
I am having a similar issue with “messages_xx.properties” files not loaded in some cases.
I have 3 custom JARs, all of them containing theme-resources/messages/messages_xx.properties files, deployed on my Keycloak (v15.1.1) :
One is a module “lib” (CM1), placed into keycloak/modules/fr/mygroup/mylib/main/
The second is a custom authenticator (CM2) deployed in keycloak/standalone/deployments
The third is a also a custom authenticator (CM3) deployed in keycloak/standalone/deployments. It uses CM1 as a module dependency.
I have done some tests :
When I use CM3 in my authentication flow, the messages_xx.properties of CM3 is not found (still the key CM3-KEY on the page).
If I declare the CM3-KEY on the messages_xx.properties of CM1, then I see the value on the page !
If I declare the CM3-KEY on the messages_xx.properties of CM2, with another value, then it’s this value that I see on the page.
The CM3-KEY on the messages_xx.properties of CM3 never appears.
If I remove CM2, it still the CM1 value that is visible.
It seems, in my case, the problem appears only when a custom jar use another custom jar as a dependency. To me, this behavior sounds like a bug.
It’s problematic because I have many custom jar that can be used without specific theme. If I have to put messages of a custom JAR into a “lib” JAR, the dependencies goes bidirectional and it’s not what I expects.
We are changing some wordings to fit better our corporation language. I was having some troubles with these process, but it was my fault: in our current container build script, the theme was being installed coping it directly to the theme path. What worked was compiling a new JAR.
I did not need to add other translation files; the JAR with the properties containing the new text worked being put after or before our other Provider JAR (a e-mail message one).
theme.propertiesdoes not contain the locales entry key, though I don’t believe this would negatively affect the outcome. The messages_pt_BR.properties file contains only the changed string.