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.
Files changed (224) hide show
  1. data/ChangeLog +113 -0
  2. data/NEWS +17 -1
  3. data/README +56 -46
  4. data/Rakefile +6 -2
  5. data/data/locale/cs/LC_MESSAGES/rails.mo +0 -0
  6. data/data/locale/cs/LC_MESSAGES/rgettext.mo +0 -0
  7. data/data/locale/de/LC_MESSAGES/rails.mo +0 -0
  8. data/data/locale/de/LC_MESSAGES/rgettext.mo +0 -0
  9. data/data/locale/el/LC_MESSAGES/rails.mo +0 -0
  10. data/data/locale/el/LC_MESSAGES/rgettext.mo +0 -0
  11. data/data/locale/es/LC_MESSAGES/rails.mo +0 -0
  12. data/data/locale/es/LC_MESSAGES/rgettext.mo +0 -0
  13. data/data/locale/fr/LC_MESSAGES/rails.mo +0 -0
  14. data/data/locale/fr/LC_MESSAGES/rgettext.mo +0 -0
  15. data/data/locale/it/LC_MESSAGES/rails.mo +0 -0
  16. data/data/locale/it/LC_MESSAGES/rgettext.mo +0 -0
  17. data/data/locale/ja/LC_MESSAGES/rails.mo +0 -0
  18. data/data/locale/ja/LC_MESSAGES/rgettext.mo +0 -0
  19. data/data/locale/ko/LC_MESSAGES/rails.mo +0 -0
  20. data/data/locale/ko/LC_MESSAGES/rgettext.mo +0 -0
  21. data/data/locale/nl/LC_MESSAGES/rails.mo +0 -0
  22. data/data/locale/nl/LC_MESSAGES/rgettext.mo +0 -0
  23. data/data/locale/pt_BR/LC_MESSAGES/rails.mo +0 -0
  24. data/data/locale/pt_BR/LC_MESSAGES/rgettext.mo +0 -0
  25. data/data/locale/ru/LC_MESSAGES/rails.mo +0 -0
  26. data/data/locale/ru/LC_MESSAGES/rgettext.mo +0 -0
  27. data/data/locale/sv/LC_MESSAGES/rgettext.mo +0 -0
  28. data/data/locale/zh/LC_MESSAGES/rails.mo +0 -0
  29. data/data/locale/zh/LC_MESSAGES/rgettext.mo +0 -0
  30. data/ext/gettext/locale_system.c +3 -3
  31. data/lib/gettext.rb +149 -98
  32. data/lib/gettext/container.rb +3 -23
  33. data/lib/gettext/erb.rb +2 -2
  34. data/lib/gettext/locale_posix.rb +37 -5
  35. data/lib/gettext/locale_win32.rb +2 -1
  36. data/lib/gettext/mo.rb +6 -4
  37. data/lib/gettext/parser/activerecord.rb +7 -3
  38. data/lib/gettext/poparser.rb +2 -2
  39. data/lib/gettext/rails.rb +131 -112
  40. data/lib/gettext/rgettext.rb +3 -1
  41. data/lib/gettext/rmsgfmt.rb +3 -1
  42. data/lib/gettext/rmsgmerge.rb +3 -1
  43. data/lib/gettext/textdomain.rb +14 -8
  44. data/lib/gettext/textdomainmanager.rb +103 -0
  45. data/lib/gettext/version.rb +1 -1
  46. data/po/cs/rails.po +16 -16
  47. data/po/cs/rgettext.po +7 -3
  48. data/po/de/rails.po +16 -16
  49. data/po/de/rgettext.po +7 -3
  50. data/po/el/rails.po +16 -16
  51. data/po/el/rgettext.po +7 -3
  52. data/po/es/rails.po +16 -16
  53. data/po/es/rgettext.po +7 -3
  54. data/po/fr/rails.po +16 -16
  55. data/po/fr/rgettext.po +7 -3
  56. data/po/it/rails.po +79 -0
  57. data/po/it/rgettext.po +42 -32
  58. data/po/ja/rails.po +20 -18
  59. data/po/ja/rgettext.po +7 -3
  60. data/po/ko/rails.po +16 -16
  61. data/po/ko/rgettext.po +7 -3
  62. data/po/nl/rails.po +16 -16
  63. data/po/nl/rgettext.po +7 -3
  64. data/po/pt_BR/rails.po +16 -16
  65. data/po/pt_BR/rgettext.po +7 -3
  66. data/po/rails.pot +16 -16
  67. data/po/rgettext.pot +7 -3
  68. data/po/ru/rails.po +18 -18
  69. data/po/ru/rgettext.po +13 -9
  70. data/po/sv/rgettext.po +7 -3
  71. data/po/zh/rails.po +78 -0
  72. data/po/zh/rgettext.po +104 -0
  73. data/pre-setup.rb +1 -4
  74. data/samples/cgi/helloerb.rhtml +1 -0
  75. data/samples/cgi/locale/zh/LC_MESSAGES/helloerb1.mo +0 -0
  76. data/samples/cgi/locale/zh/LC_MESSAGES/helloerb2.mo +0 -0
  77. data/samples/cgi/locale/zh/LC_MESSAGES/hellolib.mo +0 -0
  78. data/samples/cgi/locale/zh/LC_MESSAGES/main.mo +0 -0
  79. data/samples/cgi/po/zh/helloerb1.po +60 -0
  80. data/samples/cgi/po/zh/helloerb2.po +52 -0
  81. data/samples/cgi/po/zh/hellolib.po +24 -0
  82. data/samples/cgi/po/zh/main.po +80 -0
  83. data/samples/hello.rb +28 -5
  84. data/samples/hello2.rb +13 -6
  85. data/samples/hello_noop.rb +20 -8
  86. data/samples/hello_plural.rb +16 -6
  87. data/samples/hello_textdomain.rb +13 -4
  88. data/samples/hellogtk.rb +5 -4
  89. data/samples/hellogtk2.rb +5 -6
  90. data/samples/locale/cs/LC_MESSAGES/hello2.mo +0 -0
  91. data/samples/locale/cs/LC_MESSAGES/hello_plural.mo +0 -0
  92. data/samples/locale/de/LC_MESSAGES/hello2.mo +0 -0
  93. data/samples/locale/de/LC_MESSAGES/hello_plural.mo +0 -0
  94. data/samples/locale/el/LC_MESSAGES/hello2.mo +0 -0
  95. data/samples/locale/el/LC_MESSAGES/hello_plural.mo +0 -0
  96. data/samples/locale/es/LC_MESSAGES/hello2.mo +0 -0
  97. data/samples/locale/es/LC_MESSAGES/hello_plural.mo +0 -0
  98. data/samples/locale/fr/LC_MESSAGES/hello2.mo +0 -0
  99. data/samples/locale/fr/LC_MESSAGES/hello_plural.mo +0 -0
  100. data/samples/locale/it/LC_MESSAGES/hello2.mo +0 -0
  101. data/samples/locale/it/LC_MESSAGES/hello_plural.mo +0 -0
  102. data/samples/locale/ja/LC_MESSAGES/hello2.mo +0 -0
  103. data/samples/locale/ja/LC_MESSAGES/hello_plural.mo +0 -0
  104. data/samples/locale/ko/LC_MESSAGES/hello2.mo +0 -0
  105. data/samples/locale/ko/LC_MESSAGES/hello_plural.mo +0 -0
  106. data/samples/locale/nl/LC_MESSAGES/hello2.mo +0 -0
  107. data/samples/locale/nl/LC_MESSAGES/hello_plural.mo +0 -0
  108. data/samples/locale/pt_BR/LC_MESSAGES/hello2.mo +0 -0
  109. data/samples/locale/pt_BR/LC_MESSAGES/hello_plural.mo +0 -0
  110. data/samples/locale/ru/LC_MESSAGES/hello2.mo +0 -0
  111. data/samples/locale/ru/LC_MESSAGES/hello_plural.mo +0 -0
  112. data/samples/locale/sv/LC_MESSAGES/hello2.mo +0 -0
  113. data/samples/locale/sv/LC_MESSAGES/hello_plural.mo +0 -0
  114. data/samples/locale/zh/LC_MESSAGES/hello.mo +0 -0
  115. data/samples/locale/zh/LC_MESSAGES/hello2.mo +0 -0
  116. data/samples/locale/zh/LC_MESSAGES/hello_noop.mo +0 -0
  117. data/samples/locale/zh/LC_MESSAGES/hello_plural.mo +0 -0
  118. data/samples/locale/zh/LC_MESSAGES/helloglade2.mo +0 -0
  119. data/samples/locale/zh/LC_MESSAGES/hellogtk.mo +0 -0
  120. data/samples/locale/zh/LC_MESSAGES/hellotk.mo +0 -0
  121. data/samples/po/cs/hello2.po +4 -4
  122. data/samples/po/cs/hello_plural.po +5 -5
  123. data/samples/po/de/hello2.po +4 -4
  124. data/samples/po/de/hello_plural.po +9 -6
  125. data/samples/po/el/hello2.po +4 -4
  126. data/samples/po/el/hello_plural.po +3 -3
  127. data/samples/po/es/hello2.po +4 -4
  128. data/samples/po/es/hello_plural.po +6 -6
  129. data/samples/po/fr/hello2.po +4 -4
  130. data/samples/po/fr/hello_plural.po +3 -3
  131. data/samples/po/hello2.pot +2 -2
  132. data/samples/po/hello_plural.pot +1 -1
  133. data/samples/po/it/hello2.po +4 -4
  134. data/samples/po/it/hello_plural.po +4 -5
  135. data/samples/po/ja/hello2.po +4 -4
  136. data/samples/po/ja/hello_plural.po +4 -5
  137. data/samples/po/ko/hello2.po +4 -4
  138. data/samples/po/ko/hello_plural.po +10 -7
  139. data/samples/po/nl/hello2.po +4 -4
  140. data/samples/po/nl/hello_plural.po +6 -7
  141. data/samples/po/pt_BR/hello2.po +4 -4
  142. data/samples/po/pt_BR/hello_plural.po +6 -6
  143. data/samples/po/ru/hello2.po +4 -4
  144. data/samples/po/ru/hello_plural.po +10 -7
  145. data/samples/po/sv/hello2.po +4 -4
  146. data/samples/po/sv/hello_plural.po +4 -4
  147. data/samples/po/zh/hello.po +23 -0
  148. data/samples/po/zh/hello2.po +31 -0
  149. data/samples/po/zh/hello_noop.po +27 -0
  150. data/samples/po/zh/hello_plural.po +25 -0
  151. data/samples/po/zh/helloglade2.po +31 -0
  152. data/samples/po/zh/hellogtk.po +23 -0
  153. data/samples/po/zh/hellotk.po +23 -0
  154. data/samples/rails/README +2 -2
  155. data/samples/rails/lib/tasks/gettext.rake +0 -3
  156. data/samples/rails/locale/cs/LC_MESSAGES/blog.mo +0 -0
  157. data/samples/rails/locale/de/LC_MESSAGES/blog.mo +0 -0
  158. data/samples/rails/locale/el/LC_MESSAGES/blog.mo +0 -0
  159. data/samples/rails/locale/en/LC_MESSAGES/blog.mo +0 -0
  160. data/samples/rails/locale/es/LC_MESSAGES/blog.mo +0 -0
  161. data/samples/rails/locale/fr/LC_MESSAGES/blog.mo +0 -0
  162. data/samples/rails/locale/it/LC_MESSAGES/blog.mo +0 -0
  163. data/samples/rails/locale/ja/LC_MESSAGES/blog.mo +0 -0
  164. data/samples/rails/locale/ko/LC_MESSAGES/blog.mo +0 -0
  165. data/samples/rails/locale/nl/LC_MESSAGES/blog.mo +0 -0
  166. data/samples/rails/locale/pt_BR/LC_MESSAGES/blog.mo +0 -0
  167. data/samples/rails/locale/ru/LC_MESSAGES/blog.mo +0 -0
  168. data/samples/rails/locale/zh/LC_MESSAGES/blog.mo +0 -0
  169. data/samples/rails/po/blog.pot +1 -1
  170. data/samples/rails/po/cs/blog.po +1 -1
  171. data/samples/rails/po/de/blog.po +1 -1
  172. data/samples/rails/po/el/blog.po +1 -1
  173. data/samples/rails/po/en/blog.po +3 -3
  174. data/samples/rails/po/es/blog.po +1 -1
  175. data/samples/rails/po/fr/blog.po +1 -1
  176. data/samples/rails/po/it/blog.po +109 -0
  177. data/samples/rails/po/ja/blog.po +1 -14
  178. data/samples/rails/po/ko/blog.po +2 -2
  179. data/samples/rails/po/nl/blog.po +1 -1
  180. data/samples/rails/po/pt_BR/blog.po +1 -1
  181. data/samples/rails/po/ru/blog.po +1 -2
  182. data/samples/rails/po/zh/blog.po +109 -0
  183. data/samples/rails/vendor/plugins/gettext/README +17 -0
  184. data/samples/rails/vendor/plugins/gettext/Rakefile +17 -0
  185. data/samples/rails/vendor/plugins/gettext/lib/gettext_plugin.rb +16 -35
  186. data/samples/rails/{locale → vendor/plugins/gettext/locale}/cs/LC_MESSAGES/gettext_plugin.mo +0 -0
  187. data/samples/rails/{locale → vendor/plugins/gettext/locale}/de/LC_MESSAGES/gettext_plugin.mo +0 -0
  188. data/samples/rails/{locale → vendor/plugins/gettext/locale}/el/LC_MESSAGES/gettext_plugin.mo +0 -0
  189. data/samples/rails/{locale → vendor/plugins/gettext/locale}/es/LC_MESSAGES/gettext_plugin.mo +0 -0
  190. data/samples/rails/{locale → vendor/plugins/gettext/locale}/fr/LC_MESSAGES/gettext_plugin.mo +0 -0
  191. data/samples/rails/vendor/plugins/gettext/locale/it/LC_MESSAGES/gettext_plugin.mo +0 -0
  192. data/samples/rails/{locale → vendor/plugins/gettext/locale}/ja/LC_MESSAGES/gettext_plugin.mo +0 -0
  193. data/samples/rails/{locale → vendor/plugins/gettext/locale}/ko/LC_MESSAGES/gettext_plugin.mo +0 -0
  194. data/samples/rails/{locale → vendor/plugins/gettext/locale}/nl/LC_MESSAGES/gettext_plugin.mo +0 -0
  195. data/samples/rails/{locale → vendor/plugins/gettext/locale}/pt_BR/LC_MESSAGES/gettext_plugin.mo +0 -0
  196. data/samples/rails/{locale → vendor/plugins/gettext/locale}/ru/LC_MESSAGES/gettext_plugin.mo +0 -0
  197. data/samples/rails/vendor/plugins/gettext/locale/zh/LC_MESSAGES/gettext_plugin.mo +0 -0
  198. data/samples/rails/{po → vendor/plugins/gettext/po}/cs/gettext_plugin.po +4 -4
  199. data/samples/rails/{po → vendor/plugins/gettext/po}/de/gettext_plugin.po +4 -4
  200. data/samples/rails/{po → vendor/plugins/gettext/po}/el/gettext_plugin.po +4 -4
  201. data/samples/rails/{po → vendor/plugins/gettext/po}/es/gettext_plugin.po +4 -4
  202. data/samples/rails/{po → vendor/plugins/gettext/po}/fr/gettext_plugin.po +4 -4
  203. data/samples/rails/{po → vendor/plugins/gettext/po}/gettext_plugin.pot +4 -4
  204. data/samples/rails/vendor/plugins/gettext/po/it/gettext_plugin.po +27 -0
  205. data/samples/rails/{po → vendor/plugins/gettext/po}/ja/gettext_plugin.po +4 -4
  206. data/samples/rails/{po → vendor/plugins/gettext/po}/ko/gettext_plugin.po +4 -4
  207. data/samples/rails/{po → vendor/plugins/gettext/po}/nl/gettext_plugin.po +4 -4
  208. data/samples/rails/{po → vendor/plugins/gettext/po}/pt_BR/gettext_plugin.po +4 -4
  209. data/samples/rails/{po → vendor/plugins/gettext/po}/ru/gettext_plugin.po +4 -5
  210. data/samples/rails/vendor/plugins/gettext/po/zh/gettext_plugin.po +27 -0
  211. data/test/gettext_test.rb +18 -14
  212. data/test/gettext_test_multi_textdomain.rb +49 -0
  213. data/test/locale/fr/LC_MESSAGES/test6.mo +0 -0
  214. data/test/locale/ja/LC_MESSAGES/test6.mo +0 -0
  215. data/test/po/fr/test6.po +23 -0
  216. data/test/po/ja/test6.po +23 -0
  217. data/test/test.sh +3 -1
  218. data/test/testlib1.rb +0 -5
  219. data/test/testlib5.rb +70 -0
  220. data/test/testlib6.rb +19 -0
  221. metadata +128 -26
  222. data/COPYING.ja +0 -51
  223. data/po/it/messages.mo +0 -0
  224. data/samples/cgi/po/it/messages.mo +0 -0
