carter / active_translation Goto Github PK
View Code? Open in Web Editor NEWtranslated ActiveRecord columns that can easily be attached and detached
License: MIT License
translated ActiveRecord columns that can easily be attached and detached
License: MIT License
ActiveTranslation ================= ActiveTranslation provides translated ActiveRecord database columns in a manner that's easily attached/detached to a legacy application by maintaining a base translation in the model table as well as alternative translations in a translation table. Requires: Rails 2.2 Usage ======= For all the models you translate you'll need to add a translation table. For a model like Post, you'll have another table called post_translations: class CreatePostTranslations < ActiveRecord::Migration def self.up create_table :post_translations, :force => true do |t| # add a column for all columns you want translated t.string :title t.text :body t.references :post t.string :locale, :limit => 8 end end def self.down drop_table :post_translations end end In your model you'll use the has_translations_for method: class Post < ActiveRecord::Base has_translations_for :title, :body end If I18n.locale is set to I18n.default_locale then it'll use the data in the posts table. Otherwise it'll use the translated data in post_translations. Copyright (c) 2009 Carter Parks, released under the MIT license
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.