You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Maxim Solodovnik <so...@gmail.com> on 2015/02/26 12:22:21 UTC

Localization questions

Hello All,

I have couple of questions related to localization:

1) is there any way to list all available locales in Application?

let's say I have Application.properties.xml, Application_de.properties.xml,
Application_ru.properties.xml, I would like to get list of Locale.EN,
Locale.DE, Locale.RU in such case, is it possible?

2) Is there any way to get string in given Locale different from
WebSession.locale?

I would like to create email based on template in language of "receiver",
is it possible?

Thanks in advance!

-- 
WBR
Maxim aka solomax

Re: Localization questions

Posted by Maxim Solodovnik <so...@gmail.com>.
Thanks a lot!

Localizer seems to be exactly what I need :)

On Thu, Feb 26, 2015 at 5:42 PM, Tobias Soloschenko <
tobiassoloschenko@googlemail.com> wrote:

> Oh yes! :-) Forgot to mention Localizer!
>
> kind regards
>
> Tobias
>
> > Am 26.02.2015 um 12:38 schrieb Sven Meier <sv...@meiers.net>:
> >
> > 2)
> > Wicket's Localizer offers several methods with locale parameter, you can
> get it via component.getLocalizer().
> >
> > Sven
> >
> >> On 26.02.2015 12:22, Maxim Solodovnik wrote:
> >> Hello All,
> >>
> >> I have couple of questions related to localization:
> >>
> >> 1) is there any way to list all available locales in Application?
> >>
> >> let's say I have Application.properties.xml,
> Application_de.properties.xml,
> >> Application_ru.properties.xml, I would like to get list of Locale.EN,
> >> Locale.DE, Locale.RU in such case, is it possible?
> >>
> >> 2) Is there any way to get string in given Locale different from
> >> WebSession.locale?
> >>
> >> I would like to create email based on template in language of
> "receiver",
> >> is it possible?
> >>
> >> Thanks in advance!
> >
> >
> > ---------------------------------------------------------------------
> > 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
>
>


-- 
WBR
Maxim aka solomax

Re: Localization questions

Posted by Tobias Soloschenko <to...@googlemail.com>.
Oh yes! :-) Forgot to mention Localizer! 

kind regards

Tobias

> Am 26.02.2015 um 12:38 schrieb Sven Meier <sv...@meiers.net>:
> 
> 2)
> Wicket's Localizer offers several methods with locale parameter, you can get it via component.getLocalizer().
> 
> Sven
> 
>> On 26.02.2015 12:22, Maxim Solodovnik wrote:
>> Hello All,
>> 
>> I have couple of questions related to localization:
>> 
>> 1) is there any way to list all available locales in Application?
>> 
>> let's say I have Application.properties.xml, Application_de.properties.xml,
>> Application_ru.properties.xml, I would like to get list of Locale.EN,
>> Locale.DE, Locale.RU in such case, is it possible?
>> 
>> 2) Is there any way to get string in given Locale different from
>> WebSession.locale?
>> 
>> I would like to create email based on template in language of "receiver",
>> is it possible?
>> 
>> Thanks in advance!
> 
> 
> ---------------------------------------------------------------------
> 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: Localization questions

Posted by Sven Meier <sv...@meiers.net>.
2)
Wicket's Localizer offers several methods with locale parameter, you can 
get it via component.getLocalizer().

Sven

On 26.02.2015 12:22, Maxim Solodovnik wrote:
> Hello All,
>
> I have couple of questions related to localization:
>
> 1) is there any way to list all available locales in Application?
>
> let's say I have Application.properties.xml, Application_de.properties.xml,
> Application_ru.properties.xml, I would like to get list of Locale.EN,
> Locale.DE, Locale.RU in such case, is it possible?
>
> 2) Is there any way to get string in given Locale different from
> WebSession.locale?
>
> I would like to create email based on template in language of "receiver",
> is it possible?
>
> Thanks in advance!
>


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: Localization questions

Posted by Tobias Soloschenko <to...@googlemail.com>.
Hi,

As far as I know it is like this:

1) Every component is providing the current locale which is configured by the preferred language of the browser via #getLocale() derived from the websession or its parent (but root is from websession)

I think there is no way to get a list of all languages, because each component is translating the content based on found properties (e.g myproperty_de_De)

2) If the receiver is accessing your application with it's preferred language (configured in the browser) you could simply write properties for the specific locale and generate the template without any switch / if statements - if the language is not supported you could add properties without any locale Information and apply english translations as fallback.

kind regards

Tobias

> Am 26.02.2015 um 12:22 schrieb Maxim Solodovnik <so...@gmail.com>:
> 
> Hello All,
> 
> I have couple of questions related to localization:
> 
> 1) is there any way to list all available locales in Application?
> 
> let's say I have Application.properties.xml, Application_de.properties.xml,
> Application_ru.properties.xml, I would like to get list of Locale.EN,
> Locale.DE, Locale.RU in such case, is it possible?
> 
> 2) Is there any way to get string in given Locale different from
> WebSession.locale?
> 
> I would like to create email based on template in language of "receiver",
> is it possible?
> 
> Thanks in advance!
> 
> -- 
> WBR
> Maxim aka solomax

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org