ofm_gettext 2.0.0 → 2.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (45) hide show
  1. data/COPYING +56 -0
  2. data/ChangeLog-1 +2016 -0
  3. data/NEWS-1 +414 -0
  4. data/gettext.gemspec +7 -8
  5. data/lib/gettext/runtime/class_info.rb +69 -0
  6. data/lib/gettext/runtime/locale_path.rb +123 -0
  7. data/lib/gettext/runtime/mofile.rb +332 -0
  8. data/lib/gettext/runtime/textdomain.rb +179 -0
  9. data/lib/gettext/runtime/textdomain_group.rb +26 -0
  10. data/lib/gettext/runtime/textdomain_manager.rb +214 -0
  11. data/lib/gettext/tools/parser/erb.rb +54 -0
  12. data/lib/gettext/tools/parser/glade.rb +100 -0
  13. data/lib/gettext/tools/parser/ruby.rb +226 -0
  14. data/lib/gettext/tools/pomessage.rb +199 -0
  15. data/lib/gettext/tools/poparser.rb +358 -0
  16. data/po/uk/rgettext.po +143 -0
  17. data/samples/cgi/po/uk/helloerb1.po +62 -0
  18. data/samples/cgi/po/uk/helloerb2.po +54 -0
  19. data/samples/cgi/po/uk/hellolib.po +26 -0
  20. data/samples/cgi/po/uk/main.po +84 -0
  21. data/samples/po/uk/hello.po +22 -0
  22. data/samples/po/uk/hello2.po +30 -0
  23. data/samples/po/uk/hello_glade2.po +34 -0
  24. data/samples/po/uk/hello_gtk.po +22 -0
  25. data/samples/po/uk/hello_noop.po +26 -0
  26. data/samples/po/uk/hello_plural.po +29 -0
  27. data/samples/po/uk/hello_tk.po +26 -0
  28. data/test/po/ja/test3.po +19 -0
  29. data/test/po/li/plural_error.po +27 -0
  30. data/test/test_locale_path.rb +76 -0
  31. data/test/test_po_generation.rb +22 -0
  32. data/test/test_pomessage.rb +101 -0
  33. data/test/test_textdomain_bind.rb +39 -0
  34. data/test/test_thread.rb +43 -0
  35. data/test/tools/files/app.pot +0 -0
  36. data/test/tools/files/de/app.po +0 -0
  37. data/test/tools/files/en/app.po +0 -0
  38. data/test/tools/files/en/test.po +21 -0
  39. data/test/tools/files/simple_1.po +2 -0
  40. data/test/tools/files/simple_2.po +2 -0
  41. data/test/tools/files/simple_translation.rb +3 -0
  42. data/test/tools/files/version.po +7 -0
  43. data/test/tools/test.pot +21 -0
  44. data/test/tools/test_tools.rb +63 -0
  45. metadata +380 -335
