Press Ctrl / CMD + C to copy this to your clipboard.
This post will be reported to the moderators as potential spam to be looked at
I'm developing a multilingual site with a contact us form which has a dropdownlist of all of the countries in the world. I need this list to display the country in the correct language for the site that the user is currently browsing, e.g. French. However, I'd like to be able to set the value (as opposed to the text) of each item to be the English version of the country name. I'm using a .NET user control for the form.
Using a dictionary I can get the localised version of the country name only. I need both the localised version and the English version.
I suppose one solution could be to have a comma-delimited list of country names in English in the Contact Us node for each site, along with their equivalent in the local language for that site. I could then loop over both lists and create the list items using the English name of the country for the list item value, and the localised name of the country for the list item name. I'm NOT using the 1:1 method, so I can have a separate Contact Us node
per language, so one for French, one for Spanish, etc. But this is horrible and error-prone. There must be a better way!
Any bright ideas anyone?
Some more bad ideas I've had :)Create a Countries folder, with each Country node having the English, French, etc, names for the country as attributes. But then what happens when the client wants a new language version of the site?I suppose I could always develop a non-Umbraco solution, e.g. a new table in the database that stores all of the countries with their localized names, and access that via my user control. But the downside is if the client wants to manage the country list, or add a new language.Is there a nice and friendly Umbraco solution to this?
Couldn't you use something like CultureInfo to generate the countries list, it should be able to give you both language specifc and english name.
Thanks for your response. You're right, I think that would work. However, the problem is that the client has a list of countries that I need to support - whereas the code snippet seems to be pulling back country names for all regions installed with the .NET framework (over which I have no control). Ideally I'd like the country list to be managed from within Umbraco, be it in the Content section or in the Dictionary section or wherever.
Or have I missed the point?
I was thinking if you stored the ISO code in which ever way you'd like in umbraco, you could use CultureInfo to get the translated and english name?
I've marked that as the solution as it solves the question I asked. However, it's not going to work for me :) I just had a play with the code and there are some minor issues that slightly mess it up for my requirements.
1. The English names coming back do not match the list that the client uses exactly, e.g. Islamic Republic of Pakistan vs Pakistan
2. The list of countries that comes back is different, e.g. Macedonia is returned from .NET but my client doesn't have that in their list.
I realise that if I store a list of country nodes with LCIDs in Umbraco as you suggest then I could automate the translation of the country names. However, if there are any issues and the client doesn't like using the French translation of "Islamic Republic of Pakistan" rather than the French for "Pakistan", I'm stuffed. So I'm going to use a dictionary to store the country names and translations (and possibly use Warren's Dictionary Translator project to do it initially: http://our.umbraco.org/projects/dictionary-translator-for-umbraco). This way the client is in full control of the country names in all languages. In this situation there is also integration with a 3rd party system so the country names need to be exactly correct.
Cheers for your help!
Doh! Clients, can't live with em =)
Glad you've managed to find a solution never the less.
And glad you've made it to top of the pile! Well deserved.
Haha, cheers David....ooh 1 more ;)
Have you done a dictionary of all countries in different languages ?
Is there a way to export it or to share it to the community?
I found those usefull CSVs that you can import usign CMSImport extension :
is working on a reply...
Write your reply to:
Image will be uploaded when post is submitted