michelemarcon
michelemarcon

Reputation: 24767

How to know the android language from a JAR lib

I am writing a JAR library that will be used on desktop and also on android. The JAR is localized, therefore I would like to know the current android language in order to set the locale accordingly.

How should I do that?

UPDATE: The locale is the same of the android language, but ResourceBundle.getString() always revert to the default locale.

LAST UPDATE: It's a bug on Android, if my locale is it_IT it looks exclusively for Locale_it_IT; and skips Locale_it (which instead is accepted on Java).

OOPS! it ACTUALLY was a bug on my code... android is case sensitive and I created a resourcebundle with locale IT instead of it... shame on me.

Upvotes: 0

Views: 230

Answers (1)

Heiko Rupp
Heiko Rupp

Reputation: 30934

Android supporrs the normal java Locale related methods, so you should be fine by just asking for Locale.getDefault()

Upvotes: 1

Related Questions