Last post Mar 04, 2012 07:02 PM by gerrylowry
Mar 04, 2012 06:22 PM|dc2000|LINK
I was wondering if such is possible to automate?
I have a form where I need to let user pick a country. I was thinking to make a drop-down control with the list of countries. The catch is that the web app itself can be localized for a user's language.
Mar 04, 2012 07:02 PM|gerrylowry|LINK
the lingua franca, not just of the internet, but of business in general, is English ... so there are many English resources for country names.
Listed By Continent "
and Territories of the World"
Getting the non English names is a bit more problematic, or perhaps i should say
time consuming. Examples:
Basically, you can likely get everything you require via Google (or your favourite search engine).
The good news is that countries do not change that often.
You could store your country lists in a database and select the list that corresponds to your localization.
Allemagne [French name for Germany]
Deutschland [German name for Germany]
德国 [Chinese name for Germany]
Et cetera. You may find Google Translate useful.
Mar 04, 2012 07:59 PM|gmcgraffin|LINK
See the following for a database free example http://www.aghausman.net/dotnet/Get-Countries-Name-in-Net.html
Also if you want to localize the country names you should use the DisplayName property. You then need to make sure you have the local language packs for which you are supporting.
Mar 04, 2012 08:20 PM|dc2000|LINK
Thanks. The issue here is that the DisplayName property is localized for the language of the NET framework only. So, for instance, if I have French NET installed all names will be only in French.
Mar 04, 2012 08:40 PM|gerrylowry|LINK
if a previous reply to this thread, which may be in moderation if not lost altogether, i suggested a database approach ... however the article
http://www.aghausman.net/dotnet/Get-Countries-Name-in-Net.html suggested by George (gmcgraffin) looks
like an interesting alternative solution when you are dealing with only a single culture.
imho, i think when you want a complete list, you could use this information beforehand to build a "static" database ... then you could let your end user select the language from a drop down list first and based on your end user's selection, you could populate
your country drop down list with appropriated values from your database.