I often find myself writing code that translates language codes from for instance da-DK => da or nb-NO => no or even sometimes nb => no depending on the use of the language code I need to talk to external services. I know that quite a few drupal sites use the xx-XX because they have multiple languages in the same country.

I am wondering if it makes any sense to include these things in this module? Or make another module? There are certainly different use cases to language and country codes, but there might also be advantages?

I can take a shot at some code for it if it makes sense to include in this module :)

Comments

matkeane’s picture

Hi,

I just found this issue while hunting around for solutions to map alpha2 country codes in requests from an external application to the Drupal language codes used on the site, so any functions that would make this kind of thing easier would be a welcome addition in my opinion. I realize it might not be as simple as it first appears (languages don't always map one-to-one to countries), but it would be nice to centralize efforts somewhere so as to avoid re-inventing the wheel each time. Whether this module, or something like locale or i18n, is the best place for it is up to the maintainer, but since this module is the most comprehensive one for country codes (thanks for the very useful resource, by the way!) it might make sense to broaden its scope a little.

mrfelton’s picture

matkeane - Perhaps what you are looking for is http://drupal.org/project/ip2locale ?

matkeane’s picture

Hi, Good tip - I think I skipped over that module as I assumed, from the name, that it only did the IP lookups, but it looks like some of the supporting functions might be very handy for the country-language code conversions - many thanks!

Scyther’s picture

Status: Active » Closed (won't fix)

Maintenance fixes only for this module. So no new features will go into this module.