how are people Internationalizating thier jsps

Posted on 2005-04-27
Last Modified: 2008-03-17

I am in the process of allowing my web app two langs. English and spanish.

I found a pretty good article on some ideas on how to do it

But i am concerned with loading this application wide properties file evertime the jsp is loaded
        Locale currentLocale;
        ResourceBundle messages;

        currentLocale = new Locale(language, country);

        messages = ResourceBundle.getBundle("MessagesBundle", currentLocale);

SO i am wondering how other people are accomplishing this task?

Question by:paries
    LVL 19

    Expert Comment

    better check that tutorial See chapter 22 "Internationalizing and Localizing Web Applications"
    LVL 3

    Assisted Solution

    Yes, ur approach is correct

    Btw, ResourceBundle will not load each time of ur JSP hit

    ResourceBundle  will load only once (at first hit) and so it will not cause any performance issue

    No other best way is there to implement multilingual (many languages)
    LVL 3

    Expert Comment

    >>But i am concerned with loading this application wide properties file evertime the jsp is loaded

    I think u have wrong opnion about ResourceBundle  bcaz of ur property file name

    Actually, if u use Properties class, then it will loan ur file each time. ResourceBundle  will work differently

    check the link for more information
    LVL 29

    Accepted Solution

    As previously stated, resource bundles are the way to go. They are commonly used in things like Struts applications where they are an essential part. If you want easy internalization, I would take a good look at the fmt library of JSTL (JSTL can be found here

    This library allows many things but 2 of the most important are localization and iternationalization (often reffered to as l10n and i18n). This gives you multiple language support on your website as well as the correct formatting for things such as currency, time and date.

    The fmt library is based around the use of Resource Bundles but all the hardwork is taken away. The library is read once at start-up and then stored in memory. This makes it very fast and very efficient. I'm currently using it for a site that supports both English (_en), French (_fr) and Chinese (_zh) languages and it's been brilliant.

    Here's a simple example.

    <%@ page language="java" contentType="text/html" %>
    <%@ taglib uri='' prefix='fmt'%>
    <%-- The following line is not required if you've set it up in web.xml --%>
    <fmt:setBundle basename='i18n'/>
    <title><fmt:message key='welcome'/></title>
    <fmt:message key='hello'/>

    where is:

    and is:

    And now that webapp supports french and english, using the locale specified in the request sent by the browser.

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    How to improve team productivity

    Quip adds documents, spreadsheets, and tasklists to your Slack experience
    - Elevate ideas to Quip docs
    - Share Quip docs in Slack
    - Get notified of changes to your docs
    - Available on iOS/Android/Desktop/Web
    - Online/Offline

    I've been asked to discuss some of the UX activities that I'm using with my team. Here I will share some details about how we approach UX projects.
    DECT technology has become a popular standard for wireless voice communication. DECT devices are not likely to be affected by other electronic devices and signals because they operate in a separate frequency-band.
    In this sixth video of the Xpdf series, we discuss and demonstrate the PDFtoPNG utility, which converts a multi-page PDF file to separate color, grayscale, or monochrome PNG files, creating one PNG file for each page in the PDF. It does this via a c…
    Here's a very brief overview of the methods PRTG Network Monitor ( offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…

    779 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    11 Experts available now in Live!

    Get 1:1 Help Now