Skip to content


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
tree: fb6c9d6f61
Fetching contributors…

Cannot retrieve contributors at this time

38 lines (25 sloc) 1.506 kb


Rails plugin to provide support for localized <select> menu with language names and for storing language information as language code (eg. 'sv'), not name (eg. 'Swedish'), in the database.

Uses the Rails internationalization framework (I18n, for translating the names of languages. Requires Rails 2.2 (released November 21st, 2008) or later versions. Language names are loaded from hashes in plugin directory, according to I18n.locale value.

You can easily translate language codes in your application like this:

<%= I18n.t @user.language, :scope => 'languages' %>

Comes with a Rake task rake import:language_select locale=de for importing language names from's CLDR repository ( Don't forget to restart the application when you add new locale.

The code borrows heavily from the LocalizedCountrySelect plugin. See


<%= localized_language_select(:user, :language, [], :include_blank => 'Please choose...') %>

will become:

<select name="user[language]" id="user_language">
<option value="">Please choose...</option>
<option disabled="disabled" value="">-------------</option>
<option value="aa">Afar</option>
<option value="zza">ZaZa</option>

for the en locale.

Copyright © 2009 David Cato, released under the MIT license

Jump to Line
Something went wrong with that request. Please try again.