Those constants are there just as a convenience. You can create your
own.

I have no idea how Sun came up with that particular list of
"convenient" locales.

This is how Locale.JAPAN is defined. Just follow this pattern to
define your own:


  public static final Locale JAPAN = createSingleton("ja_JP_", "ja",
"JP");

However, it's likely you don't need or want the constants or your own
constant at all.

Locale.getDefault() may be the only thing you need or want. Or if you
really want a list of all ones that are supported by the phone,
Locale.getAvailableLocales() may be what you want.

I haven't tested Android's locale support, so I can't verify that it's
done correctly, but this is enough to at least write correct code, and
I would expect it to work.

I don't know how Android implements getDisplayLanguage() and
getDisplayCountry(), so I don't know how you'd handle these if you
have to define a locale that Android hasn't configured for you.
Hopefully, that question won't arise in practice. It *should* work to
call these even if you construct the Locale instance yourself, even if
it's a language for which there's no predefined constant. The Sun
implementation does a runtime lookup in the localization data.

On Apr 28, 4:32 am, Hunter  Peress <hunt...@gmail.com> wrote:
> Hello.
>
> I want to translate my app into all available markets.
>
> Now, from the market, we have:
> English (en_US) | 日本語 (ja_JP) | français (fr_FR) | čeština (cs_CZ) |
> Español (es_ES) | русский (ru_RU) | Deutsch (de_DE) | 한국어 (ko_KR) |
> italiano (it_IT) | português (pt_PT) | polski (pl_PL) | Nederlands
> (nl_NL) | 中文(繁體) (zh_TW) |
>
> However, look at  http://developer.android.com/reference/java/util/Locale.html
>
> it lacks : polish pl_PL and nl_NL
>
> Now what I'm doing is creating values-fr values-es  directories.  But
> my phone only has english and spanish locales.
>
> Here's two things that would help:
>
> 1. A definitive list of all locale suffixes that are allowable as the
> values-?? directory names
> 2. A way to add more locales to my phone.
>
> --
> You received this message because you are subscribed to the Google
> Groups "Android Developers" group.
> To post to this group, send email to android-developers@googlegroups.com
> To unsubscribe from this group, send email to
> android-developers+unsubscr...@googlegroups.com
> For more options, visit this group 
> athttp://groups.google.com/group/android-developers?hl=en

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to