1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172
|
= gettext_activerecord
gettext_activerecord provides the localization for ActiveRecord-2.2 or later
using Ruby-GetText-Package.
* Validation messages translation
* Model translation
* extract messages from models with the rake task.
== Website
* homepage[http://www.yotabanana.com/hiki/ruby-gettext.html]
* on rubyforge[http://gettext/rubyforge.org/]
* on github[http://github.com/gettext_activerecord/]
== Requirements
* {Ruby 1.8.3 or later}[http://www.ruby-lang.org]
* {Rubygems}[http://www.rubygems.org/]
* {locale gem}[http://rubyforge.org/projects/locale/]
* $ gem install locale
* {gettext gem}[http://rubyforge.org/projects/gettext/]
* $ gem install gettext
== Install
#Uninstall old gettext if exists.
(sudo/su on POSIX system)
gem uninstall gettext
#from rubyforge
(sudo/su on POSIX system)
gem install locale
gem install gettext_activerecord
== Usage
=== without Rails
==== Rakefile
require 'rubygems'
desc "Create mo files"
task :makemo do
require 'gettext_activerecord/tools'
GetText.create_mofiles
end
task :updatepo do
require 'gettext_activerecord/tools'
# Need to access DB to find Model table/column names.
# Use config/database.yml which is the same style with rails.
GetText.update_pofiles("sample_ar", ["topic.rb"], "sample AR 1.0.0")
end
==== topic.rb
class Topic < ActiveRecord::Base
validates_length_of :title, :minimum => 10
end
==== sample.rb
require 'gettext_activerecord'
require 'topic'
# Use config/database.yml which is the same style with rails.
config = YAML.load(IO.read("config/database.yml"))["development"]
ActiveRecord::Base.establish_connection(config)
GetText.bindtextdomain_to(ActiveRecord, "sample_ar", :path => "locale")
GetText.set_locale "ja_JP.UTF-8"
a = Topic.new
a.title = "Foo"
a.save
puts a.errors.full_messages #puts Japanese error message.
==== Then ...
$ rake updatepo
$ cd po
$ mkdir ja
$ msginit -l ja_JP.UTF-8 -i sample_ar.pot -o ja/sample_ar.po
$ Edit ja/sample_ar.po
$ cd ../../
$ rake makemo
$ ruby sample.rb
=== with Rails
See gettext_rails [http://github.com/mutoh/gettext_rails/tree/master]
== Support matrix
* gettext_activerecord-2.1.0 - rails-2.3.2,2.3.3,2.3.4
* gettext_activerecord-2.0.2 - rails-2.3.2
* gettext_activerecord-2.0.1 - rails-2.3.2
* gettext_activerecord-2.0.0 - rails-2.3.2
== License
This program is licenced under the same licence as Ruby(See COPYING) or
LGPL(Lesser General Public License: http://www.gnu.org/licenses/lgpl-3.0.txt).
* Copyright (C) 2001-2009 Masao Mutoh <mutoh at highwhay.ne.jp>
== Translators
* Bosnian(bs) - Sanjin Sehic <saserr at gmail.com>
* Bulgarian(bg) - Sava Chankov <sava.chankov at gmail.com>
* Catalan(ca) - Ramon Salvadó <rsalvado at gnuine.com>
* Chinese(Simplified)(zh_CN)
* Yang Bob <bob.yang.dev at gmail.com> (current)
* Yingfeng <blogyingfeng at gmail.com>
* Chinese(Traditional)(zh_TW)
* Yang Bob <bob.yang.dev at gmail.com> (current)
* LIN CHUNG-YI <xmarsh at gmail.com>
* Croatian(hr) - Sanjin Sehic <saserr at gmail.com>
* Czech(cs) - Karel Miarka <kajism at yahoo.com>
* Dutch(nl) - Bart ten Brinke <info at retrosync.com> (current)
Menno Jonkers <ruby-gettext at jonkers.com>
* Esperanto(eo) - Malte Milatz <malte at gmx-topmail.de>
* Estonian(et) - Erkki Eilonen <erkki at itech.ee>
* French(fr)
* Vincent Isambart <vincent.isambart at gmail.com> (current)
* David Sulc <davidsulc at gmail.com>
* David Sulc <davidsulc at gmail.com>
* Laurent Sansonetti <laurent.sansonetti at gmail.com>
* German(de)
* Patrick Lenz <patrick at limited-overload.de> (current)
* Detlef Reichl <detlef.reichl at gmx.org>
* Sven Herzberg <herzi at abi02.de>
* Sascha Ebach <se at digitale-wertschoepfung.de>
* Greek(el) - Vassilis Rizopoulos <damphyr at gmx.net>
* Hungarian(hu) - Tamás Tompa <tompata at gmail.com>
* Italian(it)
* Marco Lazzeri <marco.lazzeri at gmail.com>
* Gabriele Renzi <surrender_it at yahoo.it>
* Japanese(ja) - Masao Mutoh <mutomasa at gmail.com>
* Korean(ko) - Gyoung-Yoon Noh <nohmad at gmail.com>
* Latvian(lv) - Aivars Akots <aivars.akots at gmail.com>
* Norwegian(nb) - Runar Ingebrigtsen <runar at mopo.no>
* Portuguese(Brazil)(pt_BR)
* Antonio S. de A. Terceiro <terceiro at softwarelivre.org> (current)
* Joao Pedrosa <joaopedrosa at gmail.com>
* Russian(ru) - Yuri Kozlov <kozlov.y at gmail.com>
* Serbian(sr) - Slobodan Paunović" <slobodan.paunovic at gmail.com>
* Spanish(es)
* David Espada <davinci at escomposlinux.org> (current)
* David Moreno Garza <damog at damog.net>
* Ukrainian(ua) - Alex Rootoff <rootoff at pisem.net>
* Vietnamese(vi) - Ngoc Dao Thanh <ngocdaothanh at gmail.com>
== Status of translations
* Bosnian(bs) - 1.90.0 (old)
* Bulgarian(bg) - 2.0.0
* Catalan(ca) - 2.0.0
* Croatian(hr) - 1.90.0 (old)
* Chinese(zh_CN) - 2.0.0
* Chinese(zh_TW) - 2.0.0
* Czech(cs) - 1.9.0 (old)
* Dutch(nl) - 2.0.2
* English(default) - 1.90.0 (old)
* Esperanto(eo) - 2.0.0
* Estonian(et) - 2.0.0
* French(fr) - 2.0.0
* German(de) - 2.0.0
* Greek(el) - 2.0.0
* Hungarian(hu) - 2.0.0
* Italian(it) - 1.6.0 (old)
* Japanese(ja) - 2.1.0
* Korean(ko) - 1.9.0 (old)
* Latvian(lv) - 2.0.0
* Norwegian(nb) - 2.0.0
* Portuguese(Brazil)(pt_BR) - 2.0.0
* Russian(ru) - 2.0.0
* Serbian(sr) - 1.91.0 (old)
* Spanish(es) - 2.0.0
* Ukrainian(ua) - 2.0.0
* Vietnamese(vi) - 2.0.0
== Maintainer
Masao Mutoh <mutomasa at gmail.com>
|