public
Description: Rails plugin for localized "country_select" helper with Rake task for downloading locales from Unicode.org's CLDR
Homepage: http://www.restafari.org/localized-country-select.html
Clone URL: git://github.com/karmi/localized_country_select.git
scharfie (author)
Thu Oct 15 03:35:49 -0700 2009
karmi (committer)
Thu Oct 15 04:06:39 -0700 2009
commit  99b494e775e62ce01dd478eda1f2cbb40a115430
tree    364e3cc19f970c81fc158ee24026d74da13b681c
parent  ca5ccd1821a5059bb69afe1ad8ba5b03710f34e5
localized_country_select / README.rdoc
e883f2a2 » karmi 2008-10-22 Initial commit 1 = LocalizedCountrySelect
2
3 Rails plugin to provide support for localized <tt><select></tt> menu with country names and for
4 storing country information as country _code_ (eg. 'es'), not _name_ (eg. 'Spain'), in the database.
5
6 Uses the Rails internationalization framework (I18n, http://rails-i18n.org) for translating the names of countries.
71f81bea » karmi 2008-11-22 Add info about required Rai... 7 Requires Rails 2.2 (released November 21st, 2008) or later versions.
e883f2a2 » karmi 2008-10-22 Initial commit 8 Country names are loaded from hashes in plugin directory, according to <tt>I18n.locale</tt> value.
9
10 You can easily translate country codes in your application like this:
11
12 <%= I18n.t @user.country, :scope => 'countries' %>
13
14 Comes with a Rake task <tt>rake import:country_select 'de'</tt> for importing country names
15 from Unicode.org's CLDR repository (http://www.unicode.org/cldr/data/charts/summary/root.html)
16 Don't forget to restart the application when you add new locale.
17
18 ActionView helper code is adapted from Rails' default +country_select+ plugin (previously in core).
19 See http://github.com/rails/country_select/tree/master/lib/country_select.rb
20
21 == Example
22
fdafd695 » karmi 2008-12-09 Fixed wrong method names in... 23 <%= localized_country_select(:user, :country, [], :include_blank => 'Please choose...') %>
e883f2a2 » karmi 2008-10-22 Initial commit 24
25 will become:
26
27 <select name="user[country]" id="user_country">
28 <option value="">Please choose...</option>
29 <option disabled="disabled" value="">-------------</option>
30 <option value="AF">Afghanistan</option>
31 ...
32 <option value="ZW">Zimbabwe</option>
33 </select>
34
c26e1ff1 » karmi 2008-11-21 Change all references from ... 35 for the <tt>en</tt> locale.
e883f2a2 » karmi 2008-10-22 Initial commit 36
37 == Other resources
38
39 * http://github.com/rails/country_select (Default Rails plugin)
40 * http://github.com/russ/country_code_select (Stores country code, not name)
41
42
43 Copyright (c) 2008 Karel Minarik (www.karmi.cz), released under the MIT license