Internationalised Example Help Needed

My goal here is to put together an easily understandable example of an Internationalised stand-alone java application.

To start, I would like to create a stand-alone java application that performs the following tasks:

1. Has a pulldown that allows a user to select a language (English, Arabic, Korean, Greek, etc.) When the language is selected, I want to change the properties of a JTextFild so that when a user types in the JTextField, the characters that come out in the JTextField are in the language that was selected in the pulldown. I know how to create the pulldown, but how do I change the properties of the TextField dynamically?

2. I have a JButton that, when pressed, stores the language selected AND the characters in the JTextField into a Sybase Database. It also adds the same info to a JList that displays a list of text strings (in the language that they were entered) with their selected language (in English). My questions here are:

- How should I store the text in the database (Hex or Unicode?)

- Is it possible to have a JList display different languages on different lines within the list?

- Is there a generic font that can display ALL types of languages?

Any help (especially code samples) would be greatly appreciated. I have read the tutorials on this site, but I didn't see anything that would help.

[1377 byte] By [PleaseHelpMea] at [2007-10-2 16:10:00]
# 1

What do you mean when you say "the characters that come out in the JTextField are in the language that was selected in the pulldown"? The characters that are displayed in the field depend on the characters that the user inputs. There are no properties to change.

> 2. I have a JButton that, when pressed, stores the

> language selected AND the characters in the

> JTextField into a Sybase Database. It also adds the

> same info to a JList that displays a list of text

> strings (in the language that they were entered) with

> their selected language (in English). My questions

> here are:

>

> - How should I store the text in the database (Hex

> Hex or Unicode?)

I don't know Sybase, so there may be implementation-specific issues, but for the DBs that I know, it would only make sense to configure the DB to store eveything in Unicode. If you store hex values, the DB will not be able to perform locale-dependent collation, etc.

>

> - Is it possible to have a JList display different

> ent languages on different lines within the list?

>

Yes, why not? As long as everything is in Unicode, you can display anything you want anywhere you want (single characters alternating, for that matter)

> - Is there a generic font that can display ALL

> ALL types of languages?

Well, there are Unicode fonts that support MOST languages, but I think there will always be edge cases with new character sets that have only recently been added to the Unicode standard.

> Any help (especially code samples) would be greatly

> appreciated. I have read the tutorials on this site,

> but I didn't see anything that would help.

In that case I recommend that you find some of the books on Java internationalization and study them. A simple Google search will also give you some helpful links.

one_danea at 2007-7-13 16:53:34 > top of Java-index,Desktop,I18N...
# 2

Thanks for the help. I will store everything in Unicode. Here is some clarification on the other issue:

If the user selects English and starts typing in the text field, english letters are displayed in the TextField. If the user selects Greek and starts typing in the text field, the keyboard should somehow get mapped from English to Greek, and Greek letters appear in the text field as they are typed. If the user then selects Arabic, the keyboard should somehow get mapped to Arabic and Arabic letters should appear in the text field as they are typed.

I guess the real question is, how do I dynamically change the keyboard mapping for the TextField?

Also, what are some of the fonts that cover most languages?

PleaseHelpMea at 2007-7-13 16:53:34 > top of Java-index,Desktop,I18N...
# 3

To type International characters, install the Java-based [url=http://sourceforge.net/projects/jgim]KMapIME[/url] and call

getInputContext().selectInputMethod(inputLocale);

where inputLocale is the Locale object that corresponds to the selected language supported by KMapIME.

Arial Unicode MS and CyberBit are some of the fonts that have a large repertoire of International glyphs.

nguyenq87a at 2007-7-13 16:53:34 > top of Java-index,Desktop,I18N...
# 4

Well, if you want to change the keyboard layout you might get into some nasty situations - how do you know that the appropriate language group is available on the user's system (I assume you are talking about Windows systems here)? And what do you do if it is not?

I have never tried to do something like this, so can't provide any advice. I also don't quite see the relevance for users? In real life situations they will always have to install the keyboard layouts and perform the switching themselves.

As for fonts Lucida Sans Unicode works for me in most cases (does not support Tibetan and other newer additions).

one_danea at 2007-7-13 16:53:34 > top of Java-index,Desktop,I18N...