Thanks for the reply. To explain a bit further: the reason I'm trying to get something similar to what the user sees in "Language & input" is, I just consider it unlikely that a device would offer a language that's it's not capable to handle, or that it would *not* offer a language it *can* handle.
It's just a heuristic to decide whether what I'm getting looks plausible. If, for instance, a devices offers two variants of English, French, Italian and Spanish (a single variant each) in its settings but getAvailableLocales() returns just a heap of English variants (like 15 or 20) and two Spanish variants, it doesn't match what I see in settings and thus looks suspicious. That's it - I don't mean to insist that an API must get me a list identical to "Language & input". I'm not sure what the difference between "locale" and "localization" is - I believe I'm using the word "locale" in the sense explained for instance here: http://en.wikipedia.org/wiki/Locale . However, you're right in that I don't actually need full support for a specific locale - being able to render text is good enough (I mean I don't care about currency formatting, collating etc.). On the other hand, I'm not sure if just checking fonts is enough to ensure that. Consider for instance right-to-left languages - fonts might well be available but without specific support in the font/text renderer the result won't be good. Come to think of it, I'm probably looking for a TextView.getAvailableLocales()... On Wed, Jun 12, 2013 at 10:20 AM, Piren <[email protected]> wrote: > I think you're confusing several different things.... the "Language and > Input" list that you're trying to fit isn't the same as the supported > locales ... This is just a list of languages the specific OS interface has > special versions for (i.e, the entire device UI will change). This is > localization, not locale support. > > The list of available locales will be more accurate to what you're trying > to achieve, but it is still not there - some devices can render fonts that > are outside of those available locales. > this is because what really matters in the end is if you have the proper > fonts to render that text. > > I actually dealt with something regarding that a few days ago and i'm even > more confused... the source code for TextView/Paint don't actually tell us > any information on how android gets the available fonts or how it decides > which one to use (it's all in native code apparently) > > But i did find this: > http://www.ulduzsoft.com/2012/01/enumerating-the-fonts-on-android-platform/ > > It might give you what you're looking for if you combine the available > font list with the available locales. > > > On Tuesday, June 11, 2013 7:31:53 PM UTC+3, latimerius wrote: >> >> I understand this is a FAQ but after googling for hours and finding >> nothing but forum questions with no answers and a heap of bad >> (non-functional) advice, I figured I'd ask. >> >> I'd like to allow our users to set a locale independent of the >> system-wide one. To construct the menu of available languages, I figured >> I'd take a list of languages supported by the app and remove the ones not >> supported by the particular device. I wouldn't want to offer a language to >> the user if the device cannot render texts in that language (say due to a >> missing font or code support). >> >> Getting a list of languages device can render turned out surprisingly >> hard though. Following hints from docs and advice from the net, I tried >> >> Locale.getAvailableLocales() >> Resources.getSystem().**getAssets().getLocales() (or >> just getAssets().getLocales() with same result) >> >> none of which gets the expected result (which is something resembling the >> language list in system "Language & Input" settings). Also, there is a >> mention in the docs that subsystems affected by locale settings usually >> offer their own means of getting a list of supported locales which we >> should use in preference to Locale.getAvailableLocales(**). Fair enough >> but I can see no such functions in TextView or Paint which are the >> subsystems I use to draw text. >> >> We can do without app-specific locale settings although they'd be nice to >> have. However, if just out of curiosity, I'm still wondering if it's >> really not possible on Android to get this seemingly fundamental piece of >> information? >> >> -- > -- > You received this message because you are subscribed to the Google > Groups "Android Developers" group. > To post to this group, send email to [email protected] > To unsubscribe from this group, send email to > [email protected] > For more options, visit this group at > http://groups.google.com/group/android-developers?hl=en > --- > You received this message because you are subscribed to the Google Groups > "Android Developers" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > For more options, visit https://groups.google.com/groups/opt_out. > > > -- -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/android-developers?hl=en --- You received this message because you are subscribed to the Google Groups "Android Developers" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/groups/opt_out.

