An open API service indexing awesome lists of open source software.

https://github.com/johnvuko/i18n-dynamic-translation

Dynamic translations in model
https://github.com/johnvuko/i18n-dynamic-translation

Last synced: 10 months ago
JSON representation

Dynamic translations in model

Awesome Lists containing this project

README

          

I18n Dynamic Translation
======================

Plugin for have translations in model.
Save the translations in database with gem 'i18n-active_record'.
Very usefull for multilingual site.
You have to use Ruby 1.9.3 due to bug in 1.9.2 MRI.

Installation
------------

Include the gem in your Gemfile:

gem 'i18n-active_record',
:git => 'git://github.com/jonathantribouharet/i18n-active_record.git',
:branch => 'rails-3.2',
:require => 'i18n/active_record'
gem 'i18n-dynamic-translation', :git => 'https://github.com/jonathantribouharet/i18n-dynamic-translation'

Usage
-----

In your model:

class Article < ActiveRecord::Base

dynamic_translation :name

end

In your form:

<%= form_for @article fo |f| %>
<% for locale in I18n.available_locales %>
<%= f.text_field "name_#{locale}_raw"
<% end %>

<%= f.submit %>
<% end %>

In your html:

I18n.locale : <%= @article.name %>
EN : <%= @article.name_en %>
FR : <%= @article.name_fr %>