aspose file tools*
The moose likes JSP and the fly likes fmt:setBundle usage for internationalization Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "fmt:setBundle usage for internationalization" Watch "fmt:setBundle usage for internationalization" New topic
Author

fmt:setBundle usage for internationalization

nizams uddin
Greenhorn

Joined: Jul 31, 2006
Posts: 15
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

Joined: Nov 24, 2005
Posts: 14688
    
  16

1. Where did you put your property files ?
2. How did you get the messages ?


[My Blog]
All roads lead to JavaRanch
nizams uddin
Greenhorn

Joined: Jul 31, 2006
Posts: 15
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

Joined: Nov 24, 2005
Posts: 14688
    
  16

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

Joined: Jul 31, 2006
Posts: 15
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

Joined: Nov 24, 2005
Posts: 14688
    
  16

I've done a little test with fr_CA and it worked fine.
Where did you put your message files ?
nizams uddin
Greenhorn

Joined: Jul 31, 2006
Posts: 15
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

Joined: Nov 24, 2005
Posts: 14688
    
  16

So you are saying that <fmt:setLocale value="en_CA"/> does not allow you to read ApplicationProperties_en_CA.properties ?

 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: fmt:setBundle usage for internationalization