I'll looked into it last night and I don't think there currently is a
simpler solution than what Marco provided. It actually is the
IResourceLoader which we are using deep inside Wicket core to load the
properties file. We developed the IResourceLoader to load the
MarkupFile and later on used it for the properties files as well. The
current behavior is suitable for MarkupFile - you want to load just
the one which fits best to the locale, style, variation and name - but
obviously not for properties. BTW default java loaders can not be used
because of style and variation which they don't support.
We could apply Marco's 'patch' to core as a temporary workaround for
1.2 and find a proper solution in 1.3. But as that change might affect
existing applications that change is similar to an API break and we'd
a vote on that change from all core developers.
I'd suggest you open a RFE thus makeing sure it is not forgotten.
Juergen
On 4/24/06, Juergen Donnerstag <[EMAIL PROTECTED]> wrote:
> I think it is a RFE.
>
> Juergen
>
> On 4/24/06, Marco Geier <[EMAIL PROTECTED]> wrote:
> > johan,
> >
> > the fallback mechanism works fine *on the bundle-level*, i.e. Wicket
> > will try all these SomeApplication_locale_style.properties combinations
> > down to SomeApplication.properties.
> >
> > But once it found a bundle it will not longer look for another bundle,
> > even if the key is not contained, but could be found in a more generic
> > bundle.
> >
> > What i (and presumably Ari) wanted tried to achieve, is to have some
> > style-specific bundle wich only contains some keys with style-specific
> > values and thus not having to maintain a bunch of property files if we
> > add another key, eventhough it's value would be the same across all styles.
> >
> > But since this behaviour is *not* how java usually deals with
> > .properties, i'm not sure if this is a bug.
> >
> > Anyway this would be a nice feature, but maybe should be explicitly
> > activated somehow....
> >
> > So should i put this into sf as a bug or as a feature request?
> >
> > Marco
> >
> > Johan Compagner wrote:
> > > we should try to fall back to those better then (i thought this already
> > > happend)
> > > can you make a bug report for this with a small (unit) test case ?
> > >
> > > johan
> > >
> > >
> > > On 4/24/06, Marco Geier <[EMAIL PROTECTED]> wrote:
> > >
> > >>by default you need all values in all files!
> > >>
> > >>I had the same problem and adding the following code to application's
> > >>init did the trick:
> > >>
> > >>getResourceSettings().addStringResourceLoader(new
> > >>ApplicationStringResourceLoader(this) {
> > >>
> > >> @Override
> > >> public String loadStringResource(Class clazz, String key, Locale
> > >>locale, String style) {
> > >> return super.loadStringResource(clazz, key, locale, null);
> > >> }
> > >>
> > >>});
> > >>
> > >>getResourceSettings().addStringResourceLoader(new
> > >>ApplicationStringResourceLoader(this) {
> > >>
> > >> @Override
> > >> public String loadStringResource(Class clazz, String key, Locale
> > >>locale, String style) {
> > >> return super.loadStringResource(clazz, key, null, locale);
> > >> }
> > >>
> > >>});
> > >>
> > >>getResourceSettings().addStringResourceLoader(new
> > >>ApplicationStringResourceLoader(this) {
> > >>
> > >> @Override
> > >> public String loadStringResource(Class clazz, String key, Locale
> > >>locale, String style) {
> > >> return super.loadStringResource(clazz, key, null, null);
> > >> }
> > >>
> > >>});
> > >>
> > >>
> > >>Please wicket-dev's tell us if there is a cleaner way...
> > >>
> > >>Marco
> > >>
> > >>
> > >>Ari Suutari wrote:
> > >>
> > >>>Hi,
> > >>>
> > >>>If I have following property files for my application:
> > >>>
> > >>>1) Application_myskin_fi.properties
> > >>>message1=AAAAAAAAA
> > >>>2) Application_myskin.properties
> > >>>message2=BBBBBBBB
> > >>>3) Application.properties
> > >>>message3=CCCCCCC
> > >>>
> > >>>If I have three messages above, must
> > >>>I put values for these keys for each property file, or will wicket
> > >>>search files 2 and 3 even file 1 exists, ie. if i call
> > >>>Component.getString("message1")
> > >>>it is retrieved from file 1 but if I call Component.getString
> > >>
> > >>("message3")
> > >>
> > >>>is is correctly read from file 3.
> > >>>
> > >>>I cannot get this to work and I'm not sure where the problem is.
> > >>>
> > >>> Ari S.
> > >>>
> > >>>
> > >>>
> > >>>-------------------------------------------------------
> > >>>Using Tomcat but need to do more? Need to support web services,
> > >>
> > >>security?
> > >>
> > >>>Get stuff done quickly with pre-integrated technology to make your job
> > >>>easier
> > >>>Download IBM WebSphere Application Server v.1.0.1 based on Apache
> > >>
> > >>Geronimo
> > >>
> > >>>http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
> > >>>_______________________________________________
> > >>>Wicket-user mailing list
> > >>>[email protected]
> > >>>https://lists.sourceforge.net/lists/listinfo/wicket-user
> > >>>
> > >>>
> > >>
> > >>--
> > >>___________________________
> > >>
> > >>Dipl.-Ing. Marco Geier
> > >>EyeTea GmbH
> > >>Germany
> > >>phone +49 (0)721 662464-0
> > >>fax +49 (0)721 662464-1
> > >>mobile +49 (0)177 6579590
> > >>[EMAIL PROTECTED]
> > >>
> > >>
> > >>-------------------------------------------------------
> > >>Using Tomcat but need to do more? Need to support web services, security?
> > >>Get stuff done quickly with pre-integrated technology to make your job
> > >>easier
> > >>Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
> > >>http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
> > >>_______________________________________________
> > >>Wicket-user mailing list
> > >>[email protected]
> > >>https://lists.sourceforge.net/lists/listinfo/wicket-user
> > >>
> > >
> > >
> >
> > --
> > ___________________________
> >
> > Dipl.-Ing. Marco Geier
> > EyeTea GmbH
> > Germany
> > phone +49 (0)721 662464-0
> > fax +49 (0)721 662464-1
> > mobile +49 (0)177 6579590
> > [EMAIL PROTECTED]
> >
> >
> > -------------------------------------------------------
> > Using Tomcat but need to do more? Need to support web services, security?
> > Get stuff done quickly with pre-integrated technology to make your job
> > easier
> > Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
> > http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
> > _______________________________________________
> > Wicket-user mailing list
> > [email protected]
> > https://lists.sourceforge.net/lists/listinfo/wicket-user
> >
>
-------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid0709&bid&3057&dat1642
_______________________________________________
Wicket-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/wicket-user