Every repository with this icon (
Every repository with this icon (
| name | age | message | |
|---|---|---|---|
| |
.gitignore | ||
| |
README.rdoc | ||
| |
README_FOR_RAILS | Tue Aug 12 14:03:13 -0700 2008 | |
| |
Rakefile | Tue Aug 12 14:03:13 -0700 2008 | |
| |
app/ | ||
| |
config/ | ||
| |
db/ | Tue Aug 12 14:03:13 -0700 2008 | |
| |
doc/ | ||
| |
lib/ | ||
| |
log/ | ||
| |
public/ | ||
| |
script/ | Tue Aug 12 14:03:13 -0700 2008 | |
| |
test/ |
Demo application for Rails internalization API
Simple & minimal Rails application to test the new Rails internationalization and localization API
It evolved from following excellent review from Trevor Turk, available at www.almosteffortless.com/2008/07/21/simple-localization-in-rails-22
Tries to set some reasonable pattern to load translation files and set locale either from request domain (.com, .de, etc) or request params.
*Includes translation file* for Czech language so you can easily roll your own Spanish, German, Polish, etc version just by duplicating the file, renaming it and changing the translation strings. After server restart you should see your language in language bar at the top of the page.
Requirements
You have to to run edge Rails for this app to work. Run this command in the app directory:
rake rails:freeze:edge
About setting the locale from the request domain
Usually the most sane approach to setting locale/language version of the application is from the domain: application.com loads English, application.es Spanish. This works best for content heavy websites and search engines love it.
The ApplicationController#extract_locale_from_uri sets locale from the domain. To test this, you have to edit /etc/hosts by inserting lines like:
127.0.0.1 application.com 127.0.0.1 application.cz
Then just load your application as usual at application.cz:3000 or application.com:3000 and you should see the locale being switched
About Rails i18n
See www.rails-i18n.org and get in touch at groups.google.com/group/rails-i18n








