You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by ulrik <ul...@gmail.com> on 2008/10/03 23:41:14 UTC

Howto .xml instead of .properties

Hello!

I have a question regarding localization/internationalization of my
application.
I have up until now stored some of my properties in .properties files, and
some in .xml files. Now I want to have all the info in .xml files.

The reason I have both is that when I want to localize text in .html files,
xml is very easy to use: 

//HTML
<wicket:message key="text>{some text}</wicket:message>

//XML
..
..
..
<entry key="text">translated text</entry>

The reason I also use .properties is because it is easy  to access localized
string from java code..
I do something like this

//MyClass.java
ArrayList<String> cityList = new ArrayList<String>();
cityList.add(BundleSupport.getMessage("Gothenburg",locale); 
.. where BundleSUpport.getMessage(String key,Locale locale) returns the
localized city String

//MyClass_sv.properties
Gothenburg=Göteborg

Like I said, now I want to replace all my .properties files with only .xml
files..
But how do I access localized string from the java code as easy as I showed
above?

I hope it is easy to understand what I am asking

//Ulrik
-- 
View this message in context: http://www.nabble.com/Howto-.xml-instead-of-.properties-tp19806048p19806048.html
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: Howto .xml instead of .properties

Posted by jWeekend <jw...@cabouge.com>.
Ulrik,

Take a look at Component's getLocalizer() and Localizer's getString(...).

Regards - Cemal
http://www.jWeekend.co.uk http://jWeekend.co.uk 



ulrik wrote:
> 
> Hello!
> 
> I have a question regarding localization/internationalization of my
> application.
> I have up until now stored some of my properties in .properties files, and
> some in .xml files. Now I want to have all the info in .xml files.
> 
> The reason I have both is that when I want to localize text in .html
> files, xml is very easy to use: 
> 
> //HTML
> <wicket:message key="text>{some text}</wicket:message>
> 
> //XML
> ..
> ..
> ..
> <entry key="text">translated text</entry>
> 
> The reason I also use .properties is because it is easy  to access
> localized string from java code..
> I do something like this
> 
> //MyClass.java
> ArrayList<String> cityList = new ArrayList<String>();
> cityList.add(BundleSupport.getMessage("Gothenburg",locale); 
> .. where BundleSUpport.getMessage(String key,Locale locale) returns the
> localized city String
> 
> //MyClass_sv.properties
> Gothenburg=Göteborg
> 
> Like I said, now I want to replace all my .properties files with only .xml
> files..
> But how do I access localized string from the java code as easy as I
> showed above?
> 
> I hope it is easy to understand what I am asking
> 
> //Ulrik
> 

-- 
View this message in context: http://www.nabble.com/Howto-.xml-instead-of-.properties-tp19806048p19816219.html
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