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...

Thusitha
  • 3,393
  • 3
  • 21
  • 33

2 Answers2

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.

zacheusz
  • 8,750
  • 3
  • 36
  • 60
  • How can i use this with JTextPane ? – Thusitha Jul 12 '11 at 09:38
  • Look here at setting default locale http://www.exampledepot.com/egs/java.util/SetDefLocale.html Here about fonts http://leepoint.net/notes-java/GUI-appearance/fonts/10font.html (JButton example is similar to JTextPane) – zacheusz Jul 12 '11 at 09:46
1

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.

Mike Samuel
  • 118,113
  • 30
  • 216
  • 245