3

The inbuilt java supports only for few languages.I want to use Sinhala language as locale in my jTextPane in java programme.How can i do this ?.Pls help me...

1
  • Do you have right font which supports your language? Commented Jul 12, 2011 at 8:55

2 Answers 2

2

AFAIK inbuilt Java supports it. Just create locale: Locale locale = new Locale("si", "LK"); (si for Sinhala and LK for Sri Lanka). A corresponding bundle could be for example messages_si_LK.properties. You can also use a language code alone. Then: Locale locale = new Locale("si"); and file messages_si.properties. And you have to take care of fonts.

Sign up to request clarification or add additional context in comments.

2 Comments

How can i use this with JTextPane ?
Look here at setting default locale exampledepot.com/egs/java.util/SetDefLocale.html Here about fonts leepoint.net/notes-java/GUI-appearance/fonts/10font.html (JButton example is similar to JTextPane)
2

The ICU project has extended the Java core libraries' locale support. They incorporate a much more expansive database of locale info and I believe they cover Sinhalese as the "si" locale.

ICU4J is the acronym for ICU's java specific stuff. ICU4J = ICU for java. The "Why use ICU4J?" part of their FAQ says

Locale data coverage - much better, many more locales, up-to-date

And it looks like their recent releases have expanded support for Sinhala in particular. From the 3.6 release notes

Layout: The font layout engine has support added for Tibetan, Sinhala and Old Hangul.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.