3

As a part of localization I am now trying to implement locale strings for Native languages(India).

While searching I found an solution on Stack overflow that we can create user defined locales.

How to extend the list of available Java Locales

I created my own class ,Some thing like

IndianLocale extends Locale { 
   IndianLocale (Locale Locale.En) ....
}

I have resource bundles with me for each language.But i am missing that where i have to map these bundles to Locale (So that when i request to a locale it will return a corresponding localise string).

Community
  • 1
  • 1
Suresh Atta
  • 120,458
  • 37
  • 198
  • 307

1 Answers1

0

As answers in that other post suggest, a Locale is little more than a formatted sequence of strings. If you already know your target locale, you can simply create a ResourceBundle for it based on its name, such as MyApplicationStrings_hi_IN_someregion.properties, regardless of whether that locale is known to Java.

If you don't know the name of the Locale, write a short Java program that does System.out.println(Locale.getDefault().toLanguageTag()); and run the program on a machine which is known to be set to the locale of interest.

VGR
  • 40,506
  • 4
  • 48
  • 63