This repository is private.
All pages are served over SSL and all pushing and pulling is done over SSH.
No one may fork, clone, or view it unless they are added as a member.
Every repository with this icon (
) is private.
Every repository with this icon (
This repository is public.
Anyone may fork, clone, or view it.
Every repository with this icon (
) is public.
Every repository with this icon (
| name | age | message | |
|---|---|---|---|
| |
.gitignore | Sun Jan 04 14:35:18 -0800 2009 | |
| |
MIT-LICENSE | Thu Dec 04 12:34:34 -0800 2008 | |
| |
README.rdoc | Fri Dec 05 03:12:25 -0800 2008 | |
| |
Rakefile | Thu Dec 04 12:34:34 -0800 2008 | |
| |
generators/ | Sun Jan 04 14:35:18 -0800 2009 | |
| |
init.rb | Thu Dec 04 12:34:34 -0800 2008 | |
| |
install.rb | Thu Dec 04 12:34:34 -0800 2008 | |
| |
lib/ | Fri Dec 05 03:12:25 -0800 2008 | |
| |
tasks/ | Thu Dec 04 12:34:34 -0800 2008 | |
| |
test/ | Thu Dec 04 12:34:34 -0800 2008 | |
| |
uninstall.rb | Thu Dec 04 12:34:34 -0800 2008 |
README.rdoc
LocalesSwitch
Following the idea from rails-i18n.org/wiki/pages/available_locales
LocalesSwitch provides a simple way to add locale switching in your application. It extends Controller with *prepend_before_filter :set_locale*
In Controller available methods are:
*set_locale* - set current locale from params, session, current_user.site_language or I18n.default_locale *available_locales* - return a hash of available locales. Key: language code, Value: language name.
Ex: # {"it-IT" => "Italiano", "en-US" => "American English"}
In Helper:
*language_selection* - display locales *locale_identifier* - indicate a params key that must hold a locale code.
Example
<%= language_selection %> # => <a href="?locale=en">American English</a> Spanish
# NOTE: in this sample Spanish is currently selected lang.
<% language_selection do |language_code, language| %>
<%= link_to language, "?#{locale_identifier}=#{language_code}" %><br />
<% end %>
# => <a href="?locale=en">American English</a> "<a href="?locale=sp">Spanish</a>
TODO:
add tests ability to change current_user prefered language and logged_in? identificator
- GitHub Source: github.com/olkeene/locales_switch/
Patches, ideas are always welcome. Copyright © 2008 Zhurbiy Oleg ( Ol.keene ), released under the MIT license







