gettext 2.1.0 → 2.2.0
Sign up to get free protection for your applications and to get access to all the features.
- data/README.rdoc +10 -6
- data/Rakefile +15 -66
- data/data/locale/bg/LC_MESSAGES/rgettext.mo +0 -0
- data/data/locale/bs/LC_MESSAGES/rgettext.mo +0 -0
- data/data/locale/ca/LC_MESSAGES/rgettext.mo +0 -0
- data/data/locale/cs/LC_MESSAGES/rgettext.mo +0 -0
- data/data/locale/de/LC_MESSAGES/rgettext.mo +0 -0
- data/data/locale/el/LC_MESSAGES/rgettext.mo +0 -0
- data/data/locale/eo/LC_MESSAGES/rgettext.mo +0 -0
- data/data/locale/es/LC_MESSAGES/rgettext.mo +0 -0
- data/data/locale/et/LC_MESSAGES/rgettext.mo +0 -0
- data/data/locale/fr/LC_MESSAGES/rgettext.mo +0 -0
- data/data/locale/hr/LC_MESSAGES/rgettext.mo +0 -0
- data/data/locale/hu/LC_MESSAGES/rgettext.mo +0 -0
- data/data/locale/it/LC_MESSAGES/rgettext.mo +0 -0
- data/data/locale/ja/LC_MESSAGES/rgettext.mo +0 -0
- data/data/locale/ko/LC_MESSAGES/rgettext.mo +0 -0
- data/data/locale/lv/LC_MESSAGES/rgettext.mo +0 -0
- data/data/locale/nb/LC_MESSAGES/rgettext.mo +0 -0
- data/data/locale/nl/LC_MESSAGES/rgettext.mo +0 -0
- data/data/locale/pt_BR/LC_MESSAGES/rgettext.mo +0 -0
- data/data/locale/ru/LC_MESSAGES/rgettext.mo +0 -0
- data/data/locale/sr/LC_MESSAGES/rgettext.mo +0 -0
- data/data/locale/sv/LC_MESSAGES/rgettext.mo +0 -0
- data/data/locale/uk/LC_MESSAGES/rgettext.mo +0 -0
- data/data/locale/vi/LC_MESSAGES/rgettext.mo +0 -0
- data/data/locale/zh/LC_MESSAGES/rgettext.mo +0 -0
- data/data/locale/zh_TW/LC_MESSAGES/rgettext.mo +0 -0
- data/doc/text/news.md +30 -0
- data/gettext.gemspec +26 -34
- data/lib/gettext.rb +26 -24
- data/lib/gettext/cgi.rb +2 -0
- data/lib/gettext/core_ext/iconv.rb +7 -7
- data/lib/gettext/core_ext/string.rb +8 -6
- data/lib/gettext/parser/erb.rb +2 -0
- data/lib/gettext/parser/glade.rb +2 -0
- data/lib/gettext/parser/ruby.rb +12 -12
- data/lib/gettext/runtime/class_info.rb +5 -3
- data/lib/gettext/runtime/locale_path.rb +20 -22
- data/lib/gettext/runtime/mofile.rb +45 -18
- data/lib/gettext/runtime/textdomain.rb +6 -4
- data/lib/gettext/runtime/textdomain_group.rb +3 -1
- data/lib/gettext/runtime/textdomain_manager.rb +29 -26
- data/lib/gettext/tools.rb +15 -13
- data/lib/gettext/tools/parser/erb.rb +5 -3
- data/lib/gettext/tools/parser/glade.rb +16 -14
- data/lib/gettext/tools/parser/ruby.rb +16 -16
- data/lib/gettext/tools/pomessage.rb +9 -7
- data/lib/gettext/tools/poparser.rb +38 -36
- data/lib/gettext/tools/rgettext.rb +38 -13
- data/lib/gettext/tools/rmsgfmt.rb +7 -5
- data/lib/gettext/tools/rmsgmerge.rb +116 -114
- data/lib/gettext/utils.rb +2 -0
- data/lib/gettext/version.rb +3 -3
- data/po/bg/rgettext.po +17 -12
- data/po/bs/rgettext.po +16 -12
- data/po/ca/rgettext.po +17 -12
- data/po/cs/rgettext.po +16 -12
- data/po/de/rgettext.po +17 -12
- data/po/el/rgettext.po +17 -12
- data/po/eo/rgettext.po +17 -12
- data/po/es/rgettext.po +17 -12
- data/po/et/rgettext.po +17 -12
- data/po/fr/rgettext.po +17 -12
- data/po/hr/rgettext.po +19 -15
- data/po/hu/rgettext.po +17 -12
- data/po/it/rgettext.po +16 -12
- data/po/ja/rgettext.po +21 -15
- data/po/ko/rgettext.po +16 -12
- data/po/lv/rgettext.po +17 -12
- data/po/nb/rgettext.po +17 -12
- data/po/nl/rgettext.po +16 -12
- data/po/pt_BR/rgettext.po +17 -12
- data/po/rgettext.pot +16 -12
- data/po/ru/rgettext.po +17 -12
- data/po/sr/rgettext.po +17 -12
- data/po/sv/rgettext.po +16 -12
- data/po/{ua → uk}/rgettext.po +17 -12
- data/po/vi/rgettext.po +17 -12
- data/po/zh/rgettext.po +17 -12
- data/po/zh_TW/rgettext.po +17 -12
- data/samples/cgi/hellolib.rb +1 -1
- data/samples/cgi/http.rb +5 -5
- data/samples/cgi/locale/{ua → uk}/LC_MESSAGES/helloerb1.mo +0 -0
- data/samples/cgi/locale/{ua → uk}/LC_MESSAGES/helloerb2.mo +0 -0
- data/samples/cgi/locale/{ua → uk}/LC_MESSAGES/hellolib.mo +0 -0
- data/samples/cgi/locale/{ua → uk}/LC_MESSAGES/main.mo +0 -0
- data/samples/cgi/po/{ua → uk}/helloerb1.po +0 -0
- data/samples/cgi/po/{ua → uk}/helloerb2.po +0 -0
- data/samples/cgi/po/{ua → uk}/hellolib.po +0 -0
- data/samples/cgi/po/{ua → uk}/main.po +0 -0
- data/samples/hello.rb +1 -1
- data/samples/hello_gtk2.rb +1 -1
- data/samples/hello_noop.rb +1 -1
- data/samples/locale/{ua → uk}/LC_MESSAGES/hello.mo +0 -0
- data/samples/locale/{ua → uk}/LC_MESSAGES/hello2.mo +0 -0
- data/samples/locale/{ua → uk}/LC_MESSAGES/hello_glade2.mo +0 -0
- data/samples/locale/{ua → uk}/LC_MESSAGES/hello_gtk.mo +0 -0
- data/samples/locale/{ua → uk}/LC_MESSAGES/hello_noop.mo +0 -0
- data/samples/locale/{ua → uk}/LC_MESSAGES/hello_plural.mo +0 -0
- data/samples/locale/{ua → uk}/LC_MESSAGES/hello_tk.mo +0 -0
- data/samples/makemo.rb +2 -0
- data/samples/po/test.rb +2 -0
- data/samples/po/{ua → uk}/hello.po +0 -0
- data/samples/po/{ua → uk}/hello2.po +0 -0
- data/samples/po/{ua → uk}/hello_glade2.po +0 -0
- data/samples/po/{ua → uk}/hello_gtk.po +0 -0
- data/samples/po/{ua → uk}/hello_noop.po +0 -0
- data/samples/po/{ua → uk}/hello_plural.po +0 -0
- data/samples/po/{ua → uk}/hello_tk.po +0 -0
- data/test/Rakefile +1 -1
- data/test/test_class_info.rb +5 -0
- data/test/test_gettext.rb +12 -1
- data/test/test_locale_path.rb +29 -3
- data/test/test_parser.rb +61 -59
- data/test/test_po_generation.rb +3 -1
- data/test/test_pomessage.rb +4 -2
- data/test/test_string.rb +2 -0
- data/test/test_textdomain_bind.rb +2 -0
- data/test/test_textdomain_multi.rb +2 -0
- data/test/test_textdomain_toplevel.rb +2 -0
- data/test/test_thread.rb +4 -2
- data/test/testlib/N_.rb +5 -3
- data/test/testlib/gettext.rb +4 -2
- data/test/testlib/helper.rb +2 -0
- data/test/testlib/multi_textdomain.rb +2 -0
- data/test/testlib/ngettext.rb +10 -8
- data/test/testlib/npgettext.rb +9 -7
- data/test/testlib/nsgettext.rb +4 -2
- data/test/testlib/pgettext.rb +4 -2
- data/test/testlib/sgettext.rb +4 -2
- data/test/testlib/simple.rb +2 -0
- data/test/tools/files/simple_translation.rb +3 -1
- data/test/tools/test_tools.rb +3 -1
- metadata +772 -737
- data/ChangeLog +0 -78
- data/ChangeLog-1 +0 -2016
- data/NEWS-1 +0 -414
- data/benchmark/1.93.0.txt +0 -8
- data/benchmark/2.0.0.txt +0 -8
- data/benchmark/2.0.4.txt +0 -11
- data/benchmark/2.1.0.txt +0 -11
- data/benchmark/benchmark.rb +0 -68
- data/benchmark/test.rb +0 -28
- data/data/locale/ua/LC_MESSAGES/rgettext.mo +0 -0
- data/replace.rb +0 -8
- data/samples/cgi/po/bg/#main.po# +0 -84
- data/test.rb +0 -33
data/README.rdoc
CHANGED
@@ -15,9 +15,8 @@ Rails support has been removed.
|
|
15
15
|
Rails / ActiveRecord specific code now lives in locale_rails[http://github.com/mutoh/locale_rails/tree/master], gettext_rails[http://github.com/mutoh/gettext_rails/tree/master] and gettext_activerecord[http://github.com/mutoh/gettext_activerecord/tree/master].
|
16
16
|
|
17
17
|
== Website
|
18
|
-
* homepage[http://
|
19
|
-
* on
|
20
|
-
* on github[http://github.com/gettext/]
|
18
|
+
* homepage[http://ruby-gettext.github.com/]
|
19
|
+
* on github[http://github.com/ruby-gettext/gettext]
|
21
20
|
|
22
21
|
== Features
|
23
22
|
* Translate singular/plural messages with simple APIs(similar to GNU gettext)
|
@@ -209,7 +208,7 @@ LGPL(Lesser General Public License: http://www.gnu.org/licenses/lgpl-3.0.txt).
|
|
209
208
|
* David Espada <davinci at escomposlinux.org> (current)
|
210
209
|
* David Moreno Garza <damog at damog.net>
|
211
210
|
* Swedish(sv) - Nikolai Weibull <mailing-lists.ruby-talk at rawuncut.elitemail.org>
|
212
|
-
* Ukrainian(
|
211
|
+
* Ukrainian(uk) - Alex Rootoff <rootoff at pisem.net>
|
213
212
|
* Vietnamese(vi) - Ngoc Dao Thanh <ngocdaothanh at gmail.com>
|
214
213
|
|
215
214
|
== Status of translations
|
@@ -238,8 +237,13 @@ LGPL(Lesser General Public License: http://www.gnu.org/licenses/lgpl-3.0.txt).
|
|
238
237
|
* Serbian(sr) - 2.0.1
|
239
238
|
* Spanish(es) - 2.0.1
|
240
239
|
* Swedish(sv) - 0.8.0 (too much old)
|
241
|
-
* Ukrainian(
|
240
|
+
* Ukrainian(uk) - 2.0.1
|
242
241
|
* Vietnamese(vi) - 2.0.1
|
243
242
|
|
244
243
|
== Maintainer
|
245
|
-
|
244
|
+
|
245
|
+
* Kouhei Sutou <tt><kou@clear-code.com></tt>
|
246
|
+
|
247
|
+
=== Old maintainer
|
248
|
+
|
249
|
+
* Masao Mutoh <mutomasa at gmail.com>
|
data/Rakefile
CHANGED
@@ -1,3 +1,4 @@
|
|
1
|
+
# -*- ruby -*-
|
1
2
|
#
|
2
3
|
# Rakefile for Ruby-GetText-Package
|
3
4
|
#
|
@@ -7,19 +8,27 @@
|
|
7
8
|
# You don't need to use this file directly.
|
8
9
|
#
|
9
10
|
# Copyright(c) 2005-2009 Masao Mutoh
|
11
|
+
# Copyright(c) 2012 Kouhei Sutou <kou@clear-code.com>
|
10
12
|
# This program is licenced under the same licence as Ruby.
|
11
13
|
#
|
12
14
|
|
13
15
|
$:.unshift "./lib"
|
14
16
|
|
15
|
-
require 'rubygems'
|
16
17
|
require 'rake'
|
17
|
-
require '
|
18
|
-
require
|
19
|
-
require 'rake/rdoctask'
|
18
|
+
require 'rubygems'
|
19
|
+
require "yard/rake/yardoc_task"
|
20
20
|
require 'rake/testtask'
|
21
21
|
require 'gettext/version'
|
22
22
|
|
23
|
+
require "bundler/gem_helper"
|
24
|
+
class Bundler::GemHelper
|
25
|
+
undef_method :version_tag
|
26
|
+
def version_tag
|
27
|
+
version
|
28
|
+
end
|
29
|
+
end
|
30
|
+
Bundler::GemHelper.install_tasks
|
31
|
+
|
23
32
|
PKG_VERSION = GetText::VERSION
|
24
33
|
|
25
34
|
############################################################
|
@@ -150,42 +159,6 @@ task :deploypo do
|
|
150
159
|
mv_pofiles(srcdir, "samples/po", lang)
|
151
160
|
end
|
152
161
|
|
153
|
-
############################################################
|
154
|
-
# Package tasks
|
155
|
-
############################################################
|
156
|
-
desc "Create gem and tar.gz"
|
157
|
-
spec = Gem::Specification.new do |s|
|
158
|
-
s.name = 'gettext'
|
159
|
-
s.version = PKG_VERSION
|
160
|
-
s.summary = 'Ruby-GetText-Package is a libary and tools to localize messages.'
|
161
|
-
s.author = 'Masao Mutoh'
|
162
|
-
s.email = 'mutomasa at gmail.com'
|
163
|
-
s.homepage = 'http://gettext.rubyforge.org/'
|
164
|
-
s.rubyforge_project = "gettext"
|
165
|
-
s.files = FileList['**/*'].to_a.select{|v| v !~ /pkg|CVS/}
|
166
|
-
s.require_path = 'lib'
|
167
|
-
s.executables = Dir.entries('bin').delete_if {|item| /^\.|CVS|~$/ =~ item }
|
168
|
-
s.bindir = 'bin'
|
169
|
-
s.add_dependency('locale', '>= 2.0.5')
|
170
|
-
s.has_rdoc = true
|
171
|
-
s.description = <<-EOF
|
172
|
-
Ruby-GetText-Package is a GNU GetText-like program for Ruby.
|
173
|
-
The catalog file(po-file) is same format with GNU GetText.
|
174
|
-
So you can use GNU GetText tools for maintaining.
|
175
|
-
EOF
|
176
|
-
end
|
177
|
-
|
178
|
-
Rake::PackageTask.new("ruby-gettext-package", PKG_VERSION) do |o|
|
179
|
-
o.package_files = FileList['**/*'].to_a.select{|v| v !~ /pkg|CVS/}
|
180
|
-
o.need_tar_gz = true
|
181
|
-
o.need_zip = false
|
182
|
-
end
|
183
|
-
|
184
|
-
Rake::GemPackageTask.new(spec) do |p|
|
185
|
-
p.gem_spec = spec
|
186
|
-
p.need_tar_gz = false
|
187
|
-
p.need_zip = false
|
188
|
-
end
|
189
162
|
|
190
163
|
task :package => [:makemo]
|
191
164
|
|
@@ -198,36 +171,12 @@ task :test do
|
|
198
171
|
if RUBY_PLATFORM =~ /win32/
|
199
172
|
sh "rake.bat", "test"
|
200
173
|
else
|
201
|
-
|
174
|
+
ruby "-S", "rake", "test"
|
202
175
|
end
|
203
176
|
end
|
204
177
|
end
|
205
178
|
|
206
|
-
Rake::
|
207
|
-
begin
|
208
|
-
allison = `allison --path`.chop
|
209
|
-
rescue
|
210
|
-
allison = ''
|
211
|
-
end
|
212
|
-
rdoc.rdoc_dir = 'doc'
|
213
|
-
rdoc.title = "Ruby-GetText-Package API Reference"
|
214
|
-
rdoc.options << '--line-numbers' << '--inline-source'
|
215
|
-
rdoc.rdoc_files.include('README.rdoc', 'ChangeLog')
|
216
|
-
rdoc.rdoc_files.include('lib/**/*.rb')
|
217
|
-
rdoc.template = allison if allison.size > 0
|
218
|
-
}
|
219
|
-
|
220
|
-
desc "Publish the release files to RubyForge."
|
221
|
-
task :release => [ :package ] do
|
222
|
-
require 'rubyforge'
|
223
|
-
|
224
|
-
rubyforge = RubyForge.new
|
225
|
-
rubyforge.configure
|
226
|
-
rubyforge.login
|
227
|
-
rubyforge.add_release("gettext", "gettext",
|
228
|
-
"Ruby-GetText-Package #{PKG_VERSION}",
|
229
|
-
"pkg/gettext-#{PKG_VERSION}.gem",
|
230
|
-
"pkg/ruby-gettext-package-#{PKG_VERSION}.tar.gz")
|
179
|
+
YARD::Rake::YardocTask.new do |t|
|
231
180
|
end
|
232
181
|
|
233
182
|
desc "Setup Ruby-GetText-Package. (for setup.rb)"
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
data/doc/text/news.md
ADDED
@@ -0,0 +1,30 @@
|
|
1
|
+
# News
|
2
|
+
|
3
|
+
## <a id="2-2-0">2.2.0</a>: 2012-03-11
|
4
|
+
|
5
|
+
Ruby 1.9 support release.
|
6
|
+
|
7
|
+
### Improvements
|
8
|
+
|
9
|
+
* Supported ruby-1.9. [Patch by hallelujah]
|
10
|
+
* Supported $SAFE=1. [Patch by bon]
|
11
|
+
* Improved argument check. [Suggested by Morus Walter]
|
12
|
+
* Supported ruby-1.8.6 again. [Bug#27447] [Reported by Mamoru Tasaka]
|
13
|
+
|
14
|
+
### Fixes
|
15
|
+
|
16
|
+
* Fixed Ukrainan translation path. [Bug#28277] [Reported by Gunnar Wolf]
|
17
|
+
* Fixed a bug that only the last path in GETTEXT_PATH environment
|
18
|
+
variable is used. [Bug#28345] [Reported by Ivan Pirlik]
|
19
|
+
* Fixed a bug that Ruby-GetText-Package modifies $LOAD_PATH. [Bug#28094]
|
20
|
+
[Reported by Tatsuki Sugiura]
|
21
|
+
|
22
|
+
### Thanks
|
23
|
+
|
24
|
+
* hallelujah
|
25
|
+
* bon
|
26
|
+
* Morus Walter
|
27
|
+
* Mamoru Tasaka
|
28
|
+
* Gunnar Wolf
|
29
|
+
* Ivan Pirlik
|
30
|
+
* Tatsuki Sugiura
|
data/gettext.gemspec
CHANGED
@@ -1,40 +1,32 @@
|
|
1
|
-
# -*-
|
1
|
+
# -*- mode: ruby; coding: utf-8 -*-
|
2
2
|
|
3
|
-
|
4
|
-
|
5
|
-
|
3
|
+
base_dir = File.dirname(__FILE__)
|
4
|
+
$LOAD_PATH.unshift(File.join(base_dir, "lib"))
|
5
|
+
require "gettext/version"
|
6
6
|
|
7
|
-
|
8
|
-
s.
|
9
|
-
s.
|
10
|
-
s.
|
11
|
-
s.
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
"po/el/rgettext.po", "po/bs/rgettext.po", "po/et/rgettext.po", "po/vi/rgettext.po", "po/pt_BR/rgettext.po", "po/nb/rgettext.po", "po/ko/rgettext.po", "po/lv/rgettext.po", "po/ru/rgettext.po", "po/zh_TW/rgettext.po", "po/rgettext.pot", "po/ca/rgettext.po", "po/de/rgettext.po", "po/de/#rails.po#", "po/es/rgettext.po", "po/eo/rgettext.po", "po/nl/rgettext.po", "po/sr/rgettext.po", "po/hu/rgettext.po", "po/zh/rgettext.po", "po/ja/rgettext.po", "po/ja/rails.po.old", "po/bg/rgettext.po", "po/ua/rgettext.po", "po/fr/rgettext.po", "po/sv/rgettext.po", "po/it/rgettext.po", "lib/gettext.rb", "lib/gettext/cgi.rb", "lib/gettext/utils.rb", "lib/gettext/class_info.rb", "lib/gettext/tools.rb", "lib/gettext/core_ext/iconv.rb", "lib/gettext/core_ext/string.rb", "lib/gettext/poparser.rb", "lib/gettext/version.rb", "lib/gettext/mofile.rb", "lib/gettext/parser/glade.rb", "lib/gettext/parser/erb.rb", "lib/gettext/parser/ruby.rb", "lib/gettext/textdomain.rb", "lib/gettext/textdomain_manager.rb", "lib/gettext/tools/rgettext.rb", "lib/gettext/tools/rmsgmerge.rb", "lib/gettext/tools/rmsgfmt.rb", "test/test_textdomain.rb", "test/po/po/plural.po", "test/po/cr/plural.po", "test/po/sl/plural.po", "test/po/li/plural.po", "test/po/ir/plural.po", "test/po/ja/sgettext.po", "test/po/ja/test2.po", "test/po/ja/pgettext.po", "test/po/ja/test1.po", "test/po/ja/nsgettext.po", "test/po/ja/plural_error.po", "test/po/ja/plural.po", "test/po/ja/test6.po", "test/po/ja/rubyparser.po", "test/po/ja/npgettext.po", "test/po/fr/test2.po", "test/po/fr/test1.po", "test/po/fr/plural_error.po", "test/po/fr/plural.po", "test/po/fr/test6.po", "test/po/la/plural_error.po", "test/po/la/plural.po", "test/po/da/plural_error.po", "test/po/da/plural.po", "test/test_textdomain_toplevel.rb", "test/test_gettext.rb", "test/test_parser.rb", "test/README", "test/test_string.rb", "test/Rakefile", "test/test_class_info.rb", "test/test_textdomain_multi.rb", "test/testlib/simple.rb", "test/testlib/gettext.rb", "test/testlib/gladeparser.glade", "test/testlib/npgettext.rb", "test/testlib/multi_textdomain.rb", "test/testlib/erb.rhtml", "test/testlib/nsgettext.rb", "test/testlib/erb.rxml", "test/testlib/pgettext.rb", "test/testlib/helper.rb", "test/testlib/N_.rb", "test/testlib/ngettext.rb", "test/testlib/sgettext.rb", "bin/rgettext", "bin/rmsgmerge", "bin/rmsgfmt", "Rakefile", "README.rdoc", "ChangeLog", "src/poparser.ry", "samples/cgi/po/hr/main.po", "samples/cgi/po/hr/hellolib.po", "samples/cgi/po/hr/helloerb1.po", "samples/cgi/po/hr/helloerb2.po", "samples/cgi/po/cs/main.po", "samples/cgi/po/cs/hellolib.po", "samples/cgi/po/cs/helloerb1.po", "samples/cgi/po/cs/helloerb2.po", "samples/cgi/po/hellolib.pot", "samples/cgi/po/el/main.po", "samples/cgi/po/el/hellolib.po", "samples/cgi/po/el/helloerb1.po", "samples/cgi/po/el/helloerb2.po", "samples/cgi/po/bs/main.po", "samples/cgi/po/bs/hellolib.po", "samples/cgi/po/bs/helloerb1.po", "samples/cgi/po/bs/helloerb2.po", "samples/cgi/po/vi/main.po", "samples/cgi/po/vi/hellolib.po", "samples/cgi/po/vi/helloerb1.po", "samples/cgi/po/vi/helloerb2.po", "samples/cgi/po/pt_BR/main.po", "samples/cgi/po/pt_BR/hellolib.po", "samples/cgi/po/pt_BR/helloerb1.po", "samples/cgi/po/pt_BR/helloerb2.po", "samples/cgi/po/nb/main.po", "samples/cgi/po/nb/hellolib.po", "samples/cgi/po/nb/helloerb1.po", "samples/cgi/po/nb/helloerb2.po", "samples/cgi/po/ko/main.po", "samples/cgi/po/ko/hellolib.po", "samples/cgi/po/ko/helloerb1.po", "samples/cgi/po/ko/helloerb2.po", "samples/cgi/po/lv/main.po", "samples/cgi/po/lv/hellolib.po", "samples/cgi/po/lv/helloerb1.po", "samples/cgi/po/lv/helloerb2.po", "samples/cgi/po/ru/main.po", "samples/cgi/po/ru/hellolib.po", "samples/cgi/po/ru/helloerb1.po", "samples/cgi/po/ru/helloerb2.po", "samples/cgi/po/zh_TW/main.po", "samples/cgi/po/zh_TW/hellolib.po", "samples/cgi/po/zh_TW/helloerb1.po", "samples/cgi/po/zh_TW/helloerb2.po", "samples/cgi/po/ca/main.po", "samples/cgi/po/ca/hellolib.po", "samples/cgi/po/ca/helloerb1.po", "samples/cgi/po/ca/helloerb2.po", "samples/cgi/po/de/main.po", "samples/cgi/po/de/hellolib.po", "samples/cgi/po/de/helloerb1.po", "samples/cgi/po/de/helloerb2.po", "samples/cgi/po/es/main.po", "samples/cgi/po/es/hellolib.po", "samples/cgi/po/es/helloerb1.po", "samples/cgi/po/es/helloerb2.po", "samples/cgi/po/eo/main.po", "samples/cgi/po/eo/hellolib.po", "samples/cgi/po/eo/helloerb1.po", "samples/cgi/po/eo/helloerb2.po", "samples/cgi/po/nl/main.po", "samples/cgi/po/nl/hellolib.po", "samples/cgi/po/nl/helloerb1.po", "samples/cgi/po/nl/helloerb2.po", "samples/cgi/po/sr/main.po", "samples/cgi/po/sr/hellolib.po", "samples/cgi/po/sr/helloerb1.po", "samples/cgi/po/sr/helloerb2.po", "samples/cgi/po/hu/main.po", "samples/cgi/po/hu/hellolib.po", "samples/cgi/po/hu/helloerb1.po", "samples/cgi/po/hu/helloerb2.po", "samples/cgi/po/helloerb1.pot", "samples/cgi/po/helloerb2.pot", "samples/cgi/po/zh/main.po", "samples/cgi/po/zh/hellolib.po", "samples/cgi/po/zh/helloerb1.po", "samples/cgi/po/zh/helloerb2.po", "samples/cgi/po/ja/main.po", "samples/cgi/po/ja/hellolib.po", "samples/cgi/po/ja/helloerb1.po", "samples/cgi/po/ja/helloerb2.po", "samples/cgi/po/bg/main.po", "samples/cgi/po/bg/hellolib.po", "samples/cgi/po/bg/helloerb1.po", "samples/cgi/po/bg/helloerb2.po", "samples/cgi/po/main.pot", "samples/cgi/po/ua/main.po", "samples/cgi/po/ua/hellolib.po", "samples/cgi/po/ua/helloerb1.po", "samples/cgi/po/ua/helloerb2.po", "samples/cgi/po/fr/main.po", "samples/cgi/po/fr/hellolib.po", "samples/cgi/po/fr/helloerb1.po", "samples/cgi/po/fr/helloerb2.po", "samples/cgi/po/it/main.po", "samples/cgi/po/it/hellolib.po", "samples/cgi/po/it/helloerb1.po", "samples/cgi/po/it/helloerb2.po", "samples/cgi/hellolib.rb", "samples/cgi/helloerb1.cgi", "samples/cgi/cookie.cgi", "samples/cgi/README", "samples/cgi/other.rhtml", "samples/cgi/Rakefile", "samples/cgi/gettext.css", "samples/cgi/helloerb2.cgi", "samples/cgi/http.rb", "samples/cgi/helloerb.rhtml", "samples/cgi/index.cgi", "samples/po/hello_plural.pot", "samples/po/hr/hello_glade2.po", "samples/po/hr/hello_plural.po", "samples/po/hr/hello_noop.po", "samples/po/hr/hello.po", "samples/po/hr/hello2.po", "samples/po/hr/hello_tk.po", "samples/po/hr/hello_gtk.po", "samples/po/cs/hello_glade2.po", "samples/po/cs/hello_plural.po", "samples/po/cs/hello_noop.po", "samples/po/cs/hello.po", "samples/po/cs/hello2.po", "samples/po/cs/hello_tk.po", "samples/po/cs/hello_gtk.po", "samples/po/el/hello_glade2.po", "samples/po/el/hello_plural.po", "samples/po/el/hello_noop.po", "samples/po/el/hello.po", "samples/po/el/hello2.po", "samples/po/el/hello_tk.po", "samples/po/el/hello_gtk.po", "samples/po/bs/hello_glade2.po", "samples/po/bs/hello_plural.po", "samples/po/bs/hello_noop.po", "samples/po/bs/hello.po", "samples/po/bs/hello2.po", "samples/po/bs/hello_tk.po", "samples/po/bs/hello_gtk.po", "samples/po/vi/hello_glade2.po", "samples/po/vi/hello_plural.po", "samples/po/vi/hello_noop.po", "samples/po/vi/hello.po", "samples/po/vi/hello2.po", "samples/po/vi/hello_tk.po", "samples/po/vi/hello_gtk.po", "samples/po/pt_BR/hello_glade2.po", "samples/po/pt_BR/hello_plural.po", "samples/po/pt_BR/hello_noop.po", "samples/po/pt_BR/hello.po", "samples/po/pt_BR/hello2.po", "samples/po/pt_BR/hello_tk.po", "samples/po/pt_BR/hello_gtk.po", "samples/po/nb/hello_glade2.po", "samples/po/nb/hello_plural.po", "samples/po/nb/hello_noop.po", "samples/po/nb/hello.po", "samples/po/nb/hello2.po", "samples/po/nb/hello_tk.po", "samples/po/nb/hello_gtk.po", "samples/po/hello_noop.pot", "samples/po/ko/hello_glade2.po", "samples/po/ko/hello_plural.po", "samples/po/ko/hello_noop.po", "samples/po/ko/hello.po", "samples/po/ko/hello2.po", "samples/po/ko/hello_tk.po", "samples/po/ko/hello_gtk.po", "samples/po/lv/hello_glade2.po", "samples/po/lv/hello_plural.po", "samples/po/lv/hello_noop.po", "samples/po/lv/hello.po", "samples/po/lv/hello2.po", "samples/po/lv/hello_tk.po", "samples/po/lv/hello_gtk.po", "samples/po/ru/hello_glade2.po", "samples/po/ru/hello_plural.po", "samples/po/ru/hello_noop.po", "samples/po/ru/hello.po", "samples/po/ru/hello2.po", "samples/po/ru/hello_tk.po", "samples/po/ru/hello_gtk.po", "samples/po/zh_TW/hello_glade2.po", "samples/po/zh_TW/hello_plural.po", "samples/po/zh_TW/hello_noop.po", "samples/po/zh_TW/hello.po", "samples/po/zh_TW/hello2.po", "samples/po/zh_TW/hello_tk.po", "samples/po/zh_TW/hello_gtk.po", "samples/po/ca/hello_glade2.po", "samples/po/ca/hello_plural.po", "samples/po/ca/hello_noop.po", "samples/po/ca/hello.po", "samples/po/ca/hello2.po", "samples/po/ca/hello_tk.po", "samples/po/ca/hello_gtk.po", "samples/po/hello2.pot", "samples/po/de/hello_glade2.po", "samples/po/de/hello_plural.po", "samples/po/de/hello_noop.po", "samples/po/de/hello.po", "samples/po/de/hello2.po", "samples/po/de/hello_tk.po", "samples/po/de/hello_gtk.po", "samples/po/es/hello_glade2.po", "samples/po/es/hello_plural.po", "samples/po/es/hello_noop.po", "samples/po/es/hello.po", "samples/po/es/hello2.po", "samples/po/es/hello_tk.po", "samples/po/es/hello_gtk.po", "samples/po/hello_gtk.pot", "samples/po/eo/hello_glade2.po", "samples/po/eo/hello_plural.po", "samples/po/eo/hello_noop.po", "samples/po/eo/hello.po", "samples/po/eo/hello2.po", "samples/po/eo/hello_tk.po", "samples/po/eo/hello_gtk.po", "samples/po/nl/hello_glade2.po", "samples/po/nl/hello_plural.po", "samples/po/nl/hello_noop.po", "samples/po/nl/hello.po", "samples/po/nl/hello2.po", "samples/po/nl/hello_tk.po", "samples/po/nl/hello_gtk.po", "samples/po/sr/hello_glade2.po", "samples/po/sr/hello_plural.po", "samples/po/sr/hello_noop.po", "samples/po/sr/hello.po", "samples/po/sr/hello2.po", "samples/po/sr/hello_tk.po", "samples/po/sr/hello_gtk.po", "samples/po/hello.pot", "samples/po/hu/hello_glade2.po", "samples/po/hu/hello_plural.po", "samples/po/hu/hello_noop.po", "samples/po/hu/hello.po", "samples/po/hu/hello2.po", "samples/po/hu/hello_tk.po", "samples/po/hu/hello_gtk.po", "samples/po/zh/hello_glade2.po", "samples/po/zh/hello_plural.po", "samples/po/zh/hello_noop.po", "samples/po/zh/hello.po", "samples/po/zh/hello2.po", "samples/po/zh/hello_tk.po", "samples/po/zh/hello_gtk.po", "samples/po/test.rb", "samples/po/ja/hello_glade2.po", "samples/po/ja/hello_plural.po", "samples/po/ja/hello_noop.po", "samples/po/ja/hello.po", "samples/po/ja/hello2.po", "samples/po/ja/hello_tk.po", "samples/po/ja/hello_gtk.po", "samples/po/bg/hello_glade2.po", "samples/po/bg/hello_plural.po", "samples/po/bg/hello_noop.po", "samples/po/bg/hello.po", "samples/po/bg/hello2.po", "samples/po/bg/hello_tk.po", "samples/po/bg/hello_gtk.po", "samples/po/ua/hello_glade2.po", "samples/po/ua/hello_plural.po", "samples/po/ua/hello_noop.po", "samples/po/ua/hello.po", "samples/po/ua/hello2.po", "samples/po/ua/hello_tk.po", "samples/po/ua/hello_gtk.po", "samples/po/fr/hello_glade2.po", "samples/po/fr/hello_plural.po", "samples/po/fr/hello_noop.po", "samples/po/fr/hello.po", "samples/po/fr/hello2.po", "samples/po/fr/hello_tk.po", "samples/po/fr/hello_gtk.po", "samples/po/hello_tk.pot", "samples/po/sv/hello_glade2.po", "samples/po/sv/hello_plural.po", "samples/po/sv/hello_noop.po", "samples/po/sv/hello.po", "samples/po/sv/hello2.po", "samples/po/sv/hello_tk.po", "samples/po/sv/hello_gtk.po", "samples/po/hello_glade2.pot", "samples/po/it/hello_glade2.po", "samples/po/it/hello_plural.po", "samples/po/it/hello_noop.po", "samples/po/it/hello.po", "samples/po/it/hello2.po", "samples/po/it/hello_tk.po", "samples/po/it/hello_gtk.po", "samples/hello_noop.rb", "samples/hello_plural.rb", "samples/makemo.rb", "samples/hello_glade2.glade", "samples/hello.rb", "samples/hello_gtk2.rb", "samples/README", "samples/hello_glade2.rb", "samples/hello2.rb", "samples/hello_tk.rb", "gettext.gemspec"]
|
16
|
-
s.
|
17
|
-
s.
|
18
|
-
s.
|
7
|
+
Gem::Specification.new do |s|
|
8
|
+
s.name = "gettext"
|
9
|
+
s.version = GetText::VERSION
|
10
|
+
s.summary = 'Ruby-GetText-Package is a libary and tools to localize messages.'
|
11
|
+
s.description = <<-EOD
|
12
|
+
Ruby-GetText-Package is a GNU GetText-like program for Ruby.
|
13
|
+
The catalog file(po-file) is same format with GNU GetText.
|
14
|
+
So you can use GNU GetText tools for maintaining.
|
15
|
+
EOD
|
16
|
+
s.authors = ["Kouhei Sutou", "Masao Mutoh"]
|
17
|
+
s.email = ["kou@clear-code.com", "mutomasa at gmail.com"]
|
18
|
+
s.homepage = "http://ruby-gettext.github.com/"
|
19
|
+
s.rubyforge_project = "gettext"
|
19
20
|
s.require_paths = ["lib"]
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
if s.respond_to? :specification_version then
|
26
|
-
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
27
|
-
s.specification_version = 2
|
28
|
-
|
29
|
-
if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
|
30
|
-
s.add_runtime_dependency(%q<locale>, [">= 0"])
|
31
|
-
s.add_development_dependency(%q<echoe>, [">= 0"])
|
32
|
-
else
|
33
|
-
s.add_dependency(%q<locale>, [">= 0"])
|
34
|
-
s.add_dependency(%q<echoe>, [">= 0"])
|
21
|
+
Dir.chdir(base_dir) do
|
22
|
+
s.files = Dir.glob("{bin,data,doc/text,lib,po,samples,src,test}/**/*")
|
23
|
+
s.files += ["COPYING", "README.rdoc", "Rakefile", "gettext.gemspec"]
|
24
|
+
s.executables = Dir.chdir("bin") do
|
25
|
+
Dir.glob("*")
|
35
26
|
end
|
36
|
-
|
37
|
-
s.add_dependency(%q<locale>, [">= 0"])
|
38
|
-
s.add_dependency(%q<echoe>, [">= 0"])
|
27
|
+
s.test_files = Dir.glob("test/test_*.rb")
|
39
28
|
end
|
29
|
+
|
30
|
+
s.add_runtime_dependency("locale")
|
31
|
+
s.add_development_dependency("yard")
|
40
32
|
end
|
data/lib/gettext.rb
CHANGED
@@ -1,7 +1,9 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
1
3
|
=begin
|
2
4
|
gettext.rb - GetText module
|
3
5
|
|
4
|
-
Copyright (C) 2001-
|
6
|
+
Copyright (C) 2001-2010 Masao Mutoh
|
5
7
|
Copyright (C) 2001-2003 Masahiro Sakai
|
6
8
|
|
7
9
|
Masao Mutoh <mutomasa at gmail.com>
|
@@ -14,7 +16,7 @@
|
|
14
16
|
if Object.constants.include? "Gem"
|
15
17
|
begin
|
16
18
|
begin
|
17
|
-
gem 'locale', '>=2.0.
|
19
|
+
gem 'locale', '>=2.0.5'
|
18
20
|
rescue Gem::LoadError
|
19
21
|
end
|
20
22
|
rescue NoMethodError
|
@@ -47,14 +49,14 @@ module GetText
|
|
47
49
|
|
48
50
|
# bindtextdomain(domainname, options = {})
|
49
51
|
#
|
50
|
-
# Bind a textdomain(%{path}/%{locale}/LC_MESSAGES/%{domainname}.mo) to
|
52
|
+
# Bind a textdomain(%{path}/%{locale}/LC_MESSAGES/%{domainname}.mo) to
|
51
53
|
# your program.
|
52
|
-
# Normally, the texdomain scope becomes the class/module(and parent
|
54
|
+
# Normally, the texdomain scope becomes the class/module(and parent
|
53
55
|
# classes/included modules).
|
54
56
|
#
|
55
57
|
# * domainname: the textdomain name.
|
56
58
|
# * options: options as an Hash.
|
57
|
-
# * :path - the path to the mo-files. When the value is nil, it will search default paths such as
|
59
|
+
# * :path - the path to the mo-files. When the value is nil, it will search default paths such as
|
58
60
|
# /usr/share/locale, /usr/local/share/locale)
|
59
61
|
# * :output_charset - The output charset. Same with GetText.set_output_charset. Usually, L10n
|
60
62
|
# library doesn't use this option. Application may use this once.
|
@@ -68,7 +70,7 @@ module GetText
|
|
68
70
|
# * klass: the target ruby class.
|
69
71
|
# * domainname: the textdomain name.
|
70
72
|
# * options: options as an Hash. See GetText.bindtextdomain.
|
71
|
-
def bindtextdomain_to(klass, domainname, *options)
|
73
|
+
def bindtextdomain_to(klass, domainname, *options)
|
72
74
|
if options[0].kind_of? Hash
|
73
75
|
opts = options[0]
|
74
76
|
else
|
@@ -83,9 +85,9 @@ module GetText
|
|
83
85
|
TextDomainManager.bind_to(klass, domainname, opts)
|
84
86
|
end
|
85
87
|
|
86
|
-
# Binds a existed textdomain to your program.
|
88
|
+
# Binds a existed textdomain to your program.
|
87
89
|
# This is the same function with GetText.bindtextdomain but simpler(and faster) than bindtextdomain.
|
88
|
-
# Note that you need to call GetText.bindtextdomain first. If the domainname hasn't bound yet,
|
90
|
+
# Note that you need to call GetText.bindtextdomain first. If the domainname hasn't bound yet,
|
89
91
|
# raises GetText::NoboundTextDomainError.
|
90
92
|
# * domainname: a textdomain name.
|
91
93
|
# * Returns: the GetText::TextDomainManager.
|
@@ -93,7 +95,7 @@ module GetText
|
|
93
95
|
textdomain_to(self, domainname)
|
94
96
|
end
|
95
97
|
|
96
|
-
# Includes GetText module and bind an exsited textdomain to a class.
|
98
|
+
# Includes GetText module and bind an exsited textdomain to a class.
|
97
99
|
# See textdomain for more detail.
|
98
100
|
# * klass: the target ruby class.
|
99
101
|
# * domainname: the textdomain name.
|
@@ -109,13 +111,13 @@ module GetText
|
|
109
111
|
# _(msgid)
|
110
112
|
#
|
111
113
|
# Translates msgid and return the message.
|
112
|
-
# This doesn't make a copy of the message.
|
114
|
+
# This doesn't make a copy of the message.
|
113
115
|
#
|
114
|
-
# You need to use String#dup if you want to modify the return value
|
115
|
-
# with destructive functions.
|
116
|
+
# You need to use String#dup if you want to modify the return value
|
117
|
+
# with destructive functions.
|
116
118
|
#
|
117
119
|
# (e.g.1) _("Hello ").dup << "world"
|
118
|
-
#
|
120
|
+
#
|
119
121
|
# But e.g.1 should be rewrite to:
|
120
122
|
#
|
121
123
|
# (e.g.2) _("Hello %{val}") % {:val => "world"}
|
@@ -132,12 +134,12 @@ module GetText
|
|
132
134
|
# sgettext(msgid, div = '|')
|
133
135
|
# s_(msgid, div = '|')
|
134
136
|
#
|
135
|
-
# Translates msgid, but if there are no localized text,
|
137
|
+
# Translates msgid, but if there are no localized text,
|
136
138
|
# it returns a last part of msgid separeted "div".
|
137
139
|
#
|
138
140
|
# * msgid: the message id.
|
139
141
|
# * separator: separator or nil for no seperation.
|
140
|
-
# * Returns: the localized text by msgid. If there are no localized text,
|
142
|
+
# * Returns: the localized text by msgid. If there are no localized text,
|
141
143
|
# it returns a last part of the msgid separeted by "seperator".
|
142
144
|
# <tt>Movie|Location -> Location</tt>
|
143
145
|
# See: http://www.gnu.org/software/gettext/manual/html_mono/gettext.html#SEC151
|
@@ -155,7 +157,7 @@ module GetText
|
|
155
157
|
#
|
156
158
|
# * msgctxt: the message context.
|
157
159
|
# * msgid: the message id.
|
158
|
-
# * Returns: the localized text by msgid. If there are no localized text,
|
160
|
+
# * Returns: the localized text by msgid. If there are no localized text,
|
159
161
|
# it returns msgid.
|
160
162
|
# See: http://www.gnu.org/software/autoconf/manual/gettext/Contexts.html
|
161
163
|
def pgettext(msgctxt, msgid)
|
@@ -168,7 +170,7 @@ module GetText
|
|
168
170
|
# n_(msgid, msgid_plural, n)
|
169
171
|
# n_(msgids, n) # msgids = [msgid, msgid_plural]
|
170
172
|
#
|
171
|
-
# The ngettext is similar to the gettext function as it finds the message catalogs in the same way.
|
173
|
+
# The ngettext is similar to the gettext function as it finds the message catalogs in the same way.
|
172
174
|
# But it takes two extra arguments for plural form.
|
173
175
|
#
|
174
176
|
# * msgid: the singular form.
|
@@ -187,7 +189,7 @@ module GetText
|
|
187
189
|
# ns_(msgids, n, div = "|") # msgids = [msgid, msgid_plural]
|
188
190
|
#
|
189
191
|
# The nsgettext is similar to the ngettext.
|
190
|
-
# But if there are no localized text,
|
192
|
+
# But if there are no localized text,
|
191
193
|
# it returns a last part of msgid separeted "div".
|
192
194
|
#
|
193
195
|
# * msgid: the singular form with "div". (e.g. "Special|An apple")
|
@@ -227,7 +229,7 @@ module GetText
|
|
227
229
|
opt1 = arg3
|
228
230
|
opt2 = nil
|
229
231
|
end
|
230
|
-
|
232
|
+
|
231
233
|
msgstr = TextDomainManager.translate_plural_message(self, msgid_ctxt, msgid_plural, opt1, opt2)
|
232
234
|
if msgstr == msgid_ctxt
|
233
235
|
msgid
|
@@ -235,7 +237,7 @@ module GetText
|
|
235
237
|
msgstr
|
236
238
|
end
|
237
239
|
end
|
238
|
-
|
240
|
+
|
239
241
|
# makes dynamic translation messages readable for the gettext parser.
|
240
242
|
# <tt>_(fruit)</tt> cannot be understood by the gettext parser. To help the parser find all your translations,
|
241
243
|
# you can add <tt>fruit = N_("Apple")</tt> which does not translate, but tells the parser: "Apple" needs translation.
|
@@ -245,7 +247,7 @@ module GetText
|
|
245
247
|
msgid
|
246
248
|
end
|
247
249
|
|
248
|
-
# This is same function as N_ but for ngettext.
|
250
|
+
# This is same function as N_ but for ngettext.
|
249
251
|
# * msgid: the message id.
|
250
252
|
# * msgid_plural: the plural message id.
|
251
253
|
# * Returns: msgid.
|
@@ -253,7 +255,7 @@ module GetText
|
|
253
255
|
[msgid, msgid_plural]
|
254
256
|
end
|
255
257
|
|
256
|
-
# Sets charset(String) such as "euc-jp", "sjis", "CP932", "utf-8", ...
|
258
|
+
# Sets charset(String) such as "euc-jp", "sjis", "CP932", "utf-8", ...
|
257
259
|
# You shouldn't use this in your own Libraries.
|
258
260
|
# * charset: an output_charset
|
259
261
|
# * Returns: self
|
@@ -277,9 +279,9 @@ module GetText
|
|
277
279
|
Locale.current = lang
|
278
280
|
end
|
279
281
|
|
280
|
-
# Set the locale to the current thread.
|
282
|
+
# Set the locale to the current thread.
|
281
283
|
# Note that if #set_locale is set, this value is ignored.
|
282
|
-
# If you need, set_locale(nil); set_current_locale(lang)
|
284
|
+
# If you need, set_locale(nil); set_current_locale(lang)
|
283
285
|
def set_current_locale(lang)
|
284
286
|
Locale.current = lang
|
285
287
|
end
|