I've put some work into this module, so here is my try...
(Note: due to the massive number of changes this is the complete package and not a patch.)

Changes:

  • Regions (states/provinces) list:
    • regions_select_for_form() works hand in hand with countries_select_for_form() and provides a list of regions (states/provinces) for a large number of countries of the world.
    • The list is actually provided by geoipregionvars.php from Maxmind LLC, which is not included in the package due to licensing issues. One needs to manually download a copy and place it in the helpers directory. _helpers_get_regions() should probably be made public as well...
    • regions_get_name() gets the human-readable region name from a region code.
    • I've also added a AJAX handler (regions/js/<CC>), so applications can pull the regions list depending on a country selection in real-time.
  • Flags of the world:
    • Added theme_country_flag() to ease the visual theming
    • The download does not include the flag images, since the one I used have an unknown licensing. If someone can provide links to free image packs, please do so.
    • Flag images should be named like the 2-letter ISO country code they correspond to. An additional image named "unset" should be provided to catch missing flags. Images can be PNGs or GIFs, and the file system location can be configured via the new settings dialog.
  • Country list:
    • The country list is now pulled from www.iso.org and can be updated via the new settings dialog.
    • country_get_name() gets the human-readable country name from a country code.
    • _helpers_data_countries_array() has been renamed to _helpers_get_countries(). I've even thought about making it public.
  • Added languages_select_for_form() to complete the triptych.
CommentFileSizeAuthor
helpers-smk.tar.gz12.31 KBsmk-ka

Comments

ymcp’s picture

There is a selection of free flags available at the Open Clip Art Library.

ymcp’s picture

The KDE project also has a good selection of GPL flags in their "localization" project area. You can browse through the online svn repository for a particular flag, or download the entire (20+ Mb) kdebase tar-ball, and extract all the files called "flag.png".

Bèr Kessels’s picture

Status: Needs review » Needs work

This looks extremely usefull to me. However, the tarball looks strange to me and is not in the form of a patch, wich makes it hard for me.

Would it be an idea to move this into a helpers_locales.module or some other name? Where we can stick all the helpers that have to do with flags, countries, states, country iso code etc?

And the patch: please refer to drupal.org/diffandpatch for how to make a patch.
The tarball contains a directory flags wich -as you explain- is empty. I'd rather leave that directory out then all together.

So far nice work, though.

sun’s picture

+1 for modularization
Currencies would also belong in helpers_locale.module.

csc4’s picture

Could this be tied together with the projects location (which seems to be duplicating the region work) and ip2cc (which has extensive regionality and flags at http://ip-to-country.webhosting.info/node/view/91) ?

smk-ka’s picture

Yes, especially as the location module already includes a list of provinces/regions for each country. I'll take a closer look at what's missing from here in the location.module in the near future, and create the proposed location_helper.module. For example, I'm planning to extend either the location or gmap module with a list of average country (and additionally continent) coordinates, which can be used to zoom a country/continent on a Google Map even for anonymous users, using the country code resolved by ip2cc.

I'll leave this issue open until something finally starts moving in that direction.
--
Stefan Kudwien
www.unleashedmind.com

csc4’s picture

That sounds brilliant - especially if you can magic up some UK support too. Thanks, I'll keep watching progress.

Bèr Kessels’s picture

Just a short note to let you all know that I am following this thread with envy: I'd love to see this implemented properly.

coupet’s picture

great start, wish we were further along as originally planned.

nancydru’s picture

Hi, all. We now have an active maintainer to help Bèr; we also now have a 5.x version.

What is the status on these patches or interfaces?

nancydru’s picture

Well, sunyapeng2006, forgot the attachment. And smk-ka promised a location interface, which I don't see yet.

Right now, I'm still trying to get more comfortable with these modules by producing decent documentation (see the link on the project page).

smk-ka’s picture

Well, region and country lists and their associated ui elements certainly better fit in some geo module, or a submodule which handles address storage and display.

Average continent and country coordinates (probably together with a specific zoom value for each entry) should definitively be implemented as part of a geocoding component. With bdragon as the new maintainer of Location we hopefully see that module advance in the right direction so this feature could be added (with country data hard-coded as php arrays this isn't really possible now).

So, the only thing that's left over here is the country flag theme function.

nancydru’s picture

I look forward to seeing that and any patches that come from it.

In case no one has noticed, there is now 6.x support.

giorgio79’s picture

nancydru’s picture

Yes, I have seen that set. However, we still have the debate over which module should be doing this.

nancydru’s picture

Status: Needs work » Closed (won't fix)

When the patches are ready, reopen this issue.