• Post Reply Bookmark Topic Watch Topic
  • New Topic

Locale methods - Strange Behavior  RSS feed

nico dotti
Ranch Hand
Posts: 124
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Dope! I just figured it out LOL get available locales returns Locales based on country and language, so of course the ones based on language (lowercase) aren't going to have data for the country associated with them. The reason I got confused was I saw data for russia and then I didn't. But actually it was two different locales! (ru and ru_RU)
I'm doing a dump of dates based on the locales provided by the getAvailableLocales method of DateFormat. I loop through and display the country and language for each. What's strange is that for some iterations I don't see the country displayed, and then if I run the program again, I'll see it for that same country! For example here's a bit of the output (notice that there's no 'Turkey'):

If I run this code again, I may actually get the country output the next time through. What would cause this? My fear is that if I used this functionality in real life to fill about a collection of say available locales, and assumed that the elements had certain fields like countryName, countryDisplayName, etc., I would have inaccurate data. What am I missing?

My code:

[ December 05, 2007: Message edited by: nico dotti ]
Don't get me started about those stupid light bulbs.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!