You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Piller Sébastien <pi...@hmcrecord.ch> on 2007/11/06 10:00:04 UTC
Question about localization
Hello everybody,
I have a question about the localization in Wicket 1.3 beta 4. I have to
handle different files for the same language and the same component. In
example, I have a home page in english who says "Hello dude!" (this
string is stored in a *.properties file). And I need a second
*.properties who store "Good morning mister!", and a way for switching
them. I've planned to put this ressource files into separate folder,
like this:
/src
/my/package/MyComponent.java
/my/package/MyComponent.html
/my/package/MyComponent.properties // store defaults values
/properties
/style1
MyComponent.properties // store "Hello dude!"
/style2
MyComponent.properties // store "Good morning Mister!"
Is it possible? And how can I do that?
Thank you very much!
S. Piller
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org
Re: Question about localization
Posted by Igor Vaynberg <ig...@gmail.com>.
write your own wicket:message like tag?
-igor
On 11/8/07, Pills <pi...@hmcrecord.ch> wrote:
>
>
>
> igor.vaynberg wrote:
> >
> > application.init() {
> > getresourcesettings().setlocalizer(...);
> > }
> >
> > you dont have to use the default resource model, just write your own
> > if you dont like the default one.
> >
> > -igor
> >
>
> Thank you, it works fine ;)
>
> But I have another problem. I sometimes use "<wicket:message key="foo">" as
> a shortcut for inserting text. Is it possible to automatically append some
> text to the key value? (I need to transform it to "style1.foo")
>
> Thank you
>
> --
> View this message in context: http://www.nabble.com/Question-about-localization-tf4756837.html#a13648232
> Sent from the Wicket - User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org
Re: Question about localization
Posted by Pills <pi...@hmcrecord.ch>.
igor.vaynberg wrote:
>
> application.init() {
> getresourcesettings().setlocalizer(...);
> }
>
> you dont have to use the default resource model, just write your own
> if you dont like the default one.
>
> -igor
>
Thank you, it works fine ;)
But I have another problem. I sometimes use "<wicket:message key="foo">" as
a shortcut for inserting text. Is it possible to automatically append some
text to the key value? (I need to transform it to "style1.foo")
Thank you
--
View this message in context: http://www.nabble.com/Question-about-localization-tf4756837.html#a13648232
Sent from the Wicket - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org
Re: Question about localization
Posted by Igor Vaynberg <ig...@gmail.com>.
application.init() {
getresourcesettings().setlocalizer(...);
}
you dont have to use the default resource model, just write your own
if you dont like the default one.
-igor
On 11/7/07, Pills <pi...@hmcrecord.ch> wrote:
>
> Yes, I'll make it part of the key.
>
> I searched but not found, how can I change the default localizer and the
> default resourcemodel?
>
> There is no method "setLocalizer"/"setResourceModel" in class
> WebApplication...
>
> Thank you for your help.
>
>
> igor.vaynberg wrote:
> >
> > you can override methods in localizer to bend it to your will, but
> > like i said beware if you do not expect to make style part of the key
> >
> > -igor
> >
>
> --
> View this message in context: http://www.nabble.com/Question-about-localization-tf4756837.html#a13623105
> Sent from the Wicket - User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org
Re: Question about localization
Posted by Pills <pi...@hmcrecord.ch>.
Yes, I'll make it part of the key.
I searched but not found, how can I change the default localizer and the
default resourcemodel?
There is no method "setLocalizer"/"setResourceModel" in class
WebApplication...
Thank you for your help.
igor.vaynberg wrote:
>
> you can override methods in localizer to bend it to your will, but
> like i said beware if you do not expect to make style part of the key
>
> -igor
>
--
View this message in context: http://www.nabble.com/Question-about-localization-tf4756837.html#a13623105
Sent from the Wicket - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org
Re: Question about localization
Posted by Igor Vaynberg <ig...@gmail.com>.
you can override methods in localizer to bend it to your will, but
like i said beware if you do not expect to make style part of the key
-igor
On 11/6/07, Pills <pi...@hmcrecord.ch> wrote:
>
>
> igor.vaynberg wrote:
> >
> > now what you CAN do is write your own resourcemodel
> >
> > -igor
> >
>
> Is it possible to place style1 and style2 strings in separate files? I mean,
> is it possible to force the resource localizer to look up into several files
> for style1.foo or style2.foo?
>
> Thank you for your help ;)
> --
> View this message in context: http://www.nabble.com/Question-about-localization-tf4756837.html#a13615397
> Sent from the Wicket - User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org
Re: Question about localization
Posted by Pills <pi...@hmcrecord.ch>.
igor.vaynberg wrote:
>
> now what you CAN do is write your own resourcemodel
>
> -igor
>
Is it possible to place style1 and style2 strings in separate files? I mean,
is it possible to force the resource localizer to look up into several files
for style1.foo or style2.foo?
Thank you for your help ;)
--
View this message in context: http://www.nabble.com/Question-about-localization-tf4756837.html#a13615397
Sent from the Wicket - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org
Re: Question about localization
Posted by Igor Vaynberg <ig...@gmail.com>.
i wouldnt use wicket's localization support for this.
you can always implement your own IStringResourceLoader, but the
problem with that is that wicket caches the lookup by default so you
wouldnt be able to switch.
now what you CAN do is write your own resourcemodel that would append
the style to the key, if you have style1.message and style2.message
properties defined then you wont have a problem and your
StyledResourceModel can simply append style1. or style2. to your
message lookups.
-igor
On 11/6/07, Piller Sébastien <pi...@hmcrecord.ch> wrote:
> Hello everybody,
>
> I have a question about the localization in Wicket 1.3 beta 4. I have to
> handle different files for the same language and the same component. In
> example, I have a home page in english who says "Hello dude!" (this
> string is stored in a *.properties file). And I need a second
> *.properties who store "Good morning mister!", and a way for switching
> them. I've planned to put this ressource files into separate folder,
> like this:
> /src
> /my/package/MyComponent.java
> /my/package/MyComponent.html
> /my/package/MyComponent.properties // store defaults values
> /properties
> /style1
> MyComponent.properties // store "Hello dude!"
> /style2
> MyComponent.properties // store "Good morning Mister!"
>
> Is it possible? And how can I do that?
>
> Thank you very much!
>
> S. Piller
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org