Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

Multi Language

Posted on 2003-03-04
7
Medium Priority
?
196 Views
Last Modified: 2012-03-15
Hi
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)

Thanks
0
Comment
Question by:olisaac
7 Comments
 
LVL 63

Expert Comment

by:Zvonko
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.


0
 
LVL 1

Author Comment

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

Expert Comment

by:OMC2000
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.

0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 1

Author Comment

by:olisaac
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 ?
0
 
LVL 4

Accepted Solution

by:
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)
  {
    labels.put(key,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 !
0
 
LVL 1

Author Comment

by:olisaac
ID: 8064141
perfect solution !

Thank you very much
0

Featured Post

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

Question has a verified solution.

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

This article covers the basics of the Sass, which is a CSS extension language. You will learn about variables, mixins, and nesting.
Shoutout to Emily Plummer (http://www.experts-exchange.com/members/eplummer26.html) for giving me this article! She did most of it, I just finished it up and posted it for her :)    Introduction In a previous article (http://www.experts-exchang…
Viewers will learn about arithmetic and Boolean expressions in Java and the logical operators used to create Boolean expressions. We will cover the symbols used for arithmetic expressions and define each logical operator and how to use them in Boole…
Viewers will learn about the regular for loop in Java and how to use it. Definition: Break the for loop down into 3 parts: Syntax when using for loops: Example using a for loop:
Suggested Courses

572 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