MarcGiffing/wicket-spring-boot

Example on using i18n

virmundi opened this issue · 8 comments

This is an enhancement request. I can get the Page.properties.xml to work fine (they are in the resources directory under maven, not in the main). When I try to a MainWebApplication.properties.xml (the name of the SpringBootApplication class) at the same level in the resources directory, it never gets found. How would I do that?

Does the problem exists only when you package it as a jar/war or also when starting up in your IDE?

So far I've only attempted the process in Intellij. I haven't tried the uber jar from spring.

OK, I think i got it. Since you don't extend from WicketBootSecuredWebApplication or WicketBootStandardWebApplication the class from which you start the application is not registered by wicket. We have to register the MainWebApplication so that wicket will lookup for corresponding property/xml files.

Does anyone knows how to register a class for property lookup in wicket?

While I think this is a good avenue of research, I thought extending from those two classes was only necessary when attempting advanced configurations. I extended the first class. The properties turned on.

I didn't find a way to register a class outside of the Wicket hirachy so far but you can use a property called wicket-package.properties as an alternative.

https://ci.apache.org/projects/wicket/guide/8.x/single.html#_package_bundles

Here are the IStringResourceLoaders registered by default: https://github.com/apache/wicket/blob/7bef3d67c8ccc269f02e8943bf9a22c3cd5438e9/wicket-core/src/main/java/org/apache/wicket/settings/ResourceSettings.java#L220-L224
To register more you should use getResourceSettings().getStringResourceLoaders().add(new ClassStringResourceLoader(MainWebApplication.class)). You may want to use .add(0, ...) to consult it before any others. It is up to you.