0.0
No commit activity in last 3 years
No release in over 3 years
Wraps and improves ruby-gettext, provides UI for locale selection, maintains user preferences.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Runtime

= 1.93.0
 Project Readme

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