Java Forum

Ask Question   UnAnswered
Home » Forum » Java       RSS Feeds

DB Internationalization prob

  Asked By: Grant    Date: Apr 09    Category: Java    Views: 727

I have question on Internationalization/Localization.
According to sun, Internationalization is the process of designing an
application so that it can be adapted to various languages and regions
without engineering changes. & Localization is the process of adapting
software for a specific region or language by adding locale-specific
components and translating text.
Now, this is possible if frontend framework changes from region to
region. but what if, suppose in Backend framework, my complete DB is in
other language & i want to display it in some different language. (for ex.
My complete DB is in japanese then how can i display it in English at
display time.)
In this case, how we can use Internationalization? can any DB
tool/plug-in/accessories i have to use or should it be handeled by frontend
framework. If yes, How? Did it require any different algoritham?
Any brain-storming?



1 Answer Found

Answer #1    Answered By: Al Allen     Answered On: Apr 09

You could create a single table of strings with multiple languages,
looked up using id's.

Say we have a table accomodating US English, french, spanish, dutch,
German, and Japanese.

The table would contain:
id int
en_us varchar(255)
fr varchar(255)
es varchar(255)
nl varchar(255)
de varchar(255)
ja varchar(255)

A utility class would lookup the text  using an id, which looks at the
currently selected Locale. It could default a String to the English
version if it hasn't been translated into the wanted language  yet.

"select * from stories where date<=today"
for each row:
int id = row.storyId;

StringLibrary stringLib = StringLibrary.getInstance(); // singleton
String text = stringLib.lookup(id);

display text.

StringLibrary would do the lookups.

Didn't find what you were looking for? Find more on DB Internationalization prob Or get search suggestion and latest updates.