Translate Columns plugin
Plugin details
Documentation
Install the plugin:
ruby script/plugin install https://ityzen.com/svn/translate_columns/trunk/vendor/plugins/translate_columns/
The idea here is that you forget about the fact your models can be translated and just use the app as normal. Indeed, if you don't set a global locale, you won't even notice the plugin is there.
Here's a really basic example of what we can do on the console.
Loading development environment. >> Locale.global = 'en' # First try default language => "en" >> doc = Document.find(:first) -- output hidden -- >> doc.title => "Sample Document" # title in english >> Locale.global = 'es' # set to other language => "es" >> doc = Document.find(:first) # Reload to avoid caching problems! -- output hidden -- >> doc.title => "Titulo espa?ol" # Title now in spanish >> doc.title_default => "Sample Document" # original field data >> doc.title = "Nuevo Título Espa?ol" => "Nuevo Título Espa?ol" >> doc.save # set the title and save => true >> Locale.global = 'en' => "en" # return to english >> doc = Document.find(:first) -- output hidden -- >> doc.title => "Sample Document"
As can be seen, just by setting the Locale we are able to edit the data without having to worry about the details.
Further Documentation
There is currently no advanced documentation for this plugin.
New documentationEdit plugin | (0 older versions) | Last edited by: hardway, about 1 year ago

