Feature Requests item #1475998, was opened at 2006-04-25 08:47
Message generated for change (Tracker Item Submitted) made by Item Submitter
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=684978&aid=1475998&group_id=119783
Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: core
Group: 1.3
Status: Open
Priority: 5
Submitted By: marco (meyetea)
Assigned to: Nobody/Anonymous (nobody)
Summary: Fallback Mech. for localizing strings with .properties files
Initial Comment:
it would be nice to have an (optional) fallback
mechanism for values in .properties file when dealing
with multiple locales and/or styles.
Right now (Wicket 1.2beta3) Wicket finds the most
specific .properties file and sticks to it.
So right now, each .properties hat to contain ALL keys
and their resp. values, eventhough many values may be
identical.
Especially when working with "styles", it would be nice
to have only the *changed* (overridden) keys and values
in the style-specific .properties file
See the following mailinglist thread for details:
--------------------------------------------------------
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=k&kid0709&bid&3057&dat1642
_______________________________________________
Wicket-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/wicket-user
----------------------------------------------------------------------
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=684978&aid=1475998&group_id=119783
-------------------------------------------------------
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-develop mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/wicket-develop