Every repository with this icon (
Every repository with this icon (
tree 8102419d4d263e60e87e2477307b7039f9eafeef
parent d4f1730e26b53191ee5480cdc67b2efa10afe894
| name | age | message | |
|---|---|---|---|
| |
.gitignore | Mon Dec 22 08:19:15 -0800 2008 | |
| |
MIT-LICENSE | Tue Nov 25 04:19:05 -0800 2008 | |
| |
README.rdoc | Fri Jan 02 04:46:25 -0800 2009 | |
| |
Rakefile | Fri Jan 02 08:52:10 -0800 2009 | |
| |
TESTING.rdoc | Wed Nov 26 05:13:19 -0800 2008 | |
| |
generators/ | Fri Jan 02 08:03:11 -0800 2009 | |
| |
init.rb | Tue Nov 25 04:19:05 -0800 2008 | |
| |
install.rb | Tue Nov 25 06:29:30 -0800 2008 | |
| |
lib/ | Mon Feb 09 01:15:03 -0800 2009 | |
| |
locale_selector.gemspec | Mon Feb 09 01:15:03 -0800 2009 | |
| |
nbproject/ | Fri Jan 02 06:34:32 -0800 2009 | |
| |
rails/ | Mon Dec 22 09:22:55 -0800 2008 | |
| |
test/ | Mon Feb 09 01:15:03 -0800 2009 | |
| |
uninstall.rb | Tue Nov 25 04:19:05 -0800 2008 |
locale_selector
locale_selector provides a wrapper around the excellent ruby-gettext gem www.yotabanana.com/hiki/ruby-gettext.html
Offers a convinient way to specify the list of locales supported by your application. Provides a html UI control for locale selection. Maintains the user preference in a cookie and provides callback for saving the preference e.g. in a database.
Tested with Rails 2.1 and gettext 1.93.
locale_selector home page (rdoc): locale-selector.rubyforge.org/index.html
locale_selector rubyforge page (releases etc.): rubyforge.org/projects/locale-selector
source repository on github: github.com/geekq/locale_selector
Installation
1.Install as a gem with
gem install locale_selector
It also installs the required gettext gem.
2.Append following to the Rakefile of your Rails application to get the gettext related tasks
require 'locale_selector/gettext_tasks'
`rake -T gettext` now offers a couple of new tasks.
3.Reference the gettext in your environment.rb. For Rails 2.1 put following at the top of Rails::Initializer.run block:
config.gem 'gettext', :lib => 'gettext/rails', :version => '1.93'
config.gem 'locale_selector', :version => '1.93'
4.Run the generator to create an initializer with the gettext hacks
script/generate gettext_hacks
5.Please provide the root route in your routes.rb and delete the public/index.html
map.root :controller => "mycontroller"
Usage
Please see LocaleSelector for API documentation and usage examples.
Versioning
The version numbers of locale_selector match the version of the gettext gem it is based on.
Maintaining translations
Please use the provided rake tasks for maintaining translations. Run rake -T gettext to see the list of provided rake tasks.
Most frequently used are
rake gettext:updatepo
to extract the new strings from the application. Note: please make sure, that all the database connections used in your models work. Gettext connects to the database to extract field names to be translated.
rake gettext:makemo
for compiling the binary mo files from po-s.
| Author: | Vladimir Dobriakov (www.innoq.com/blog/vd) |
| Copyright: | Vodafone, 2008 |
| License: | MIT license |







