Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • David Conlisk 432 posts 1008 karma points
    Jun 03, 2010 @ 13:17
    David Conlisk
    0

    Multilingual site - I need a localized country list that always submits the English value

    Hi all,

    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?

    Thanks,

    David

  • David Conlisk 432 posts 1008 karma points
    Jun 03, 2010 @ 13:41
    David Conlisk
    0

    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?

  • Matt Brailsford 3960 posts 21147 karma points MVP 9x c-trib
    Jun 03, 2010 @ 13:47
    Matt Brailsford
    2

    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.

    http://www.dreamincode.net/code/snippet2879.htm

    Matt

  • David Conlisk 432 posts 1008 karma points
    Jun 03, 2010 @ 15:44
    David Conlisk
    0

    Hi Matt,

    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?

    Cheers,

    David

  • Matt Brailsford 3960 posts 21147 karma points MVP 9x c-trib
    Jun 03, 2010 @ 16:06
    Matt Brailsford
    0

    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?

    Matt

  • David Conlisk 432 posts 1008 karma points
    Jun 03, 2010 @ 16:37
    David Conlisk
    0

    Hi Matt,

    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!

    David

  • Matt Brailsford 3960 posts 21147 karma points MVP 9x c-trib
    Jun 03, 2010 @ 16:46
    Matt Brailsford
    0

    Doh! Clients, can't live with em =)

    Glad you've managed to find a solution never the less.

    Matt

  • David Conlisk 432 posts 1008 karma points
    Jun 03, 2010 @ 17:29
    David Conlisk
    0

    And glad you've made it to top of the pile! Well deserved.

  • Matt Brailsford 3960 posts 21147 karma points MVP 9x c-trib
    Jun 03, 2010 @ 17:35
    Matt Brailsford
    0

    Haha, cheers David....ooh 1 more ;)

  • MrFlo 159 posts 403 karma points
    Nov 18, 2016 @ 11:21
    MrFlo
    0

    Hi David,

    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?

    Edit:

    I found those usefull CSVs that you can import usign CMSImport extension : https://github.com/umpirsky/country-list/tree/master/data

Please Sign in or register to post replies

Write your reply to:

Draft