Multi Language

Posted on 2003-03-04
Medium Priority
Last Modified: 2012-03-15
I've some pages made in JSP
I've to translate those pages in 5 others languages
Do you have a good solution for me ? (I don't want to  make a page by language)

Question by:olisaac
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
LVL 63

Expert Comment

ID: 8063193
You will have to :-)

Otherwise you have to restructure your page and keep the text content in separate JavaScript include files in arrays.
On load time of the page you load the appropriate *.js file and assign all transient text the actual values.

But in my opinion is this more overhead then to maintain separate pages.

For such things like you want to do are commercial products for special web servers.


Author Comment

ID: 8063208
I prefer made one page and group all text context somewhere
is it possile to made this with xml for example ?
LVL 15

Expert Comment

ID: 8063248
Also you may have database tables that hold text for your pages in all necessary languages and fulfill all page content with text selected from database with appropriate language code.
If you meant automated translator, it could be used as preliminary processing in order reduce typing only. They can't make good translation so far.

Get 15 Days FREE Full-Featured Trial

Benefit from a mission critical IT monitoring with Monitis Premium or get it FREE for your entry level monitoring needs.
-Over 200,000 users
-More than 300,000 websites monitored
-Used in 197 countries
-Recommended by 98% of users


Author Comment

ID: 8063257
i can't add tables in the DB
but a txt file is maybe good for this kind of work

It exists maybe some existants scripts that do that ?

Accepted Solution

thanassis earned 400 total points
ID: 8063391
import com.apt.util.*;

import java.util.*;
import java.io.*;
import java.util.Properties;

public class Labels
  Properties labels = new Properties();
  public Labels()

  public void addLabel(String key, String value)

  public String getLabel(String key)
    return labels.getProperty(key);

  public void load(String fileName) throws Exception
    labels.load(new FileInputStream(fileName));

  public Properties getLabels()
    return labels;

  public void setLabels(Properties newLabels)
    labels = newLabels;

Use the above class and then add the text files in the following format:

codedName1 = name in English (file en.txt)
codedName1 = name in France (file fr.txt)

in your jsp file keep a session
<jsp:useBean id="lang" scope="session" class="Labels" />

and thats all !

Author Comment

ID: 8064141
perfect solution !

Thank you very much

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

It's sometimes a bit tricky to use date functions in Oracle BPEL. I'll explain quickly how you can add N days to the current date. In a BPEL process this can be useful, and you can adapt it to fit your needs. First of all, let's see how to add 1 …
I will show you how to create a ASP.NET Captcha control without using any HTTP HANDELRS or what so ever. you can easily plug it into your web pages. For Example a = 2 + 3 (where 2 and 3 are 2 random numbers) Session("Answer") = 5 then we…
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…
Suggested Courses

765 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