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.
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.
Germany
Allemagne [French name for Germany]
Deutschland [German name for Germany]
德国 [Chinese name for Germany]
Et cetera. You may find Google Translate useful.
g.
B-) Please help me by completing my school survey about computer programmers on my website. Thank you!!! Gerry Lowry +1 705-429-7550 wasaga beach, ontario, canada
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.
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.
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.
g.
B-) Please help me by completing my school survey about computer programmers on my website. Thank you!!! Gerry Lowry +1 705-429-7550 wasaga beach, ontario, canada
dc2000
Member
68 Points
104 Posts
Get a list of localized country names
Mar 04, 2012 06:22 PM|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.
gerrylowry
All-Star
20513 Points
5712 Posts
Re: Get a list of localized country names
Mar 04, 2012 07:02 PM|LINK
@ dc2000
the lingua franca, not just of the internet, but of business in general, is English ... so there are many English resources for country names.
examples:
https://www.cia.gov/library/publications/the-world-factbook/index.html
http://en.wikipedia.org/wiki/List_of_countries_by_life_expectancy
http://www.worldatlas.com/cntycont.htm "Countries Listed By Continent "
http://www.worldatlas.com/dependtr.htm "Dependencies and Territories of the World"
Getting the non English names is a bit more problematic, or perhaps i should say time consuming. Examples:
http://www.welt-blick.de/staaten-der-erde.html
http://fr.wikipedia.org/wiki/Liste_des_pays_du_monde
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.
Germany
Allemagne [French name for Germany]
Deutschland [German name for Germany]
德国 [Chinese name for Germany]
Et cetera. You may find Google Translate useful.
g.
gmcgraffin
Participant
792 Points
137 Posts
Re: Get a list of localized country names
Mar 04, 2012 07:59 PM|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.
George
Please Mark the post as Answer if it helped
dc2000
Member
68 Points
104 Posts
Re: Get a list of localized country names
Mar 04, 2012 08:20 PM|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.
gerrylowry
All-Star
20513 Points
5712 Posts
Re: Get a list of localized country names
Mar 04, 2012 08:40 PM|LINK
@ dc2000
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.
g.