This week's giveaway is in the Spring forum.
We're giving away four copies of Learn Spring Security (video course) and have Eugen Paraschiv on-line!
See this thread for details.
Win a copy of Learn Spring Security (video course) this week in the Spring forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

fmt:setBundle usage for internationalization

 
nizams uddin
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

i'm trying to use internationalization in my application.
for this, i have 2 properties files(one for us and other for french)

when i use the below tag(<fmt:bundle>), ApplicationProperties_fr_CA.properties file should be called.
But it is not picking that,instead it is invoking ApplicationProperties.properties file
please let me know what to do.

<fmt:setLocale value="fr_CA"/>
<fmt:bundle basename="com.gmac.dsr.config.i18n.ApplicationProperties"/>

Thanks in adv.
 
Christophe Verré
Sheriff
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
1. Where did you put your property files ?
2. How did you get the messages ?
 
nizams uddin
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
property files are under one of my folder.
but the problem is that it is not setting locale to pick the right property file.
if i use
<fmt:bundle basename="com.gmac.dsr.config.i18n.ApplicationProperties_en_CA"/> directly, then it works.
but i want to set locale using fmt:setLocale tag.

please let me know at the earliest.
 
Christophe Verré
Sheriff
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
en_CA ? You were talking about fr_CA ;) Are you sure you're using the correct extension ?

setLocale should work ok, because the container will add the extension to the basename set in fmt:bundle.
 
nizams uddin
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
it is en_CA.
but main stuff is that it should pick the file.
or is there any other settings that i had to do.
any idea how to know the locale that is being set to.
for ex,<fmt:setLocale value="fr_CA"/> sets locale to fr_CA.
but how to retrive that set value so that i could check the locale.
i tried request.getLocale() and it gave en_US.
i think it is not setting and taking en_US which is a default value.

any suggestions guys how to proceed fwd.
 
Christophe Verré
Sheriff
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I've done a little test with fr_CA and it worked fine.
Where did you put your message files ?
 
nizams uddin
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i inserted my property files under i18 folder of my framework.
we are supposed to put these files under this folder.
anyways it is picking ApplicationProperties_en_CA file if i manually type <fmt:bundle basename="com.gmac.dsr.config.i18n.ApplicationProperties_en_CA"/> instead of
<fmt:setLocale value="en_CA"/>
<fmt:bundle basename="com.gmac.dsr.config.i18n.ApplicationProperties"/>
so it is confirm that it is picking the file.
but main thing is the locale setting.
 
Christophe Verré
Sheriff
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
So you are saying that <fmt:setLocale value="en_CA"/> does not allow you to read ApplicationProperties_en_CA.properties ?

 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic