gettext 2.3.3 → 2.3.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (79) hide show
  1. data/doc/text/news.md +37 -0
  2. data/gettext.gemspec +1 -0
  3. data/lib/gettext/runtime/mo.rb +382 -0
  4. data/lib/gettext/runtime/mofile.rb +24 -366
  5. data/lib/gettext/runtime/textdomain.rb +17 -17
  6. data/lib/gettext/tools.rb +1 -1
  7. data/lib/gettext/tools/msgfmt.rb +2 -2
  8. data/lib/gettext/tools/msginit.rb +16 -15
  9. data/lib/gettext/tools/msgmerge.rb +258 -255
  10. data/lib/gettext/tools/parser/ruby.rb +24 -24
  11. data/lib/gettext/tools/po.rb +256 -0
  12. data/lib/gettext/tools/po_entry.rb +355 -0
  13. data/lib/gettext/tools/poparser.rb +118 -16
  14. data/lib/gettext/tools/xgettext.rb +56 -58
  15. data/lib/gettext/version.rb +1 -1
  16. data/samples/po/hello.pot +3 -3
  17. data/samples/po/hello2.pot +3 -3
  18. data/samples/po/hello_glade2.pot +3 -3
  19. data/samples/po/hello_gtk2.pot +3 -3
  20. data/samples/po/hello_noop.pot +3 -3
  21. data/samples/po/hello_plural.pot +3 -3
  22. data/samples/po/hello_tk.pot +3 -3
  23. data/src/poparser.ry +111 -9
  24. data/test/parser/test_ruby.rb +17 -13
  25. data/test/po/_.pot +3 -3
  26. data/test/po/backslash.pot +3 -3
  27. data/test/po/non_ascii.pot +3 -3
  28. data/test/po/np_.pot +5 -4
  29. data/test/po/ns_.pot +3 -3
  30. data/test/po/p_.pot +3 -3
  31. data/test/po/s_.pot +3 -3
  32. data/test/po/untranslated.pot +3 -3
  33. data/test/{test_mofile.rb → test_mo.rb} +3 -3
  34. data/test/test_parser.rb +13 -12
  35. data/test/test_po_entry.rb +329 -0
  36. data/test/test_po_parser.rb +209 -8
  37. data/test/tools/test_msginit.rb +0 -2
  38. data/test/tools/test_msgmerge.rb +427 -50
  39. data/test/tools/test_po.rb +487 -0
  40. data/test/tools/test_xgettext.rb +1 -1
  41. metadata +28 -45
  42. data/data/locale/de/LC_MESSAGES/gettext.mo +0 -0
  43. data/data/locale/de/LC_MESSAGES/rgettext.mo +0 -0
  44. data/data/locale/el/LC_MESSAGES/gettext.mo +0 -0
  45. data/data/locale/el/LC_MESSAGES/rgettext.mo +0 -0
  46. data/data/locale/sr/LC_MESSAGES/gettext.mo +0 -0
  47. data/data/locale/sr/LC_MESSAGES/rgettext.mo +0 -0
  48. data/data/locale/uk/LC_MESSAGES/gettext.mo +0 -0
  49. data/data/locale/uk/LC_MESSAGES/rgettext.mo +0 -0
  50. data/lib/gettext/tools/pomessage.rb +0 -232
  51. data/samples/locale/bg/LC_MESSAGES/hello_gtk.mo +0 -0
  52. data/samples/locale/bs/LC_MESSAGES/hello_gtk.mo +0 -0
  53. data/samples/locale/ca/LC_MESSAGES/hello_gtk.mo +0 -0
  54. data/samples/locale/cs/LC_MESSAGES/hello_gtk.mo +0 -0
  55. data/samples/locale/de/LC_MESSAGES/hello_gtk.mo +0 -0
  56. data/samples/locale/el/LC_MESSAGES/hello_gtk.mo +0 -0
  57. data/samples/locale/eo/LC_MESSAGES/hello_gtk.mo +0 -0
  58. data/samples/locale/es/LC_MESSAGES/hello_gtk.mo +0 -0
  59. data/samples/locale/fr/LC_MESSAGES/hello_gtk.mo +0 -0
  60. data/samples/locale/hr/LC_MESSAGES/hello_gtk.mo +0 -0
  61. data/samples/locale/hu/LC_MESSAGES/hello_gtk.mo +0 -0
  62. data/samples/locale/it/LC_MESSAGES/hello_gtk.mo +0 -0
  63. data/samples/locale/ja/LC_MESSAGES/hello_gtk.mo +0 -0
  64. data/samples/locale/ko/LC_MESSAGES/hello_gtk.mo +0 -0
  65. data/samples/locale/lv/LC_MESSAGES/hello_gtk.mo +0 -0
  66. data/samples/locale/nb/LC_MESSAGES/hello_gtk.mo +0 -0
  67. data/samples/locale/nl/LC_MESSAGES/hello_gtk.mo +0 -0
  68. data/samples/locale/pt_BR/LC_MESSAGES/hello_gtk.mo +0 -0
  69. data/samples/locale/ru/LC_MESSAGES/hello_gtk.mo +0 -0
  70. data/samples/locale/sr/LC_MESSAGES/hello_gtk.mo +0 -0
  71. data/samples/locale/sv/LC_MESSAGES/hello_gtk.mo +0 -0
  72. data/samples/locale/uk/LC_MESSAGES/hello_gtk.mo +0 -0
  73. data/samples/locale/vi/LC_MESSAGES/hello_gtk.mo +0 -0
  74. data/samples/locale/zh/LC_MESSAGES/hello_gtk.mo +0 -0
  75. data/samples/locale/zh_TW/LC_MESSAGES/hello_gtk.mo +0 -0
  76. data/test/po/ascii.pot +0 -23
  77. data/test/po/no_exist_msgid.pot +0 -20
  78. data/test/po/not_existed_msgid.pot +0 -20
  79. data/test/test_po_message.rb +0 -118