@@ -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/02/22 16:42:41 $)[1]
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
 
@@ -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/02/22 16:42:41 $)[1] # :nodoc:
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)
@@ -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/02/23 14:53:59 $)[1]
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
 
@@ -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.16 2006/04/29 17:17:15 mutoh Exp $
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['prefix']}/share/locale/%{locale}/LC_MESSAGES/%{name}.mo",
52
- "#{Config::CONFIG['prefix']}/local/share/locale/%{locale}/LC_MESSAGES/%{name}.mo"
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
- msgid
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 == key
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
@@ -8,5 +8,5 @@
8
8
  license terms as Ruby.
9
9
  =end
10
10
  module GetText
11
- VERSION = "1.5.0"
11
+ VERSION = "1.6.0"
12
12
  end
@@ -8,8 +8,8 @@
8
8
  #
9
9
  msgid ""
10
10
  msgstr ""
11
- "Project-Id-Version: ruby-gettext 1.4.0\n"
12
- "POT-Creation-Date: 2006-04-17 23:03+0900\n"
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:263
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:264
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:265
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:266
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:267
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:268
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:269
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:270
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:271
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:272
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:273
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:274
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:337
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:339
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:"
@@ -8,8 +8,8 @@
8
8
  #
9
9
  msgid ""
10
10
  msgstr ""
11
- "Project-Id-Version: ruby-gettext 1.4.0\n"
12
- "POT-Creation-Date: 2006-04-17 23:02+0900\n"
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:84
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."
@@ -8,8 +8,8 @@
8
8
  #
9
9
  msgid ""
10
10
  msgstr ""
11
- "Project-Id-Version: ruby-gettext 1.4.0\n"
12
- "POT-Creation-Date: 2006-04-17 23:03+0900\n"
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:263
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:264
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:265
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:266
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:267
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:268
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:269
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:270
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:271
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:272
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:273
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:274
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:337
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:339
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:"