public
Description: Wraps and improves ruby-gettext, provides UI for locale selection, maintains user preferences.
Homepage: http://locale-selector.rubyforge.org/index.html
Clone URL: git://github.com/geekq/locale_selector.git
commit  441a040b4e751ff2087d49370a09fee25515d11b
tree    8102419d4d263e60e87e2477307b7039f9eafeef
parent  d4f1730e26b53191ee5480cdc67b2efa10afe894
name age message
file .gitignore Mon Dec 22 08:19:15 -0800 2008 example translation files [geekq]
file MIT-LICENSE Tue Nov 25 04:19:05 -0800 2008 initial import [geekq]
file README.rdoc Fri Jan 02 04:46:25 -0800 2009 now packagable as gem; gettext related rake tas... [geekq]
file Rakefile Fri Jan 02 08:52:10 -0800 2009 better activerecord parsing; automated tests wi... [geekq]
file TESTING.rdoc Wed Nov 26 05:13:19 -0800 2008 testing documentation; netbeans project [geekq]
directory generators/ Fri Jan 02 08:03:11 -0800 2009 overriding activerecord parser [geekq]
file init.rb Tue Nov 25 04:19:05 -0800 2008 initial import [geekq]
file install.rb Tue Nov 25 06:29:30 -0800 2008 more detailed readme instead of trying to run t... [geekq]
directory lib/ Mon Feb 09 01:15:03 -0800 2009 fixed "uninitialized constant ActiveSupport::In... [geekq]
file locale_selector.gemspec Mon Feb 09 01:15:03 -0800 2009 fixed "uninitialized constant ActiveSupport::In... [geekq]
directory nbproject/ Fri Jan 02 06:34:32 -0800 2009 prepare for gettext:updatepo tests [geekq]
directory rails/ Mon Dec 22 09:22:55 -0800 2008 adjusted the usage instructions [geekq]
directory test/ Mon Feb 09 01:15:03 -0800 2009 fixed "uninitialized constant ActiveSupport::In... [geekq]
file uninstall.rb Tue Nov 25 04:19:05 -0800 2008 initial import [geekq]
README.rdoc

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