Skip to content

Instantly share code, notes, and snippets.

@kossnocorp
Created August 18, 2009 21:04
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kossnocorp/169968 to your computer and use it in GitHub Desktop.
Save kossnocorp/169968 to your computer and use it in GitHub Desktop.
select_tag :language,
options_for_select(I18n.available_locales.to_a.map{ |locale| [t('name', :locale => locale), locale] },
I18n.locale.to_sym)
Snippet displays localized language selector. Sample: http://www.picamatic.com/show/2009/08/19/01/32/4780070_106x131.png
The structure of the locales should be lika that:
en:
name: "English"
---
ru:
name: "Русский"
---
hr:
name: "Hrvatska"
Works in Rails 2.3.x
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment