Thusitha
Thusitha

Reputation: 3511

Set locale(Language support) in java

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

Upvotes: 3

Views: 3426

Answers (2)

zacheusz
zacheusz

Reputation: 8842

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.

Upvotes: 2

Mike Samuel
Mike Samuel

Reputation: 120486

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.

Upvotes: 1

Related Questions