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
- Host: GitHub
- URL: https://github.com/johnvuko/i18n-dynamic-translation
- Owner: johnvuko
- Created: 2012-11-26T06:11:51.000Z (over 13 years ago)
- Default Branch: master
- Last Pushed: 2012-12-09T04:42:48.000Z (over 13 years ago)
- Last Synced: 2025-01-11T14:15:57.438Z (over 1 year ago)
- Language: Ruby
- Size: 113 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
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 %>