data/test/po/ascii.pot DELETED
@@ -1,23 +0,0 @@
1
- # SOME DESCRIPTIVE TITLE.
2
- # Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
3
- # This file is distributed under the same license as the gettext package.
4
- # FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
5
- #
6
- #, fuzzy
7
- msgid ""
8
- msgstr ""
9
- "Project-Id-Version: gettext 2.3.1\n"
10
- "Report-Msgid-Bugs-To: \n"
11
- "POT-Creation-Date: 2012-09-11 12:32+0900\n"
12
- "PO-Revision-Date: 2012-09-11 12:32+0900\n"
13
- "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
14
- "Language-Team: LANGUAGE <LL@li.org>\n"
15
- "Language: \n"
16
- "MIME-Version: 1.0\n"
17
- "Content-Type: text/plain; charset=UTF-8\n"
18
- "Content-Transfer-Encoding: 8bit\n"
19
- "Plural-Forms: nplurals=INTEGER; plural=EXPRESSION;\n"
20
-
21
- #: ../fixtures/ascii.rb:10
22
- msgid "gettext"
23
- msgstr ""
@@ -1,20 +0,0 @@
1
- # SOME DESCRIPTIVE TITLE.
2
- # Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
3
- # This file is distributed under the same license as the gettext package.
4
- # FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
5
- #
6
- #, fuzzy
7
- msgid ""
8
- msgstr ""
9
- "Project-Id-Version: gettext 2.3.1\n"
10
- "Report-Msgid-Bugs-To: \n"
11
- "POT-Creation-Date: 2012-09-11 11:11+0900\n"
12
- "PO-Revision-Date: 2012-09-11 11:11+0900\n"
13
- "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
14
- "Language-Team: LANGUAGE <LL@li.org>\n"
15
- "Language: \n"
16
- "MIME-Version: 1.0\n"
17
- "Content-Type: text/plain; charset=UTF-8\n"
18
- "Content-Transfer-Encoding: 8bit\n"
19
- "Plural-Forms: nplurals=INTEGER; plural=EXPRESSION;\n"
20
-
@@ -1,20 +0,0 @@
1
- # SOME DESCRIPTIVE TITLE.
2
- # Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
3
- # This file is distributed under the same license as the gettext package.
4
- # FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
5
- #
6
- #, fuzzy
7
- msgid ""
8
- msgstr ""
9
- "Project-Id-Version: gettext 2.3.1\n"
10
- "Report-Msgid-Bugs-To: \n"
11
- "POT-Creation-Date: 2012-09-11 12:32+0900\n"
12
- "PO-Revision-Date: 2012-09-11 12:32+0900\n"
13
- "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
14
- "Language-Team: LANGUAGE <LL@li.org>\n"
15
- "Language: \n"
16
- "MIME-Version: 1.0\n"
17
- "Content-Type: text/plain; charset=UTF-8\n"
18
- "Content-Transfer-Encoding: 8bit\n"
19
- "Plural-Forms: nplurals=INTEGER; plural=EXPRESSION;\n"
20
-
@@ -1,118 +0,0 @@
1
- # encoding: utf-8
2
-
3
- require 'gettext/tools/parser/ruby'
4
-
5
- # Most functionality of PoMessage is thoroughly tested together
6
- # with the parser and po file generator. Here only tests for some special
7
- # functionality.
8
- class TestPoMessage < Test::Unit::TestCase
9
-
10
- def test_context_match
11
- tt1 = GetText::PoMessage.new(:msgctxt)
12
- tt1.msgid = 'hello'
13
- tt1.msgctxt = 'world'
14
- tt2 = GetText::PoMessage.new(:normal)
15
- tt2.msgid = 'hello'
16
- assert_raise GetText::ParseError do
17
- tt1.merge tt2
18
- end
19
- end
20
-
21
- def test_attribute_accumulation
22
- tt = GetText::PoMessage.new(:plural)
23
- tt.set_current_attribute 'long'
24
- tt.set_current_attribute ' tail'
25
- tt.advance_to_next_attribute
26
- tt.set_current_attribute 'long tails'
27
- assert_equal 'long tail', tt.msgid
28
- assert_equal 'long tails', tt.msgid_plural
29
- end
30
-
31
- def test_to_po_str_normal
32
- po = GetText::PoMessage.new(:normal)
33
- po.msgid = 'hello'
34
- po.sources = ["file1:1", "file2:10"]
35
- assert_equal "\n#: file1:1 file2:10\nmsgid \"hello\"\nmsgstr \"\"\n", po.to_po_str
36
-
37
- po.msgctxt = 'context'
38
- po.msgid_plural = 'hello2'
39
- # Ignore these properties.
40
- assert_equal "\n#: file1:1 file2:10\nmsgid \"hello\"\nmsgstr \"\"\n", po.to_po_str
41
- end
42
-
43
- def test_to_po_str_plural
44
- po = GetText::PoMessage.new(:plural)
45
- po.msgid = 'hello'
46
- po.msgid_plural = 'hello2'
47
- po.sources = ["file1:1", "file2:10"]
48
- assert_equal "\n#: file1:1 file2:10\nmsgid \"hello\"\nmsgid_plural \"hello2\"\nmsgstr[0] \"\"\nmsgstr[1] \"\"\n", po.to_po_str
49
-
50
- po.msgctxt = 'context'
51
- # Ignore this property
52
- assert_equal "\n#: file1:1 file2:10\nmsgid \"hello\"\nmsgid_plural \"hello2\"\nmsgstr[0] \"\"\nmsgstr[1] \"\"\n", po.to_po_str
53
- end
54
-
55
- def test_to_po_str_msgctxt
56
- po = GetText::PoMessage.new(:msgctxt)
57
- po.msgctxt = 'context'
58
- po.msgid = 'hello'
59
- po.sources = ["file1:1", "file2:10"]
60
- assert_equal "\n#: file1:1 file2:10\nmsgctxt \"context\"\nmsgid \"hello\"\nmsgstr \"\"\n", po.to_po_str
61
- end
62
-
63
- def test_to_po_str_msgctxt_plural
64
- po = GetText::PoMessage.new(:msgctxt_plural)
65
- po.msgctxt = 'context'
66
- po.msgid = 'hello'
67
- po.msgid_plural = 'hello2'
68
- po.sources = ["file1:1", "file2:10"]
69
- assert_equal "\n#: file1:1 file2:10\nmsgctxt \"context\"\nmsgid \"hello\"\nmsgid_plural \"hello2\"\nmsgstr[0] \"\"\nmsgstr[1] \"\"\n", po.to_po_str
70
- end
71
-
72
- def test_to_po_str_exception
73
- po = GetText::PoMessage.new(:normal)
74
- po.sources = ["file1:1", "file2:10"]
75
- assert_raise(RuntimeError){ po.to_po_str }
76
-
77
- po.sources = nil
78
- assert_raise(RuntimeError){ po.to_po_str }
79
-
80
- po = GetText::PoMessage.new(:plural)
81
- po.msgid = 'hello'
82
- po.sources = ["file1:1", "file2:10"]
83
- assert_raise(RuntimeError){ po.to_po_str }
84
-
85
- po.msgid_plural = 'hello2'
86
- po.sources = nil
87
- assert_raise(RuntimeError){ po.to_po_str }
88
-
89
- po = GetText::PoMessage.new(:msgctxt)
90
- po.msgid = 'hello'
91
- po.sources = ["file1:1", "file2:10"]
92
- assert_raise(RuntimeError){ po.to_po_str }
93
-
94
- po = GetText::PoMessage.new(:msgctxt_plural)
95
- po.msgctxt = 'context'
96
- po.msgid = 'hello'
97
- po.sources = ["file1:1", "file2:10"]
98
- assert_raise(RuntimeError){ po.to_po_str }
99
- end
100
-
101
- class TestEscape < self
102
- def setup
103
- @message = GetText::PoMessage.new(:normal)
104
- end
105
-
106
- def test_backslash
107
- @message.msgid = "You should escape '\\' as '\\\\'."
108
- assert_equal("You should escape '\\\\' as '\\\\\\\\'.",
109
- @message.escaped(:msgid))
110
- end
111
-
112
- def test_new_line
113
- @message.msgid = "First\nSecond\nThird"
114
- assert_equal("First\\nSecond\\nThird",
115
- @message.escaped(:msgid))
116
- end
117
- end
118
- end