Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/geekq/locale_selector

Wraps and improves ruby-gettext, provides UI for locale selection, maintains user preferences.
https://github.com/geekq/locale_selector

Last synced: 7 days ago
JSON representation

Wraps and improves ruby-gettext, provides UI for locale selection, maintains user preferences.

Awesome Lists containing this project

README

        

= locale_selector

locale_selector provides a wrapper around the excellent ruby-gettext gem
http://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): http://locale-selector.rubyforge.org/index.html

locale_selector rubyforge page (releases etc.): http://rubyforge.org/projects/locale-selector

source repository on github: http://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 (http://www.innoq.com/blog/vd)
Copyright:: Vodafone, 2008
License:: MIT license