Globalize3_translator is a project mainly written in Ruby, based on the MIT license.
Globalize3 auto-translator using Google Translate (or any other backend)
= Globalize3 Translator
== Installation
To install Globalize3 Translator use:
gem install globalize3_translator
== Configuration
If you wish to override default configuration create config/initializers/globalize3.rb
Globalize::Translator.configure do |config|
config.locales = [ :lt, :de ]
# use custom translator backend
config.backend = MyTranslatorBackend
end
== Identifying auto translated data with auto_translated?
Example:
post = Post.new :title => "Dog" post.save! post.reload
post.title.auto_translated?
I18n.locale = :lt
post.title.auto_translated?
== Writing custom backend
Example:
class MyTranslatorBackend < Globalize::Translator::Backends::Abstract
def translate(value, from_locale, to_locale)
# should return translated value
"test #{value}"
end
end
== Migrations
Globalize3 Translator uses extra boolean fields in translations table to track automatic translations (with suffix '_auto_translated').
Globalize3 standard method "create_translation_table!"
automatically adds
If you want to add auto translated fields to existing translations table, you should do it manually in migration.
Example:
add_column :post_translations, :title_auto_translated, :boolean
== Patches, fixes
Please send all patches or fixes as github pull requests. Preferably with tests.
Copyright (c) 2010 Laurynas Butkus, released under the MIT license