Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
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.
- Host: GitHub
- URL: https://github.com/geekq/locale_selector
- Owner: geekq
- License: mit
- Created: 2008-11-25T11:40:12.000Z (about 16 years ago)
- Default Branch: master
- Last Pushed: 2009-04-02T14:40:48.000Z (almost 16 years ago)
- Last Synced: 2024-10-19T01:16:02.230Z (3 months ago)
- Language: Ruby
- Homepage: http://locale-selector.rubyforge.org/index.html
- Size: 137 KB
- Stars: 3
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.rdoc
- License: MIT-LICENSE
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.htmlOffers 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 tasksrequire '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