Plugins - Localization Simplified
Add to favoritesLocalization Simplified (aka LocalizationSimplified or L10n-simplified)
Localization Simplified plugin for Ruby on Rails. Really simple localization. Written by Jesper Rønn-Jensen ( http://justaddwater.dk/ )
The goal is to have a dead simple plugin for one-language (non-english) Rails applications. Many of the existing localization / internationalization plugins are too big for this and hard to get started with. Just dump this plugin in /vendor/plugins/, set your language and off you go.
Unlike the more advanced plugins, you don’t have to translate anything in your view files. Just use the standard Rails commands you’re used to.
The simple approach also makes limits. Make sure you understand them to decide if this plugin is right for you.
I use this plugin when creating new projects. Then later in the development process I can decide to change to a more advanced localization plugin (if necessary)
What it does
This plugin modifies the following most used helpers for Rails
- Localized monthnames on date_select etc. (changing the order of Y-M-D, on date_select and datetime_select from 0.7)
- Localized ActiveRecord errors (and error headings)
- Localized distance_of_time_in_words
- Localized to_currency (from 0.7 also changing the order of unit/currency)
- Simple pluralization also available in the lang-file
- Uses standard Rails methods. In this way, there is no tedious rewrite required to localize your view files
Limitations
- More advanced features are not likely to be available here.
- If you want support for multiple languages, use another L10N/I18n plugin, like GLoc or Globalize
It could be a good idea to take a look at the [comparison chart](http://wiki.rubyonrails.org/rails/pages/InternationalizationComparison) on the Ruby on Rails wiki
Version notes
- For Rails 1.1.x or below, use version 0.7.1 of this plugin
- For Rails 1.2 or above, use version 0.8 (or higher) of this plugin
Download code
- Project homepage: http://rubyforge.org/projects/l10n-simplified/
- Subversion access: svn checkout svn://rubyforge.org/var/svn/l10n-simplified
- Browse: http://rubyforge.org/plugins/scmsvn/viewcvs.php/?root=l10n-simplified
Usage:
in init.rb, set your language. That’s it. Now your db connection is running UTF-8 and standard Rails output is localized.
If your view files contains text containing non-English characters (such as ß,ö,ñ or å), you probably also want to save your files as UTF-8.
Supported languages
Currently supported languages:
- Czech
- Danish
- Dutch
- English (for running test cases and comparing to normal texts)
- Finnish
- French
- French (Canadian)
- German
- Italian
- Korean
- Norwegian
- Portugese
- Russian
- Serbian
- Spanish
- Spanish (argentinian)
- Swedish
- Swedish Chef, and
- Pirate talk (just for the fun of it)
- any other language you want. Just dump your translation in the /lib folder
Installation:
- Just copy this plugin into your /vendor/plugins/ folder
- Set your language in environment.rb, above "Rails::Initializer.run" L10N_LANG = :es (Danish is default because I am Danish)
- no step three :)
A special note of WARNING: All files here are saved using UTF-8 encoding. It’s not required for working, I guess, but other encodings could bring you in trouble.
Your help
Feel free to use, translate, modify and improve this code. Do send me translations, improvements, etc. I cannot promise to use it, but chances are that I will unless it bloats the code here completely or makes code harder to maintain.
I added FIXME notes in the code to indicate where I also could use help.
TODO / wishlist
- A Rails application for testing L10n-simplified. This is top of my wish-list. I’d like it to contain a test suite testing ActiveRecord errors, datehelper, necessary numberhelper etc.
- Better tests to verify both hooks in Rails and this plugin
- Better tests to verify each lang-file
- Create rdoc not including every lang-file (only lang_en.rb)
- Rake task that modifies all view-files and converts them to UTF-8
- Also a task that modifies all generators to use UTF-8
- Create gem file for easy distribution (and automatic plugin discovery in tools like RadRails)
Latest Release Notes
- — release 0.9 (2008-01-13) —
- Possible to set language in environment.rb: L10N-LANG = :de
- UTF-8 database charset configuration is default in Rails 1.2+ and 2.0, so not needed in plugin more.
- L10n-Simplified plugin also available as gem from this release
- Moved changelog from README to separate file changelog.txt
- Removed duplicate line from lang_de.rb
- Russian translation (thanks Denis Pankratov)
- Corrected German date/time format (thanks Christian W Zuckschwerdt)
- Added Portugese translation (thanks Carlos Afonso)
- Italian translation adjustments (thanks Michele Franzin)
- Fixed translation error in Swedish translation (thanks Ingemar Edsborn)
- Czech translation by Karel Minařík
- French lang file updated (thanks Bruno Michel)
- Added Serbian (thanks Slobodan Kovacevic)
- Lang_it file must be UTF-8 encoded (thanks Fabio Bonelli)
- Added rake task for creating a release "rake package"
- Fixed rake task for generating rdoc in UTF-8 format
- Added Norwegian (thanks Fredrik Bach)
http://rubyforge.org/projects/l10n-simplified/
svn://rubyforge.org/var/svn/l10n-simplified
Rails' (MIT)
Internationalization


gem install l10n-simplified (0.9) does not work ?!
Exelent plug-in, is very esasy to use!
The only problem. it seems that Daynames dont work for me, it always display in english
Regards!