Win a copy of Spark in Action this week in the Open Source Projects forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Carey Brown

internationalization in JSTL

 
Ranch Hand
Posts: 57
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all!
i would like to know how pages can be internationalized using PropertiesResourceBundle in JSTL.
I had tried as shown in the fragment below, but it didn't work :

-------------------------------------------------------
<fmt:bundle basename="resources.application">
locale : ${param.local}
<fmt:setLocale value="${param.local}"/>
<title> <fmt:message key="welcome.title"/></title>
<h1><fmt:message key="welcome.heading"/></h1>
<hr>
<fmt:message key="welcome.message"/>
</fmt:bundle>
-------------------------------------------------------

Here, the base resource bundle is "application.properties",
and i've created a couple of other resource bundles, say - "application_de.properties" and "application_sh.properties".
I'm not getting the desired result even upon setting the locale to "de" or "sh".
Kindly give some suggestions, as to where I might have gone wrong and how it is actually to be done.
Regards,
Naresh
 
Vasudhaiv Naresh
Ranch Hand
Posts: 57
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all!
I found that the problem occurred with the following :
---------------------------------------------------------
<B><fmt:bundle basename="resources.application"></B>
locale : ${param.local}
<B>fmt:setLocale value="${param.local}"/></B>
<title> <fmt:message key="welcome.title"/></title>
<h1><fmt:message key="welcome.heading"/></h1>
<hr>
<fmt:message key="welcome.message"/>
</fmt:bundle>
---------------------------------------------------------

The reason being :
The locale should be set prior to setting the "bundle basename".

Regards,
Naresh
 
I think she's lovely. It's this tiny ad that called her crazy:
Thread Boost feature
https://coderanch.com/t/674455/Thread-Boost-feature
    Bookmark Topic Watch Topic
  • New Topic