Converting "fr_FR" into "French (France)" in both directions. (Objective-C iPhone)

Posted by Janice on Stack Overflow See other posts from Stack Overflow or by Janice
Published on 2010-05-20T20:09:19Z Indexed on 2010/05/20 20:10 UTC
Read the original article Hit count: 282

I can easily change a short region-code (en_US) into a longer string... but it there an easy way to also move in the other direction?

[displayInEnglish displayNameForKey:NSLocaleIdentifier value:regionCountryCode];

"en_US" becomes "English (United States)".

"English (United States)" becomes "en_US".

I currently store the short region-code in a database.... but when I show some aggregate results... I need to display the longer strings to the user.

Or should I just store the longer strings right in the database... and not even worry about "converting" them later?

I'm trying to show a "dollars total" for each country.

If you were a user... which would you more likely wish to see (for a currency-total list)?

  • A "French" total
  • A "France" total
  • A "French (France)" total
  • A "fr_Fr" total?

© Stack Overflow or respective owner

Related posts about objective-c

Related posts about localization