gettext 1.5.0 → 1.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/ChangeLog +113 -0
- data/NEWS +17 -1
- data/README +56 -46
- data/Rakefile +6 -2
- data/data/locale/cs/LC_MESSAGES/rails.mo +0 -0
- data/data/locale/cs/LC_MESSAGES/rgettext.mo +0 -0
- data/data/locale/de/LC_MESSAGES/rails.mo +0 -0
- data/data/locale/de/LC_MESSAGES/rgettext.mo +0 -0
- data/data/locale/el/LC_MESSAGES/rails.mo +0 -0
- data/data/locale/el/LC_MESSAGES/rgettext.mo +0 -0
- data/data/locale/es/LC_MESSAGES/rails.mo +0 -0
- data/data/locale/es/LC_MESSAGES/rgettext.mo +0 -0
- data/data/locale/fr/LC_MESSAGES/rails.mo +0 -0
- data/data/locale/fr/LC_MESSAGES/rgettext.mo +0 -0
- data/data/locale/it/LC_MESSAGES/rails.mo +0 -0
- data/data/locale/it/LC_MESSAGES/rgettext.mo +0 -0
- data/data/locale/ja/LC_MESSAGES/rails.mo +0 -0
- data/data/locale/ja/LC_MESSAGES/rgettext.mo +0 -0
- data/data/locale/ko/LC_MESSAGES/rails.mo +0 -0
- data/data/locale/ko/LC_MESSAGES/rgettext.mo +0 -0
- data/data/locale/nl/LC_MESSAGES/rails.mo +0 -0
- data/data/locale/nl/LC_MESSAGES/rgettext.mo +0 -0
- data/data/locale/pt_BR/LC_MESSAGES/rails.mo +0 -0
- data/data/locale/pt_BR/LC_MESSAGES/rgettext.mo +0 -0
- data/data/locale/ru/LC_MESSAGES/rails.mo +0 -0
- data/data/locale/ru/LC_MESSAGES/rgettext.mo +0 -0
- data/data/locale/sv/LC_MESSAGES/rgettext.mo +0 -0
- data/data/locale/zh/LC_MESSAGES/rails.mo +0 -0
- data/data/locale/zh/LC_MESSAGES/rgettext.mo +0 -0
- data/ext/gettext/locale_system.c +3 -3
- data/lib/gettext.rb +149 -98
- data/lib/gettext/container.rb +3 -23
- data/lib/gettext/erb.rb +2 -2
- data/lib/gettext/locale_posix.rb +37 -5
- data/lib/gettext/locale_win32.rb +2 -1
- data/lib/gettext/mo.rb +6 -4
- data/lib/gettext/parser/activerecord.rb +7 -3
- data/lib/gettext/poparser.rb +2 -2
- data/lib/gettext/rails.rb +131 -112
- data/lib/gettext/rgettext.rb +3 -1
- data/lib/gettext/rmsgfmt.rb +3 -1
- data/lib/gettext/rmsgmerge.rb +3 -1
- data/lib/gettext/textdomain.rb +14 -8
- data/lib/gettext/textdomainmanager.rb +103 -0
- data/lib/gettext/version.rb +1 -1
- data/po/cs/rails.po +16 -16
- data/po/cs/rgettext.po +7 -3
- data/po/de/rails.po +16 -16
- data/po/de/rgettext.po +7 -3
- data/po/el/rails.po +16 -16
- data/po/el/rgettext.po +7 -3
- data/po/es/rails.po +16 -16
- data/po/es/rgettext.po +7 -3
- data/po/fr/rails.po +16 -16
- data/po/fr/rgettext.po +7 -3
- data/po/it/rails.po +79 -0
- data/po/it/rgettext.po +42 -32
- data/po/ja/rails.po +20 -18
- data/po/ja/rgettext.po +7 -3
- data/po/ko/rails.po +16 -16
- data/po/ko/rgettext.po +7 -3
- data/po/nl/rails.po +16 -16
- data/po/nl/rgettext.po +7 -3
- data/po/pt_BR/rails.po +16 -16
- data/po/pt_BR/rgettext.po +7 -3
- data/po/rails.pot +16 -16
- data/po/rgettext.pot +7 -3
- data/po/ru/rails.po +18 -18
- data/po/ru/rgettext.po +13 -9
- data/po/sv/rgettext.po +7 -3
- data/po/zh/rails.po +78 -0
- data/po/zh/rgettext.po +104 -0
- data/pre-setup.rb +1 -4
- data/samples/cgi/helloerb.rhtml +1 -0
- data/samples/cgi/locale/zh/LC_MESSAGES/helloerb1.mo +0 -0
- data/samples/cgi/locale/zh/LC_MESSAGES/helloerb2.mo +0 -0
- data/samples/cgi/locale/zh/LC_MESSAGES/hellolib.mo +0 -0
- data/samples/cgi/locale/zh/LC_MESSAGES/main.mo +0 -0
- data/samples/cgi/po/zh/helloerb1.po +60 -0
- data/samples/cgi/po/zh/helloerb2.po +52 -0
- data/samples/cgi/po/zh/hellolib.po +24 -0
- data/samples/cgi/po/zh/main.po +80 -0
- data/samples/hello.rb +28 -5
- data/samples/hello2.rb +13 -6
- data/samples/hello_noop.rb +20 -8
- data/samples/hello_plural.rb +16 -6
- data/samples/hello_textdomain.rb +13 -4
- data/samples/hellogtk.rb +5 -4
- data/samples/hellogtk2.rb +5 -6
- data/samples/locale/cs/LC_MESSAGES/hello2.mo +0 -0
- data/samples/locale/cs/LC_MESSAGES/hello_plural.mo +0 -0
- data/samples/locale/de/LC_MESSAGES/hello2.mo +0 -0
- data/samples/locale/de/LC_MESSAGES/hello_plural.mo +0 -0
- data/samples/locale/el/LC_MESSAGES/hello2.mo +0 -0
- data/samples/locale/el/LC_MESSAGES/hello_plural.mo +0 -0
- data/samples/locale/es/LC_MESSAGES/hello2.mo +0 -0
- data/samples/locale/es/LC_MESSAGES/hello_plural.mo +0 -0
- data/samples/locale/fr/LC_MESSAGES/hello2.mo +0 -0
- data/samples/locale/fr/LC_MESSAGES/hello_plural.mo +0 -0
- data/samples/locale/it/LC_MESSAGES/hello2.mo +0 -0
- data/samples/locale/it/LC_MESSAGES/hello_plural.mo +0 -0
- data/samples/locale/ja/LC_MESSAGES/hello2.mo +0 -0
- data/samples/locale/ja/LC_MESSAGES/hello_plural.mo +0 -0
- data/samples/locale/ko/LC_MESSAGES/hello2.mo +0 -0
- data/samples/locale/ko/LC_MESSAGES/hello_plural.mo +0 -0
- data/samples/locale/nl/LC_MESSAGES/hello2.mo +0 -0
- data/samples/locale/nl/LC_MESSAGES/hello_plural.mo +0 -0
- data/samples/locale/pt_BR/LC_MESSAGES/hello2.mo +0 -0
- data/samples/locale/pt_BR/LC_MESSAGES/hello_plural.mo +0 -0
- data/samples/locale/ru/LC_MESSAGES/hello2.mo +0 -0
- data/samples/locale/ru/LC_MESSAGES/hello_plural.mo +0 -0
- data/samples/locale/sv/LC_MESSAGES/hello2.mo +0 -0
- data/samples/locale/sv/LC_MESSAGES/hello_plural.mo +0 -0
- data/samples/locale/zh/LC_MESSAGES/hello.mo +0 -0
- data/samples/locale/zh/LC_MESSAGES/hello2.mo +0 -0
- data/samples/locale/zh/LC_MESSAGES/hello_noop.mo +0 -0
- data/samples/locale/zh/LC_MESSAGES/hello_plural.mo +0 -0
- data/samples/locale/zh/LC_MESSAGES/helloglade2.mo +0 -0
- data/samples/locale/zh/LC_MESSAGES/hellogtk.mo +0 -0
- data/samples/locale/zh/LC_MESSAGES/hellotk.mo +0 -0
- data/samples/po/cs/hello2.po +4 -4
- data/samples/po/cs/hello_plural.po +5 -5
- data/samples/po/de/hello2.po +4 -4
- data/samples/po/de/hello_plural.po +9 -6
- data/samples/po/el/hello2.po +4 -4
- data/samples/po/el/hello_plural.po +3 -3
- data/samples/po/es/hello2.po +4 -4
- data/samples/po/es/hello_plural.po +6 -6
- data/samples/po/fr/hello2.po +4 -4
- data/samples/po/fr/hello_plural.po +3 -3
- data/samples/po/hello2.pot +2 -2
- data/samples/po/hello_plural.pot +1 -1
- data/samples/po/it/hello2.po +4 -4
- data/samples/po/it/hello_plural.po +4 -5
- data/samples/po/ja/hello2.po +4 -4
- data/samples/po/ja/hello_plural.po +4 -5
- data/samples/po/ko/hello2.po +4 -4
- data/samples/po/ko/hello_plural.po +10 -7
- data/samples/po/nl/hello2.po +4 -4
- data/samples/po/nl/hello_plural.po +6 -7
- data/samples/po/pt_BR/hello2.po +4 -4
- data/samples/po/pt_BR/hello_plural.po +6 -6
- data/samples/po/ru/hello2.po +4 -4
- data/samples/po/ru/hello_plural.po +10 -7
- data/samples/po/sv/hello2.po +4 -4
- data/samples/po/sv/hello_plural.po +4 -4
- data/samples/po/zh/hello.po +23 -0
- data/samples/po/zh/hello2.po +31 -0
- data/samples/po/zh/hello_noop.po +27 -0
- data/samples/po/zh/hello_plural.po +25 -0
- data/samples/po/zh/helloglade2.po +31 -0
- data/samples/po/zh/hellogtk.po +23 -0
- data/samples/po/zh/hellotk.po +23 -0
- data/samples/rails/README +2 -2
- data/samples/rails/lib/tasks/gettext.rake +0 -3
- data/samples/rails/locale/cs/LC_MESSAGES/blog.mo +0 -0
- data/samples/rails/locale/de/LC_MESSAGES/blog.mo +0 -0
- data/samples/rails/locale/el/LC_MESSAGES/blog.mo +0 -0
- data/samples/rails/locale/en/LC_MESSAGES/blog.mo +0 -0
- data/samples/rails/locale/es/LC_MESSAGES/blog.mo +0 -0
- data/samples/rails/locale/fr/LC_MESSAGES/blog.mo +0 -0
- data/samples/rails/locale/it/LC_MESSAGES/blog.mo +0 -0
- data/samples/rails/locale/ja/LC_MESSAGES/blog.mo +0 -0
- data/samples/rails/locale/ko/LC_MESSAGES/blog.mo +0 -0
- data/samples/rails/locale/nl/LC_MESSAGES/blog.mo +0 -0
- data/samples/rails/locale/pt_BR/LC_MESSAGES/blog.mo +0 -0
- data/samples/rails/locale/ru/LC_MESSAGES/blog.mo +0 -0
- data/samples/rails/locale/zh/LC_MESSAGES/blog.mo +0 -0
- data/samples/rails/po/blog.pot +1 -1
- data/samples/rails/po/cs/blog.po +1 -1
- data/samples/rails/po/de/blog.po +1 -1
- data/samples/rails/po/el/blog.po +1 -1
- data/samples/rails/po/en/blog.po +3 -3
- data/samples/rails/po/es/blog.po +1 -1
- data/samples/rails/po/fr/blog.po +1 -1
- data/samples/rails/po/it/blog.po +109 -0
- data/samples/rails/po/ja/blog.po +1 -14
- data/samples/rails/po/ko/blog.po +2 -2
- data/samples/rails/po/nl/blog.po +1 -1
- data/samples/rails/po/pt_BR/blog.po +1 -1
- data/samples/rails/po/ru/blog.po +1 -2
- data/samples/rails/po/zh/blog.po +109 -0
- data/samples/rails/vendor/plugins/gettext/README +17 -0
- data/samples/rails/vendor/plugins/gettext/Rakefile +17 -0
- data/samples/rails/vendor/plugins/gettext/lib/gettext_plugin.rb +16 -35
- data/samples/rails/{locale → vendor/plugins/gettext/locale}/cs/LC_MESSAGES/gettext_plugin.mo +0 -0
- data/samples/rails/{locale → vendor/plugins/gettext/locale}/de/LC_MESSAGES/gettext_plugin.mo +0 -0
- data/samples/rails/{locale → vendor/plugins/gettext/locale}/el/LC_MESSAGES/gettext_plugin.mo +0 -0
- data/samples/rails/{locale → vendor/plugins/gettext/locale}/es/LC_MESSAGES/gettext_plugin.mo +0 -0
- data/samples/rails/{locale → vendor/plugins/gettext/locale}/fr/LC_MESSAGES/gettext_plugin.mo +0 -0
- data/samples/rails/vendor/plugins/gettext/locale/it/LC_MESSAGES/gettext_plugin.mo +0 -0
- data/samples/rails/{locale → vendor/plugins/gettext/locale}/ja/LC_MESSAGES/gettext_plugin.mo +0 -0
- data/samples/rails/{locale → vendor/plugins/gettext/locale}/ko/LC_MESSAGES/gettext_plugin.mo +0 -0
- data/samples/rails/{locale → vendor/plugins/gettext/locale}/nl/LC_MESSAGES/gettext_plugin.mo +0 -0
- data/samples/rails/{locale → vendor/plugins/gettext/locale}/pt_BR/LC_MESSAGES/gettext_plugin.mo +0 -0
- data/samples/rails/{locale → vendor/plugins/gettext/locale}/ru/LC_MESSAGES/gettext_plugin.mo +0 -0
- data/samples/rails/vendor/plugins/gettext/locale/zh/LC_MESSAGES/gettext_plugin.mo +0 -0
- data/samples/rails/{po → vendor/plugins/gettext/po}/cs/gettext_plugin.po +4 -4
- data/samples/rails/{po → vendor/plugins/gettext/po}/de/gettext_plugin.po +4 -4
- data/samples/rails/{po → vendor/plugins/gettext/po}/el/gettext_plugin.po +4 -4
- data/samples/rails/{po → vendor/plugins/gettext/po}/es/gettext_plugin.po +4 -4
- data/samples/rails/{po → vendor/plugins/gettext/po}/fr/gettext_plugin.po +4 -4
- data/samples/rails/{po → vendor/plugins/gettext/po}/gettext_plugin.pot +4 -4
- data/samples/rails/vendor/plugins/gettext/po/it/gettext_plugin.po +27 -0
- data/samples/rails/{po → vendor/plugins/gettext/po}/ja/gettext_plugin.po +4 -4
- data/samples/rails/{po → vendor/plugins/gettext/po}/ko/gettext_plugin.po +4 -4
- data/samples/rails/{po → vendor/plugins/gettext/po}/nl/gettext_plugin.po +4 -4
- data/samples/rails/{po → vendor/plugins/gettext/po}/pt_BR/gettext_plugin.po +4 -4
- data/samples/rails/{po → vendor/plugins/gettext/po}/ru/gettext_plugin.po +4 -5
- data/samples/rails/vendor/plugins/gettext/po/zh/gettext_plugin.po +27 -0
- data/test/gettext_test.rb +18 -14
- data/test/gettext_test_multi_textdomain.rb +49 -0
- data/test/locale/fr/LC_MESSAGES/test6.mo +0 -0
- data/test/locale/ja/LC_MESSAGES/test6.mo +0 -0
- data/test/po/fr/test6.po +23 -0
- data/test/po/ja/test6.po +23 -0
- data/test/test.sh +3 -1
- data/test/testlib1.rb +0 -5
- data/test/testlib5.rb +70 -0
- data/test/testlib6.rb +19 -0
- metadata +128 -26
- data/COPYING.ja +0 -51
- data/po/it/messages.mo +0 -0
- data/samples/cgi/po/it/messages.mo +0 -0
data/lib/gettext/rgettext.rb
CHANGED
|
@@ -14,6 +14,7 @@
|
|
|
14
14
|
|
|
15
15
|
require 'optparse'
|
|
16
16
|
require 'gettext'
|
|
17
|
+
require 'rbconfig'
|
|
17
18
|
|
|
18
19
|
module GetText
|
|
19
20
|
|
|
@@ -24,7 +25,7 @@ module GetText
|
|
|
24
25
|
|
|
25
26
|
# constant values
|
|
26
27
|
VERSION = GetText::VERSION
|
|
27
|
-
DATE = %w($Date: 2006/
|
|
28
|
+
DATE = %w($Date: 2006/06/04 15:07:34 $)[1]
|
|
28
29
|
MAX_LINE_LEN = 70
|
|
29
30
|
|
|
30
31
|
@ex_parsers = []
|
|
@@ -142,6 +143,7 @@ msgstr ""
|
|
|
142
143
|
|
|
143
144
|
opts.on_tail("--version", _("display version information and exit")) do
|
|
144
145
|
puts "#{$0} #{VERSION} (#{DATE})"
|
|
146
|
+
puts "#{File.join(Config::CONFIG["bindir"], Config::CONFIG["RUBY_INSTALL_NAME"])} #{RUBY_VERSION} (#{RUBY_RELEASE_DATE}) [#{RUBY_PLATFORM}]"
|
|
145
147
|
exit
|
|
146
148
|
end
|
|
147
149
|
|
data/lib/gettext/rmsgfmt.rb
CHANGED
|
@@ -11,6 +11,7 @@ require 'optparse'
|
|
|
11
11
|
require 'fileutils'
|
|
12
12
|
require 'gettext'
|
|
13
13
|
require 'gettext/poparser'
|
|
14
|
+
require 'rbconfig'
|
|
14
15
|
|
|
15
16
|
module GetText
|
|
16
17
|
GetText.bindtextdomain("rgettext")
|
|
@@ -19,7 +20,7 @@ module GetText
|
|
|
19
20
|
extend GetText
|
|
20
21
|
|
|
21
22
|
VERSION = GetText::VERSION
|
|
22
|
-
DATE = %w($Date: 2006/
|
|
23
|
+
DATE = %w($Date: 2006/06/04 15:07:34 $)[1] # :nodoc:
|
|
23
24
|
|
|
24
25
|
module_function
|
|
25
26
|
def run(targetfile = nil, output_path = nil) # :nodoc:
|
|
@@ -55,6 +56,7 @@ module GetText
|
|
|
55
56
|
|
|
56
57
|
opts.on_tail("--version", _("display version information and exit")) do
|
|
57
58
|
puts "#{$0} #{VERSION} (#{DATE})"
|
|
59
|
+
puts "#{File.join(Config::CONFIG["bindir"], Config::CONFIG["RUBY_INSTALL_NAME"])} #{RUBY_VERSION} (#{RUBY_RELEASE_DATE}) [#{RUBY_PLATFORM}]"
|
|
58
60
|
exit
|
|
59
61
|
end
|
|
60
62
|
opts.parse!(ARGV)
|
data/lib/gettext/rmsgmerge.rb
CHANGED
|
@@ -11,6 +11,7 @@
|
|
|
11
11
|
require 'optparse'
|
|
12
12
|
require 'gettext'
|
|
13
13
|
require 'gettext/poparser'
|
|
14
|
+
require 'rbconfig'
|
|
14
15
|
|
|
15
16
|
module GetText
|
|
16
17
|
|
|
@@ -393,7 +394,7 @@ module GetText
|
|
|
393
394
|
|
|
394
395
|
# constant values
|
|
395
396
|
VERSION = GetText::VERSION
|
|
396
|
-
DATE = %w($Date: 2006/
|
|
397
|
+
DATE = %w($Date: 2006/06/04 15:07:34 $)[1]
|
|
397
398
|
|
|
398
399
|
module_function
|
|
399
400
|
|
|
@@ -419,6 +420,7 @@ module GetText
|
|
|
419
420
|
|
|
420
421
|
opts.on_tail("--version", _("display version information and exit")) do
|
|
421
422
|
puts "#{$0} #{VERSION} (#{DATE})"
|
|
423
|
+
puts "#{File.join(::Config::CONFIG["bindir"], ::Config::CONFIG["RUBY_INSTALL_NAME"])} #{RUBY_VERSION} (#{RUBY_RELEASE_DATE}) [#{RUBY_PLATFORM}]"
|
|
422
424
|
exit
|
|
423
425
|
end
|
|
424
426
|
|
data/lib/gettext/textdomain.rb
CHANGED
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
You may redistribute it and/or modify it under the same
|
|
11
11
|
license terms as Ruby.
|
|
12
12
|
|
|
13
|
-
$Id: textdomain.rb,v 1.
|
|
13
|
+
$Id: textdomain.rb,v 1.17 2006/06/04 14:43:37 mutoh Exp $
|
|
14
14
|
=end
|
|
15
15
|
|
|
16
16
|
require 'gettext/string'
|
|
@@ -27,7 +27,9 @@ module GetText
|
|
|
27
27
|
GEM_PATH_RE = /(.*)\/lib$/ # :nodoc:
|
|
28
28
|
|
|
29
29
|
attr_reader :current_locale
|
|
30
|
+
attr_reader :locale_paths
|
|
30
31
|
attr_reader :current_mo
|
|
32
|
+
attr_reader :name
|
|
31
33
|
|
|
32
34
|
@@check_mo = false
|
|
33
35
|
# Check mo-file is modified or not, and if mo-file is modified,
|
|
@@ -46,10 +48,12 @@ module GetText
|
|
|
46
48
|
@@check_mo = val
|
|
47
49
|
end
|
|
48
50
|
# The default locale paths.
|
|
51
|
+
CONFIG_PREFIX = Config::CONFIG['prefix'].gsub(/\/local/, "")
|
|
49
52
|
DEFAULT_LOCALE_PATHS = [
|
|
50
53
|
"#{Config::CONFIG['datadir']}/locale/%{locale}/LC_MESSAGES/%{name}.mo",
|
|
51
|
-
"#{Config::CONFIG['
|
|
52
|
-
"#{
|
|
54
|
+
"#{Config::CONFIG['datadir'].gsub(/\/local/, "")}/locale/%{locale}/LC_MESSAGES/%{name}.mo",
|
|
55
|
+
"#{CONFIG_PREFIX}/share/locale/%{locale}/LC_MESSAGES/%{name}.mo",
|
|
56
|
+
"#{CONFIG_PREFIX}/local/share/locale/%{locale}/LC_MESSAGES/%{name}.mo"
|
|
53
57
|
].uniq
|
|
54
58
|
|
|
55
59
|
# Add default locale path. Usually you should use GetText.add_default_locale_path instead.
|
|
@@ -109,13 +113,13 @@ module GetText
|
|
|
109
113
|
|
|
110
114
|
# Gets the translated string.
|
|
111
115
|
# * msgid: the original message.
|
|
112
|
-
# * Returns: the translated string.
|
|
116
|
+
# * Returns: the translated string or nil if not found.
|
|
113
117
|
def gettext(msgid)
|
|
114
118
|
return "" if msgid == "" or msgid.nil?
|
|
115
119
|
if @current_mo and @current_mo[msgid] and (@current_mo[msgid].size > 0)
|
|
116
120
|
@current_mo[msgid]
|
|
117
121
|
else
|
|
118
|
-
|
|
122
|
+
nil
|
|
119
123
|
end
|
|
120
124
|
end
|
|
121
125
|
|
|
@@ -123,11 +127,13 @@ module GetText
|
|
|
123
127
|
# * msgid: the original message(single).
|
|
124
128
|
# * msgid: the original message(plural).
|
|
125
129
|
# * n: the number
|
|
126
|
-
# * Returns: the translated string.
|
|
130
|
+
# * Returns: the translated string or nil if not found.
|
|
127
131
|
def ngettext(msgid, msgid_plural, n)
|
|
128
132
|
key = msgid + "\000" + msgid_plural
|
|
129
133
|
msg = gettext(key)
|
|
130
|
-
if msg
|
|
134
|
+
if ! msg
|
|
135
|
+
nil
|
|
136
|
+
elsif msg == key
|
|
131
137
|
msg = n == 1 ? msgid : msgid_plural
|
|
132
138
|
elsif msg.include?("\000")
|
|
133
139
|
ary = msg.split("\000")
|
|
@@ -172,7 +178,7 @@ module GetText
|
|
|
172
178
|
end
|
|
173
179
|
end
|
|
174
180
|
end
|
|
175
|
-
locales = [@current_locale.orig_str, @current_locale.to_posix, @current_locale.language]
|
|
181
|
+
locales = [@current_locale.orig_str, @current_locale.to_posix, @current_locale.language].uniq
|
|
176
182
|
@locale_paths.each do |dir|
|
|
177
183
|
locales.each{|locale|
|
|
178
184
|
fname = dir % {:locale => locale, :name => @name}
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
=begin
|
|
2
|
+
textdomainmanager.rb - Manage TextDomains.
|
|
3
|
+
|
|
4
|
+
Copyright (C) 2006 Masao Mutoh
|
|
5
|
+
|
|
6
|
+
You may redistribute it and/or modify it under the same
|
|
7
|
+
license terms as Ruby.
|
|
8
|
+
|
|
9
|
+
$Id: textdomainmanager.rb,v 1.1 2006/06/04 14:44:37 mutoh Exp $
|
|
10
|
+
=end
|
|
11
|
+
|
|
12
|
+
require 'gettext/locale'
|
|
13
|
+
require 'gettext/textdomain'
|
|
14
|
+
|
|
15
|
+
module GetText
|
|
16
|
+
# Manage TextDomain (Internal use only)
|
|
17
|
+
# A class/module is able to have plural textdomains.
|
|
18
|
+
class TextDomainManager
|
|
19
|
+
include Enumerable
|
|
20
|
+
|
|
21
|
+
attr_reader :target
|
|
22
|
+
|
|
23
|
+
@@output_charset = ENV["OUTPUT_CHARSET"]
|
|
24
|
+
@@textdomain_all = {}
|
|
25
|
+
|
|
26
|
+
# Sets the current output_charset.
|
|
27
|
+
# * charset: output_charset.
|
|
28
|
+
# * Returns: output_charset.
|
|
29
|
+
def self.output_charset=(charset)
|
|
30
|
+
@@output_charset = charset
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
# Gets the current output_charset.
|
|
34
|
+
# * Returns: output_charset.
|
|
35
|
+
def self.output_charset
|
|
36
|
+
@@output_charset
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
def self.each_all
|
|
40
|
+
@@textdomain_all.each do |k, textdomain|
|
|
41
|
+
yield textdomain
|
|
42
|
+
end
|
|
43
|
+
end
|
|
44
|
+
|
|
45
|
+
def self.textdomain(domainname)
|
|
46
|
+
@@textdomain_all[domainname]
|
|
47
|
+
end
|
|
48
|
+
|
|
49
|
+
# Initialize a TextDomainManager
|
|
50
|
+
# * target: a target class/module to bind this TextDomainManager.
|
|
51
|
+
# * locale: a Locale::Object.
|
|
52
|
+
def initialize(target, locale)
|
|
53
|
+
@target = target
|
|
54
|
+
@locale = locale
|
|
55
|
+
@textdomains = {}
|
|
56
|
+
end
|
|
57
|
+
|
|
58
|
+
# Add a textdomain
|
|
59
|
+
# * options: If they aren't set or invalid, default values are used.
|
|
60
|
+
# * :path - the path to the mo-files. If not set, it will search default paths such as
|
|
61
|
+
# /usr/share/locale, /usr/local/share/locale)
|
|
62
|
+
def add_textdomain(domainname, options = {})
|
|
63
|
+
path = options[:path]
|
|
64
|
+
if $DEBUG
|
|
65
|
+
$stderr.print "Bind the domain '#{domainname}' to '#{@target}'. "
|
|
66
|
+
$stderr.print "Current locale is #{@locale.inspect}\n"
|
|
67
|
+
end
|
|
68
|
+
textdomain = @@textdomain_all[domainname]
|
|
69
|
+
if textdomain
|
|
70
|
+
textdomain.set_locale(@locale)
|
|
71
|
+
else
|
|
72
|
+
textdomain = TextDomain.new(domainname, path, @locale)
|
|
73
|
+
@@textdomain_all[domainname] = textdomain
|
|
74
|
+
end
|
|
75
|
+
@textdomains[domainname] = textdomain
|
|
76
|
+
textdomain
|
|
77
|
+
end
|
|
78
|
+
|
|
79
|
+
# Iterate textdomains.
|
|
80
|
+
def each
|
|
81
|
+
@textdomains.each do |k, textdomain|
|
|
82
|
+
yield textdomain
|
|
83
|
+
end
|
|
84
|
+
self
|
|
85
|
+
end
|
|
86
|
+
|
|
87
|
+
# Sets locale such as "de", "fr", "it", "ko", "ja_JP.eucJP", "zh_CN.EUC" ...
|
|
88
|
+
#
|
|
89
|
+
# Notice that you shouldn't use this for your own Libraries.
|
|
90
|
+
# * locale: a locale string or Locale::Object.
|
|
91
|
+
# * force: Change locale forcely.
|
|
92
|
+
# * Returns: self
|
|
93
|
+
def set_locale(locale, force = false)
|
|
94
|
+
if locale != @locale or force
|
|
95
|
+
each do |textdomain|
|
|
96
|
+
textdomain.set_locale(locale)
|
|
97
|
+
end
|
|
98
|
+
@locale = locale
|
|
99
|
+
end
|
|
100
|
+
self
|
|
101
|
+
end
|
|
102
|
+
end
|
|
103
|
+
end
|
data/lib/gettext/version.rb
CHANGED
data/po/cs/rails.po
CHANGED
|
@@ -8,8 +8,8 @@
|
|
|
8
8
|
#
|
|
9
9
|
msgid ""
|
|
10
10
|
msgstr ""
|
|
11
|
-
"Project-Id-Version: ruby-gettext 1.
|
|
12
|
-
"POT-Creation-Date: 2006-04
|
|
11
|
+
"Project-Id-Version: ruby-gettext 1.5.0\n"
|
|
12
|
+
"POT-Creation-Date: 2006-06-04 18:48+0900\n"
|
|
13
13
|
"PO-Revision-Date: 2005-12-17 21:43+0100\n"
|
|
14
14
|
"Last-Translator: Karel Miarka <kajism@yahoo.com>\n"
|
|
15
15
|
"Language-Team: Czech\n"
|
|
@@ -20,62 +20,62 @@ msgstr ""
|
|
|
20
20
|
"10<=4 && (n%100<10 || n%100>=20) ? 1 : 2);\n"
|
|
21
21
|
"X-Poedit-Language: Czech\n"
|
|
22
22
|
|
|
23
|
-
#: lib/gettext/rails.rb:
|
|
23
|
+
#: lib/gettext/rails.rb:277
|
|
24
24
|
msgid "%{fn} is not included in the list"
|
|
25
25
|
msgstr "%{fn} není obsaženo v seznamu možností"
|
|
26
26
|
|
|
27
|
-
#: lib/gettext/rails.rb:
|
|
27
|
+
#: lib/gettext/rails.rb:278
|
|
28
28
|
msgid "%{fn} is reserved"
|
|
29
29
|
msgstr "%{fn} je rezervováno a nemůže být zvoleno"
|
|
30
30
|
|
|
31
|
-
#: lib/gettext/rails.rb:
|
|
31
|
+
#: lib/gettext/rails.rb:279
|
|
32
32
|
msgid "%{fn} is invalid"
|
|
33
33
|
msgstr "%{fn} je chybné"
|
|
34
34
|
|
|
35
|
-
#: lib/gettext/rails.rb:
|
|
35
|
+
#: lib/gettext/rails.rb:280
|
|
36
36
|
msgid "%{fn} doesn't match confirmation"
|
|
37
37
|
msgstr "%{fn} není shodné s potvrzením"
|
|
38
38
|
|
|
39
|
-
#: lib/gettext/rails.rb:
|
|
39
|
+
#: lib/gettext/rails.rb:281
|
|
40
40
|
msgid "%{fn} must be accepted"
|
|
41
41
|
msgstr "%{fn} musí být zaškrtnuto"
|
|
42
42
|
|
|
43
|
-
#: lib/gettext/rails.rb:
|
|
43
|
+
#: lib/gettext/rails.rb:282
|
|
44
44
|
msgid "%{fn} can't be empty"
|
|
45
45
|
msgstr "%{fn} musí být vyplněno"
|
|
46
46
|
|
|
47
|
-
#: lib/gettext/rails.rb:
|
|
47
|
+
#: lib/gettext/rails.rb:283
|
|
48
48
|
msgid "%{fn} can't be blank"
|
|
49
49
|
msgstr "%{fn} musí být vyplněno"
|
|
50
50
|
|
|
51
|
-
#: lib/gettext/rails.rb:
|
|
51
|
+
#: lib/gettext/rails.rb:284
|
|
52
52
|
msgid "%{fn} is too long (max is %d characters)"
|
|
53
53
|
msgstr "%{fn} je příliš dlouhé (maximum je %d znaků)"
|
|
54
54
|
|
|
55
|
-
#: lib/gettext/rails.rb:
|
|
55
|
+
#: lib/gettext/rails.rb:285
|
|
56
56
|
msgid "%{fn} is too short (min is %d characters)"
|
|
57
57
|
msgstr "%{fn} je příliš krátké (minimum je %d znaků)"
|
|
58
58
|
|
|
59
|
-
#: lib/gettext/rails.rb:
|
|
59
|
+
#: lib/gettext/rails.rb:286
|
|
60
60
|
msgid "%{fn} is the wrong length (should be %d characters)"
|
|
61
61
|
msgstr "%{fn} má nesprávnou délku (musí mít %d znaků)"
|
|
62
62
|
|
|
63
|
-
#: lib/gettext/rails.rb:
|
|
63
|
+
#: lib/gettext/rails.rb:287
|
|
64
64
|
msgid "%{fn} has already been taken"
|
|
65
65
|
msgstr "%{fn} je již použito"
|
|
66
66
|
|
|
67
|
-
#: lib/gettext/rails.rb:
|
|
67
|
+
#: lib/gettext/rails.rb:288
|
|
68
68
|
msgid "%{fn} is not a number"
|
|
69
69
|
msgstr "%{fn} není správné číslo"
|
|
70
70
|
|
|
71
|
-
#: lib/gettext/rails.rb:
|
|
71
|
+
#: lib/gettext/rails.rb:354
|
|
72
72
|
msgid "%{num} error prohibited this %{record} from being saved"
|
|
73
73
|
msgid_plural "%{num} errors prohibited this %{record} from being saved"
|
|
74
74
|
msgstr[0] "%{num} chyba znemožnila uložení záznamu %{record} "
|
|
75
75
|
msgstr[1] "%{num} chyby znemožnily uložení záznamu %{record} "
|
|
76
76
|
msgstr[2] "%{num} chyb znemožnilo uložení záznamu %{record} "
|
|
77
77
|
|
|
78
|
-
#: lib/gettext/rails.rb:
|
|
78
|
+
#: lib/gettext/rails.rb:356
|
|
79
79
|
msgid "There was a problem with the following field:"
|
|
80
80
|
msgid_plural "There were problems with the following fields:"
|
|
81
81
|
msgstr[0] "Problémy jsou s následujícím polem:"
|
data/po/cs/rgettext.po
CHANGED
|
@@ -8,8 +8,8 @@
|
|
|
8
8
|
#
|
|
9
9
|
msgid ""
|
|
10
10
|
msgstr ""
|
|
11
|
-
"Project-Id-Version: ruby-gettext 1.
|
|
12
|
-
"POT-Creation-Date: 2006-04
|
|
11
|
+
"Project-Id-Version: ruby-gettext 1.5.0\n"
|
|
12
|
+
"POT-Creation-Date: 2006-06-04 18:48+0900\n"
|
|
13
13
|
"PO-Revision-Date: 2005-12-17 21:55+0100\n"
|
|
14
14
|
"Last-Translator: Karel Miarka <kajism@yahoo.com>\n"
|
|
15
15
|
"Language-Team: Czech\n"
|
|
@@ -95,10 +95,14 @@ msgstr "'%{file}' nebyl nalezen."
|
|
|
95
95
|
msgid "Ignored '%{file}'. Solve dependencies first."
|
|
96
96
|
msgstr "'%{file}' ignorován. Nejprve vyřešte závislosti."
|
|
97
97
|
|
|
98
|
-
#: lib/gettext/parser/activerecord.rb:
|
|
98
|
+
#: lib/gettext/parser/activerecord.rb:85
|
|
99
99
|
msgid "No database is available."
|
|
100
100
|
msgstr "Žádná databáze není k dispozici."
|
|
101
101
|
|
|
102
|
+
#: lib/gettext/parser/activerecord.rb:116
|
|
103
|
+
msgid "rubygems are not found."
|
|
104
|
+
msgstr ""
|
|
105
|
+
|
|
102
106
|
#: lib/gettext/parser/glade.rb:75
|
|
103
107
|
msgid "%s is not glade-2.0 format."
|
|
104
108
|
msgstr "%s není ve formátu glade-2.0."
|
data/po/de/rails.po
CHANGED
|
@@ -8,8 +8,8 @@
|
|
|
8
8
|
#
|
|
9
9
|
msgid ""
|
|
10
10
|
msgstr ""
|
|
11
|
-
"Project-Id-Version: ruby-gettext 1.
|
|
12
|
-
"POT-Creation-Date: 2006-04
|
|
11
|
+
"Project-Id-Version: ruby-gettext 1.5.0\n"
|
|
12
|
+
"POT-Creation-Date: 2006-06-04 18:48+0900\n"
|
|
13
13
|
"PO-Revision-Date: 2005-12-27 17:00W. Europe Standard Time\n"
|
|
14
14
|
"Last-Translator: Sasa Ebach <se@digitale-wertschoepfung.de>\n"
|
|
15
15
|
"Language-Team: German\n"
|
|
@@ -18,55 +18,55 @@ msgstr ""
|
|
|
18
18
|
"Content-Transfer-Encoding: 8bit\n"
|
|
19
19
|
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
|
|
20
20
|
|
|
21
|
-
#: lib/gettext/rails.rb:
|
|
21
|
+
#: lib/gettext/rails.rb:277
|
|
22
22
|
msgid "%{fn} is not included in the list"
|
|
23
23
|
msgstr "%{fn} kommt nicht in der Liste vor"
|
|
24
24
|
|
|
25
|
-
#: lib/gettext/rails.rb:
|
|
25
|
+
#: lib/gettext/rails.rb:278
|
|
26
26
|
msgid "%{fn} is reserved"
|
|
27
27
|
msgstr "%{fn} ist reserviert"
|
|
28
28
|
|
|
29
|
-
#: lib/gettext/rails.rb:
|
|
29
|
+
#: lib/gettext/rails.rb:279
|
|
30
30
|
msgid "%{fn} is invalid"
|
|
31
31
|
msgstr "%{fn} ist ungültig"
|
|
32
32
|
|
|
33
|
-
#: lib/gettext/rails.rb:
|
|
33
|
+
#: lib/gettext/rails.rb:280
|
|
34
34
|
msgid "%{fn} doesn't match confirmation"
|
|
35
35
|
msgstr "%{fn} stimmt nicht mit der Bestätigung überein"
|
|
36
36
|
|
|
37
|
-
#: lib/gettext/rails.rb:
|
|
37
|
+
#: lib/gettext/rails.rb:281
|
|
38
38
|
msgid "%{fn} must be accepted"
|
|
39
39
|
msgstr "%{fn} muss akzeptiert werden"
|
|
40
40
|
|
|
41
|
-
#: lib/gettext/rails.rb:
|
|
41
|
+
#: lib/gettext/rails.rb:282
|
|
42
42
|
msgid "%{fn} can't be empty"
|
|
43
43
|
msgstr "%{fn} kann nicht leer sein"
|
|
44
44
|
|
|
45
|
-
#: lib/gettext/rails.rb:
|
|
45
|
+
#: lib/gettext/rails.rb:283
|
|
46
46
|
msgid "%{fn} can't be blank"
|
|
47
47
|
msgstr "%{fn} kann nicht leer sein"
|
|
48
48
|
|
|
49
|
-
#: lib/gettext/rails.rb:
|
|
49
|
+
#: lib/gettext/rails.rb:284
|
|
50
50
|
msgid "%{fn} is too long (max is %d characters)"
|
|
51
51
|
msgstr "%{fn} ist zu lang (max. %d Zeichen)"
|
|
52
52
|
|
|
53
|
-
#: lib/gettext/rails.rb:
|
|
53
|
+
#: lib/gettext/rails.rb:285
|
|
54
54
|
msgid "%{fn} is too short (min is %d characters)"
|
|
55
55
|
msgstr "%{fn} ist zu kurz (min. %d Zeichen)"
|
|
56
56
|
|
|
57
|
-
#: lib/gettext/rails.rb:
|
|
57
|
+
#: lib/gettext/rails.rb:286
|
|
58
58
|
msgid "%{fn} is the wrong length (should be %d characters)"
|
|
59
59
|
msgstr "%{fn} hat eine falsche Länge (sollte %d Zeichen lang sein)"
|
|
60
60
|
|
|
61
|
-
#: lib/gettext/rails.rb:
|
|
61
|
+
#: lib/gettext/rails.rb:287
|
|
62
62
|
msgid "%{fn} has already been taken"
|
|
63
63
|
msgstr "%{fn} existiert bereits"
|
|
64
64
|
|
|
65
|
-
#: lib/gettext/rails.rb:
|
|
65
|
+
#: lib/gettext/rails.rb:288
|
|
66
66
|
msgid "%{fn} is not a number"
|
|
67
67
|
msgstr "%{fn} ist keine Ziffer"
|
|
68
68
|
|
|
69
|
-
#: lib/gettext/rails.rb:
|
|
69
|
+
#: lib/gettext/rails.rb:354
|
|
70
70
|
msgid "%{num} error prohibited this %{record} from being saved"
|
|
71
71
|
msgid_plural "%{num} errors prohibited this %{record} from being saved"
|
|
72
72
|
msgstr[0] ""
|
|
@@ -75,7 +75,7 @@ msgstr[1] ""
|
|
|
75
75
|
"%{num} Fehler haben verhindert, dass dieser %{record} gespeichert werden "
|
|
76
76
|
"konnte"
|
|
77
77
|
|
|
78
|
-
#: lib/gettext/rails.rb:
|
|
78
|
+
#: lib/gettext/rails.rb:356
|
|
79
79
|
msgid "There was a problem with the following field:"
|
|
80
80
|
msgid_plural "There were problems with the following fields:"
|
|
81
81
|
msgstr[0] "Folgendes Feld hat Probleme verursacht:"
|