• Post Reply Bookmark Topic Watch Topic
  • New Topic

Support English & French with same jsp files to read different properties file  RSS feed

 
albert kao
Ranch Hand
Posts: 252
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
We want to support internationalization and localization of the English and French language with our web application.
Is it feasible by using the same jsp files to read different properties file?
i.e. We plan to create a 'messages_en.properties' file for the English resource bundle
and 'messages_fr.properties' file for the French resource bundle.
Can the properties files be placed in the same source directory, then build English & French resource bundles and put in the same 'war/WEB-INF/classes' directory?
For our jsp files, we will do
<fmt:bundle basename="class.path.to.our.resource.bundle">
<fmt:message key="our.message.key"/>
</fmt:bundle>

Is there any tutorial or sample source code?
We use spring 2.5.6.SEC01.
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 66153
146
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
That's JSTL not Spring. Moved to the JSP forum.
 
Mark E Hansen
Ranch Hand
Posts: 650
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The book Core Servlets and JavaServer Pages goes through this for JSP. Yes it can be done and yes, it's pretty easy.
Note that frameworks usually have their own way of doing it. The way you do this in Spring may be different (although as
Spring is built on top of JSP, I would expect you can still use the JSP mechanism).

Note that the book referenced above is available for free download as PDF chapters from the book's web site http://pdf.coreservlets.com
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!