@@ -0,0 +1,358 @@
1
+ # encoding: utf-8
2
+
3
+ =begin
4
+ poparser.rb - Generate a .mo
5
+
6
+ Copyright (C) 2003-2009 Masao Mutoh <mutomasa at gmail.com>
7
+
8
+ You may redistribute it and/or modify it under the same
9
+ license terms as Ruby.
10
+ =end
11
+
12
+ #
13
+ # DO NOT MODIFY!!!!
14
+ # This file is automatically generated by Racc 1.4.6
15
+ # from Racc grammer file "".
16
+ #
17
+
18
+ require 'racc/parser.rb'
19
+ module GetText
20
+ class PoParser < Racc::Parser
21
+
22
+ module_eval(<<'...end poparser.ry/module_eval...', 'poparser.ry', 108)
23
+ include GetText
24
+ GetText.bindtextdomain("rgettext")
25
+
26
+ def unescape(orig)
27
+ ret = orig.gsub(/\\n/, "\n")
28
+ ret.gsub!(/\\t/, "\t")
29
+ ret.gsub!(/\\r/, "\r")
30
+ ret.gsub!(/\\"/, "\"")
31
+ ret
32
+ end
33
+
34
+ def parse(str, data, ignore_fuzzy = true)
35
+ @comments = []
36
+ @data = data
37
+ @fuzzy = false
38
+ @msgctxt = ""
39
+ $ignore_fuzzy = ignore_fuzzy
40
+
41
+ str.strip!
42
+ @q = []
43
+ until str.empty? do
44
+ case str
45
+ when /\A\s+/
46
+ str = $'
47
+ when /\Amsgctxt/
48
+ @q.push [:MSGCTXT, $&]
49
+ str = $'
50
+ when /\Amsgid_plural/
51
+ @q.push [:MSGID_PLURAL, $&]
52
+ str = $'
53
+ when /\Amsgid/
54
+ @q.push [:MSGID, $&]
55
+ str = $'
56
+ when /\Amsgstr/
57
+ @q.push [:MSGSTR, $&]
58
+ str = $'
59
+ when /\A\[(\d+)\]/
60
+ @q.push [:PLURAL_NUM, $1]
61
+ str = $'
62
+ when /\A\#~(.*)/
63
+ $stderr.print _("Warning: obsolete msgid exists.\n")
64
+ $stderr.print " #{$&}\n"
65
+ @q.push [:COMMENT, $&]
66
+ str = $'
67
+ when /\A\#(.*)/
68
+ @q.push [:COMMENT, $&]
69
+ str = $'
70
+ when /\A\"(.*)\"/
71
+ @q.push [:STRING, $1]
72
+ str = $'
73
+ else
74
+ #c = str[0,1]
75
+ #@q.push [:STRING, c]
76
+ str = str[1..-1]
77
+ end
78
+ end
79
+ @q.push [false, '$end']
80
+ if $DEBUG
81
+ @q.each do |a,b|
82
+ puts "[#{a}, #{b}]"
83
+ end
84
+ end
85
+ @yydebug = true if $DEBUG
86
+ do_parse
87
+
88
+ if @comments.size > 0
89
+ @data.set_comment(:last, @comments.join("\n"))
90
+ end
91
+ @data
92
+ end
93
+
94
+ def next_token
95
+ @q.shift
96
+ end
97
+
98
+ def on_message(msgid, msgstr)
99
+ if msgstr.size > 0
100
+ @data[msgid] = msgstr
101
+ @data.set_comment(msgid, @comments.join("\n"))
102
+ end
103
+ @comments.clear
104
+ @msgctxt = ""
105
+ end
106
+
107
+ def on_comment(comment)
108
+ @fuzzy = true if (/fuzzy/ =~ comment)
109
+ @comments << comment
110
+ end
111
+
112
+ def parse_file(po_file, data, ignore_fuzzy = true)
113
+ args = [ po_file ]
114
+ # In Ruby 1.9, we must detect proper encoding of a PO file.
115
+ if String.instance_methods.include?(:encode)
116
+ encoding = detect_file_encoding(po_file)
117
+ args << "r:#{encoding}"
118
+ end
119
+ @po_file = po_file
120
+ parse(File.open(*args) {|io| io.read }, data, ignore_fuzzy)
121
+ end
122
+
123
+ def detect_file_encoding(po_file)
124
+ open(po_file, :encoding => 'ASCII-8BIT') do |input|
125
+ input.lines.each do |line|
126
+ return Encoding.find($1) if %r["Content-Type:.*\scharset=(.*)\\n"] =~ line
127
+ end
128
+ end
129
+ Encoding.default_external
130
+ end
131
+ private :detect_file_encoding
132
+ ...end poparser.ry/module_eval...
133
+ ##### State transition tables begin ###
134
+
135
+ racc_action_table = [
136
+ 3, 13, 5, 7, 9, 15, 16, 17, 20, 17,
137
+ 13, 17, 13, 13, 11, 17, 23, 20, 13, 17 ]
138
+
139
+ racc_action_check = [
140
+ 1, 16, 1, 1, 1, 12, 12, 12, 18, 18,
141
+ 7, 14, 15, 9, 3, 19, 20, 21, 23, 25 ]
142
+
143
+ racc_action_pointer = [
144
+ nil, 0, nil, 14, nil, nil, nil, 3, nil, 6,
145
+ nil, nil, 0, nil, 4, 5, -6, nil, 2, 8,
146
+ 8, 11, nil, 11, nil, 12 ]
147
+
148
+ racc_action_default = [
149
+ -1, -16, -2, -16, -3, -13, -4, -16, -6, -16,
150
+ -7, 26, -16, -15, -5, -16, -16, -14, -16, -8,
151
+ -16, -9, -11, -16, -10, -12 ]
152
+
153
+ racc_goto_table = [
154
+ 12, 22, 14, 4, 24, 6, 2, 8, 18, 19,
155
+ 10, 21, 1, nil, nil, nil, 25 ]
156
+
157
+ racc_goto_check = [
158
+ 5, 9, 5, 3, 9, 4, 2, 6, 5, 5,
159
+ 7, 8, 1, nil, nil, nil, 5 ]
160
+
161
+ racc_goto_pointer = [
162
+ nil, 12, 5, 2, 4, -7, 6, 9, -7, -17 ]
163
+
164
+ racc_goto_default = [
165
+ nil, nil, nil, nil, nil, nil, nil, nil, nil, nil ]
166
+
167
+ racc_reduce_table = [
168
+ 0, 0, :racc_error,
169
+ 0, 10, :_reduce_none,
170
+ 2, 10, :_reduce_none,
171
+ 2, 10, :_reduce_none,
172
+ 2, 10, :_reduce_none,
173
+ 2, 12, :_reduce_5,
174
+ 1, 13, :_reduce_none,
175
+ 1, 13, :_reduce_none,
176
+ 4, 15, :_reduce_8,
177
+ 5, 16, :_reduce_9,
178
+ 2, 17, :_reduce_10,
179
+ 1, 17, :_reduce_none,
180
+ 3, 18, :_reduce_12,
181
+ 1, 11, :_reduce_13,
182
+ 2, 14, :_reduce_14,
183
+ 1, 14, :_reduce_15 ]
184
+
185
+ racc_reduce_n = 16
186
+
187
+ racc_shift_n = 26
188
+
189
+ racc_token_table = {
190
+ false => 0,
191
+ :error => 1,
192
+ :COMMENT => 2,
193
+ :MSGID => 3,
194
+ :MSGCTXT => 4,
195
+ :MSGID_PLURAL => 5,
196
+ :MSGSTR => 6,
197
+ :STRING => 7,
198
+ :PLURAL_NUM => 8 }
199
+
200
+ racc_nt_base = 9
201
+
202
+ racc_use_result_var = true
203
+
204
+ Racc_arg = [
205
+ racc_action_table,
206
+ racc_action_check,
207
+ racc_action_default,
208
+ racc_action_pointer,
209
+ racc_goto_table,
210
+ racc_goto_check,
211
+ racc_goto_default,
212
+ racc_goto_pointer,
213
+ racc_nt_base,
214
+ racc_reduce_table,
215
+ racc_token_table,
216
+ racc_shift_n,
217
+ racc_reduce_n,
218
+ racc_use_result_var ]
219
+
220
+ Racc_token_to_s_table = [
221
+ "$end",
222
+ "error",
223
+ "COMMENT",
224
+ "MSGID",
225
+ "MSGCTXT",
226
+ "MSGID_PLURAL",
227
+ "MSGSTR",
228
+ "STRING",
229
+ "PLURAL_NUM",
230
+ "$start",
231
+ "msgfmt",
232
+ "comment",
233
+ "msgctxt",
234
+ "message",
235
+ "string_list",
236
+ "single_message",
237
+ "plural_message",
238
+ "msgstr_plural",
239
+ "msgstr_plural_line" ]
240
+
241
+ Racc_debug_parser = true
242
+
243
+ ##### State transition tables end #####
244
+
245
+ # reduce 0 omitted
246
+
247
+ # reduce 1 omitted
248
+
249
+ # reduce 2 omitted
250
+
251
+ # reduce 3 omitted
252
+
253
+ # reduce 4 omitted
254
+
255
+ module_eval(<<'.,.,', 'poparser.ry', 23)
256
+ def _reduce_5(val, _values, result)
257
+ @msgctxt = unescape(val[1]) + "\004"
258
+
259
+ result
260
+ end
261
+ .,.,
262
+
263
+ # reduce 6 omitted
264
+
265
+ # reduce 7 omitted
266
+
267
+ module_eval(<<'.,.,', 'poparser.ry', 35)
268
+ def _reduce_8(val, _values, result)
269
+ if @fuzzy and $ignore_fuzzy
270
+ if val[1] != ""
271
+ $stderr.print _("Warning: fuzzy message was ignored.\n")
272
+ $stderr.print " #{@po_file}: msgid '#{val[1]}'\n"
273
+ else
274
+ on_message('', unescape(val[3]))
275
+ end
276
+ @fuzzy = false
277
+ else
278
+ on_message(@msgctxt + unescape(val[1]), unescape(val[3]))
279
+ end
280
+ result = ""
281
+
282
+ result
283
+ end
284
+ .,.,
285
+
286
+ module_eval(<<'.,.,', 'poparser.ry', 52)
287
+ def _reduce_9(val, _values, result)
288
+ if @fuzzy and $ignore_fuzzy
289
+ if val[1] != ""
290
+ $stderr.print _("Warning: fuzzy message was ignored.\n")
291
+ $stderr.print "msgid = '#{val[1]}\n"
292
+ else
293
+ on_message('', unescape(val[3]))
294
+ end
295
+ @fuzzy = false
296
+ else
297
+ on_message(@msgctxt + unescape(val[1]) + "\000" + unescape(val[3]), unescape(val[4]))
298
+ end
299
+ result = ""
300
+
301
+ result
302
+ end
303
+ .,.,
304
+
305
+ module_eval(<<'.,.,', 'poparser.ry', 70)
306
+ def _reduce_10(val, _values, result)
307
+ if val[0].size > 0
308
+ result = val[0] + "\000" + val[1]
309
+ else
310
+ result = ""
311
+ end
312
+
313
+ result
314
+ end
315
+ .,.,
316
+
317
+ # reduce 11 omitted
318
+
319
+ module_eval(<<'.,.,', 'poparser.ry', 82)
320
+ def _reduce_12(val, _values, result)
321
+ result = val[2]
322
+
323
+ result
324
+ end
325
+ .,.,
326
+
327
+ module_eval(<<'.,.,', 'poparser.ry', 89)
328
+ def _reduce_13(val, _values, result)
329
+ on_comment(val[0])
330
+
331
+ result
332
+ end
333
+ .,.,
334
+
335
+ module_eval(<<'.,.,', 'poparser.ry', 97)
336
+ def _reduce_14(val, _values, result)
337
+ result = val.delete_if{|item| item == ""}.join
338
+
339
+ result
340
+ end
341
+ .,.,
342
+
343
+ module_eval(<<'.,.,', 'poparser.ry', 101)
344
+ def _reduce_15(val, _values, result)
345
+ result = val[0]
346
+
347
+ result
348
+ end
349
+ .,.,
350
+
351
+ def _reduce_none(val, _values, result)
352
+ val[0]
353
+ end
354
+
355
+ end # class PoParser
356
+ end # module GetText
357
+
358
+
@@ -0,0 +1,143 @@
1
+ # translation of rgettext.po to Ukrainian
2
+ #
3
+ # a po-file for Ruby-GetText-Package
4
+ #
5
+ # Copyright (C) 2004-2008 Masao Mutoh
6
+ #
7
+ # This file is distributed under the same license as the Ruby-GetText-Package.
8
+ #
9
+ # Alex Rootoff, 2007,2008
10
+ #
11
+ msgid ""
12
+ msgstr ""
13
+ "Project-Id-Version: ruby-gettext 2.1.0\n"
14
+ "POT-Creation-Date: 2010-06-25 01:16+0900\n"
15
+ "PO-Revision-Date: 2008-07-14 05:33+0200\n"
16
+ "Last-Translator: Alex Rootoff <rootoff at pisem.net>\n"
17
+ "Language-Team: Ukrainian\n"
18
+ "MIME-Version: 1.0\n"
19
+ "Content-Type: text/plain; charset=UTF-8\n"
20
+ "Content-Transfer-Encoding: 8bit\n"
21
+ "Plural-Forms: nplurals=3; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && n%"
22
+ "10<=4 && (n%100<10 || n%100>=20) ? 1 : 2);\n"
23
+ "n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2);\n"
24
+ "n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2);\n"
25
+
26
+ #: lib/gettext/tools/rmsgmerge.rb:402
27
+ msgid "Usage: %s def.po ref.pot [-o output.pot]"
28
+ msgstr "Використання: %s def.po ref.pot [-o output.pot]"
29
+
30
+ #: lib/gettext/tools/rmsgmerge.rb:405
31
+ msgid ""
32
+ "Merges two Uniforum style .po files together. The def.po file is an existing "
33
+ "PO file with translations. The ref.pot file is the last created PO file with "
34
+ "up-to-date source references. ref.pot is generally created by rgettext."
35
+ msgstr ""
36
+ "Об'єднує файли .po Uniforum формату. В файлі def.po зберігаються уже "
37
+ "перекладені стрічки. Файл ref.pot є оновленою версією PO файлу із вихідних "
38
+ "текстів і не містить перекладів. ref.pot зазвичай створюють за допомогою "
39
+ "програми rgettext."
40
+
41
+ #: lib/gettext/tools/rmsgmerge.rb:407 lib/gettext/tools/rgettext.rb:176
42
+ #: lib/gettext/tools/rmsgfmt.rb:50
43
+ msgid "Specific options:"
44
+ msgstr "Додаткові параметри:"
45
+
46
+ #: lib/gettext/tools/rmsgmerge.rb:409 lib/gettext/tools/rgettext.rb:178
47
+ #: lib/gettext/tools/rmsgfmt.rb:52
48
+ msgid "write output to specified file"
49
+ msgstr "записати результат у вказаний файл"
50
+
51
+ #: lib/gettext/tools/rmsgmerge.rb:420 lib/gettext/tools/rgettext.rb:195
52
+ #: lib/gettext/tools/rmsgfmt.rb:56
53
+ msgid "display version information and exit"
54
+ msgstr "показати інформацію про версію і завершити роботу"
55
+
56
+ #: lib/gettext/tools/rmsgmerge.rb:446
57
+ msgid "definition po is not given."
58
+ msgstr "не вказано файл def.po."
59
+
60
+ #: lib/gettext/tools/rmsgmerge.rb:448
61
+ msgid "reference pot is not given."
62
+ msgstr "не вказано файл ref.po."
63
+
64
+ #: lib/gettext/tools/parser/glade.rb:73
65
+ msgid "`%{file}' is not glade-2.0 format."
66
+ msgstr "`%{file}' не в форматі glade-2.0."
67
+
68
+ #: lib/gettext/tools/rgettext.rb:40
69
+ msgid "'%{klass}' is ignored."
70
+ msgstr "проігноровано '%{klass}'."
71
+
72
+ #: lib/gettext/tools/rgettext.rb:161
73
+ msgid "Error parsing %{path}"
74
+ msgstr ""
75
+
76
+ #: lib/gettext/tools/rgettext.rb:172
77
+ msgid "Usage: %s input.rb [-r parser.rb] [-o output.pot]"
78
+ msgstr "Використання: %s input.rb [-r parser.rb] [-o output.pot]"
79
+
80
+ #: lib/gettext/tools/rgettext.rb:174
81
+ msgid "Extract translatable strings from given input files."
82
+ msgstr "Витягувати стрічки для перекладу із вказаних вхідних файлів."
83
+
84
+ #: lib/gettext/tools/rgettext.rb:182
85
+ msgid "File '%s' already exists."
86
+ msgstr "Файл '%s' уже існує."
87
+
88
+ #: lib/gettext/tools/rgettext.rb:187
89
+ msgid "require the library before executing rgettext"
90
+ msgstr "для виконання rgettext необхідна бібліотека"
91
+
92
+ #: lib/gettext/tools/rgettext.rb:191
93
+ msgid "run in debugging mode"
94
+ msgstr "запуск в режимі відлагодження"
95
+
96
+ #: lib/gettext/tools/rgettext.rb:218 lib/gettext/tools/rmsgfmt.rb:29
97
+ msgid "no input files"
98
+ msgstr "не задані вхідні файли"
99
+
100
+ #: lib/gettext/tools/rmsgfmt.rb:46
101
+ msgid "Usage: %s input.po [-o output.mo]"
102
+ msgstr "Використання: %s input.po [-o output.mo]"
103
+
104
+ #: lib/gettext/tools/rmsgfmt.rb:48
105
+ msgid "Generate binary message catalog from textual translation description."
106
+ msgstr "Генерує бінарний каталог повідомлень із перекладу."
107
+
108
+ #: lib/gettext/tools.rb:68
109
+ msgid "Failed to merge with %{defpo}"
110
+ msgstr "Не вдалось об'єднати із %{defpo}"
111
+
112
+ #: lib/gettext/tools.rb:69
113
+ msgid "New .pot was copied to %{failed_filename}"
114
+ msgstr "Новий файл .pot скопійовано в %{failed_filename}"
115
+
116
+ #: lib/gettext/tools.rb:70
117
+ msgid "Check these po/pot-files. It may have syntax errors or something wrong."
118
+ msgstr ""
119
+ "Будь ласка, перевірте ці po/pot-файли. Схоже, що вони містять синтаксичні "
120
+ "помилки."
121
+
122
+ #: lib/gettext/tools.rb:173
123
+ msgid ""
124
+ "`%{cmd}' can not be found. \n"
125
+ "Install GNU Gettext then set PATH or MSGMERGE_PATH correctly."
126
+ msgstr ""
127
+
128
+ #: lib/gettext/runtime/textdomain_manager.rb:147
129
+ #, fuzzy
130
+ msgid "ngettext: 3rd parmeter is wrong: value = %{number}"
131
+ msgstr "Третій параметр неправильний: value = %{number}"
132
+
133
+ #: lib/gettext/runtime/textdomain_manager.rb:153
134
+ msgid "ngettext: 3rd parameter should be a number, not nil."
135
+ msgstr ""
136
+
137
+ #: src/poparser.ry:38 src/poparser.ry:55
138
+ msgid "Warning: fuzzy message was ignored.\n"
139
+ msgstr "Попередження: проігноровано неточний переклад повідомлення.\n"
140
+
141
+ #: src/poparser.ry:148
142
+ msgid "Warning: obsolete msgid exists.\n"
143
+ msgstr "Попередження: є застаріла стрічка msgid.\n"