Has_translated_fields is a project mainly written in Ruby, it's free.
Translate your objects in the database
= Has translated fields
Rails 2.3.x plugin extracted from real projects that make I18n a lot less painful.
== Examples
TODO: ActiveRecord class example
TODO: View example
TODO: Metadata example
== How to install
script/plugin install git://github.com/smeevil/has_translated_fields.git
== Assumptions
== Sanitizing I18n.available_locales
We have a config/locales directory structure that looks like this:
The my_project directory is usually named after the project. rails-i18n is a copy of svenfuchs' rails-i18n project's locales files. rails contains ActiveRecord model and attribute names and such. other can be any numer of directories, depending on your use. The convention we use is that the translations available in the my_project directory is what determines the available locales.
Do something like this in config/environment.rb's config block:
used_locales = Dir[Rails.root.join("config", "locales", "my_project", "*.{rb,yml}")].map{|file| File.basename(file).gsub(File.extname(file),"")}.uniq
config.i18n.load_path += Dir[Rails.root.join('config', 'locales', '', '.{rb,yml}')].select{|file| used_locales.include? File.basename(file).gsub(File.extname(file),'')}
config.i18n.default_locale = :nl config.after_initialize do
I18n.available_locales = [I18n.default_locale, I18n.available_locales].flatten.uniq
end
== Credits
== License
MIT LICENSE