Home

cimm edited this page Sep 13, 2010 · 3 revisions
Clone this wiki locally

Install

The plugin will be installed in your vendor/plugins folder. Import the needed translations with the provided rake task.

./script/plugin install git://github.com/karmi/localized_country_select.git
rake import:country_select 'de'

From ISO code back to country name

Now that you have a database full with country ISO codes you may want to display them in some way or another, no? It’s kinda silly to show the ISO codes in you views while you have all the translations. Here is a small snippet to convert the ISO code you have in your database back to the i18n’ed country name:

Hash[LocalizedCountrySelect::localized_countries_array].invert["AL"]

Replace “AL” with the ISO code from you database. This will only return Albania in your locale off course…