gettext 2.3.3 → 2.3.4

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 (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
@@ -44,7 +44,7 @@ class TestToolsXGetText < Test::Unit::TestCase
44
44
  FileUtils.mkdir_p(File.dirname(@rhtml_file_path))
45
45
  end
46
46
 
47
- def test_relative_source
47
+ def test_relative_reference
48
48
  File.open(@rb_file_path, "w") do |rb_file|
49
49
  rb_file.puts(<<-EOR)
50
50
  _("Hello")
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gettext
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.3.3
4
+ version: 2.3.4
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2012-10-18 00:00:00.000000000 Z
13
+ date: 2012-12-11 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: locale
@@ -28,6 +28,22 @@ dependencies:
28
28
  - - ! '>='
29
29
  - !ruby/object:Gem::Version
30
30
  version: '0'
31
+ - !ruby/object:Gem::Dependency
32
+ name: levenshtein
33
+ requirement: !ruby/object:Gem::Requirement
34
+ none: false
35
+ requirements:
36
+ - - ! '>='
37
+ - !ruby/object:Gem::Version
38
+ version: '0'
39
+ type: :runtime
40
+ prerelease: false
41
+ version_requirements: !ruby/object:Gem::Requirement
42
+ none: false
43
+ requirements:
44
+ - - ! '>='
45
+ - !ruby/object:Gem::Version
46
+ version: '0'
31
47
  - !ruby/object:Gem::Dependency
32
48
  name: rake
33
49
  requirement: !ruby/object:Gem::Requirement
@@ -188,14 +204,6 @@ files:
188
204
  - bin/rxgettext
189
205
  - bin/rmsgfmt
190
206
  - bin/rmsgmerge
191
- - data/locale/de/LC_MESSAGES/gettext.mo
192
- - data/locale/de/LC_MESSAGES/rgettext.mo
193
- - data/locale/el/LC_MESSAGES/gettext.mo
194
- - data/locale/el/LC_MESSAGES/rgettext.mo
195
- - data/locale/uk/LC_MESSAGES/gettext.mo
196
- - data/locale/uk/LC_MESSAGES/rgettext.mo
197
- - data/locale/sr/LC_MESSAGES/gettext.mo
198
- - data/locale/sr/LC_MESSAGES/rgettext.mo
199
207
  - doc/text/news.md
200
208
  - lib/gettext.rb
201
209
  - lib/gettext/utils.rb
@@ -204,11 +212,12 @@ files:
204
212
  - lib/gettext/tools/msginit.rb
205
213
  - lib/gettext/tools/msgmerge.rb
206
214
  - lib/gettext/tools/xgettext.rb
215
+ - lib/gettext/tools/po.rb
207
216
  - lib/gettext/tools/parser/ruby.rb
208
217
  - lib/gettext/tools/parser/glade.rb
209
218
  - lib/gettext/tools/parser/erb.rb
210
- - lib/gettext/tools/pomessage.rb
211
219
  - lib/gettext/tools/poparser.rb
220
+ - lib/gettext/tools/po_entry.rb
212
221
  - lib/gettext/parser/ruby.rb
213
222
  - lib/gettext/parser/glade.rb
214
223
  - lib/gettext/parser/erb.rb
@@ -221,6 +230,7 @@ files:
221
230
  - lib/gettext/runtime/textdomain.rb
222
231
  - lib/gettext/runtime/mofile.rb
223
232
  - lib/gettext/runtime/textdomain_manager.rb
233
+ - lib/gettext/runtime/mo.rb
224
234
  - lib/gettext/core_ext/iconv.rb
225
235
  - lib/gettext/core_ext/string.rb
226
236
  - po/gettext.pot
@@ -649,7 +659,6 @@ files:
649
659
  - samples/cgi/Rakefile
650
660
  - samples/locale/de/LC_MESSAGES/hello_noop.mo
651
661
  - samples/locale/de/LC_MESSAGES/hello_gtk2.mo
652
- - samples/locale/de/LC_MESSAGES/hello_gtk.mo
653
662
  - samples/locale/de/LC_MESSAGES/hello_glade2.mo
654
663
  - samples/locale/de/LC_MESSAGES/hello2.mo
655
664
  - samples/locale/de/LC_MESSAGES/hello.mo
@@ -657,7 +666,6 @@ files:
657
666
  - samples/locale/de/LC_MESSAGES/hello_plural.mo
658
667
  - samples/locale/el/LC_MESSAGES/hello_noop.mo
659
668
  - samples/locale/el/LC_MESSAGES/hello_gtk2.mo
660
- - samples/locale/el/LC_MESSAGES/hello_gtk.mo
661
669
  - samples/locale/el/LC_MESSAGES/hello_glade2.mo
662
670
  - samples/locale/el/LC_MESSAGES/hello2.mo
663
671
  - samples/locale/el/LC_MESSAGES/hello.mo
@@ -665,7 +673,6 @@ files:
665
673
  - samples/locale/el/LC_MESSAGES/hello_plural.mo
666
674
  - samples/locale/uk/LC_MESSAGES/hello_noop.mo
667
675
  - samples/locale/uk/LC_MESSAGES/hello_gtk2.mo
668
- - samples/locale/uk/LC_MESSAGES/hello_gtk.mo
669
676
  - samples/locale/uk/LC_MESSAGES/hello_glade2.mo
670
677
  - samples/locale/uk/LC_MESSAGES/hello2.mo
671
678
  - samples/locale/uk/LC_MESSAGES/hello.mo
@@ -673,7 +680,6 @@ files:
673
680
  - samples/locale/uk/LC_MESSAGES/hello_plural.mo
674
681
  - samples/locale/sr/LC_MESSAGES/hello_noop.mo
675
682
  - samples/locale/sr/LC_MESSAGES/hello_gtk2.mo
676
- - samples/locale/sr/LC_MESSAGES/hello_gtk.mo
677
683
  - samples/locale/sr/LC_MESSAGES/hello_glade2.mo
678
684
  - samples/locale/sr/LC_MESSAGES/hello2.mo
679
685
  - samples/locale/sr/LC_MESSAGES/hello.mo
@@ -681,7 +687,6 @@ files:
681
687
  - samples/locale/sr/LC_MESSAGES/hello_plural.mo
682
688
  - samples/locale/zh/LC_MESSAGES/hello_noop.mo
683
689
  - samples/locale/zh/LC_MESSAGES/hello_gtk2.mo
684
- - samples/locale/zh/LC_MESSAGES/hello_gtk.mo
685
690
  - samples/locale/zh/LC_MESSAGES/hello_glade2.mo
686
691
  - samples/locale/zh/LC_MESSAGES/hello2.mo
687
692
  - samples/locale/zh/LC_MESSAGES/hello.mo
@@ -689,7 +694,6 @@ files:
689
694
  - samples/locale/zh/LC_MESSAGES/hello_plural.mo
690
695
  - samples/locale/fr/LC_MESSAGES/hello_noop.mo
691
696
  - samples/locale/fr/LC_MESSAGES/hello_gtk2.mo
692
- - samples/locale/fr/LC_MESSAGES/hello_gtk.mo
693
697
  - samples/locale/fr/LC_MESSAGES/hello_glade2.mo
694
698
  - samples/locale/fr/LC_MESSAGES/hello2.mo
695
699
  - samples/locale/fr/LC_MESSAGES/hello.mo
@@ -697,7 +701,6 @@ files:
697
701
  - samples/locale/fr/LC_MESSAGES/hello_plural.mo
698
702
  - samples/locale/sv/LC_MESSAGES/hello_noop.mo
699
703
  - samples/locale/sv/LC_MESSAGES/hello_gtk2.mo
700
- - samples/locale/sv/LC_MESSAGES/hello_gtk.mo
701
704
  - samples/locale/sv/LC_MESSAGES/hello_glade2.mo
702
705
  - samples/locale/sv/LC_MESSAGES/hello2.mo
703
706
  - samples/locale/sv/LC_MESSAGES/hello.mo
@@ -705,7 +708,6 @@ files:
705
708
  - samples/locale/sv/LC_MESSAGES/hello_plural.mo
706
709
  - samples/locale/hr/LC_MESSAGES/hello_noop.mo
707
710
  - samples/locale/hr/LC_MESSAGES/hello_gtk2.mo
708
- - samples/locale/hr/LC_MESSAGES/hello_gtk.mo
709
711
  - samples/locale/hr/LC_MESSAGES/hello_glade2.mo
710
712
  - samples/locale/hr/LC_MESSAGES/hello2.mo
711
713
  - samples/locale/hr/LC_MESSAGES/hello.mo
@@ -713,7 +715,6 @@ files:
713
715
  - samples/locale/hr/LC_MESSAGES/hello_plural.mo
714
716
  - samples/locale/it/LC_MESSAGES/hello_noop.mo
715
717
  - samples/locale/it/LC_MESSAGES/hello_gtk2.mo
716
- - samples/locale/it/LC_MESSAGES/hello_gtk.mo
717
718
  - samples/locale/it/LC_MESSAGES/hello_glade2.mo
718
719
  - samples/locale/it/LC_MESSAGES/hello2.mo
719
720
  - samples/locale/it/LC_MESSAGES/hello.mo
@@ -721,7 +722,6 @@ files:
721
722
  - samples/locale/it/LC_MESSAGES/hello_plural.mo
722
723
  - samples/locale/lv/LC_MESSAGES/hello_noop.mo
723
724
  - samples/locale/lv/LC_MESSAGES/hello_gtk2.mo
724
- - samples/locale/lv/LC_MESSAGES/hello_gtk.mo
725
725
  - samples/locale/lv/LC_MESSAGES/hello_glade2.mo
726
726
  - samples/locale/lv/LC_MESSAGES/hello2.mo
727
727
  - samples/locale/lv/LC_MESSAGES/hello.mo
@@ -729,7 +729,6 @@ files:
729
729
  - samples/locale/lv/LC_MESSAGES/hello_plural.mo
730
730
  - samples/locale/ja/LC_MESSAGES/hello_noop.mo
731
731
  - samples/locale/ja/LC_MESSAGES/hello_gtk2.mo
732
- - samples/locale/ja/LC_MESSAGES/hello_gtk.mo
733
732
  - samples/locale/ja/LC_MESSAGES/hello_glade2.mo
734
733
  - samples/locale/ja/LC_MESSAGES/hello2.mo
735
734
  - samples/locale/ja/LC_MESSAGES/hello.mo
@@ -737,7 +736,6 @@ files:
737
736
  - samples/locale/ja/LC_MESSAGES/hello_plural.mo
738
737
  - samples/locale/bs/LC_MESSAGES/hello_noop.mo
739
738
  - samples/locale/bs/LC_MESSAGES/hello_gtk2.mo
740
- - samples/locale/bs/LC_MESSAGES/hello_gtk.mo
741
739
  - samples/locale/bs/LC_MESSAGES/hello_glade2.mo
742
740
  - samples/locale/bs/LC_MESSAGES/hello2.mo
743
741
  - samples/locale/bs/LC_MESSAGES/hello.mo
@@ -745,7 +743,6 @@ files:
745
743
  - samples/locale/bs/LC_MESSAGES/hello_plural.mo
746
744
  - samples/locale/ca/LC_MESSAGES/hello_noop.mo
747
745
  - samples/locale/ca/LC_MESSAGES/hello_gtk2.mo
748
- - samples/locale/ca/LC_MESSAGES/hello_gtk.mo
749
746
  - samples/locale/ca/LC_MESSAGES/hello_glade2.mo
750
747
  - samples/locale/ca/LC_MESSAGES/hello2.mo
751
748
  - samples/locale/ca/LC_MESSAGES/hello.mo
@@ -753,7 +750,6 @@ files:
753
750
  - samples/locale/ca/LC_MESSAGES/hello_plural.mo
754
751
  - samples/locale/bg/LC_MESSAGES/hello_noop.mo
755
752
  - samples/locale/bg/LC_MESSAGES/hello_gtk2.mo
756
- - samples/locale/bg/LC_MESSAGES/hello_gtk.mo
757
753
  - samples/locale/bg/LC_MESSAGES/hello_glade2.mo
758
754
  - samples/locale/bg/LC_MESSAGES/hello2.mo
759
755
  - samples/locale/bg/LC_MESSAGES/hello.mo
@@ -761,7 +757,6 @@ files:
761
757
  - samples/locale/bg/LC_MESSAGES/hello_plural.mo
762
758
  - samples/locale/ru/LC_MESSAGES/hello_noop.mo
763
759
  - samples/locale/ru/LC_MESSAGES/hello_gtk2.mo
764
- - samples/locale/ru/LC_MESSAGES/hello_gtk.mo
765
760
  - samples/locale/ru/LC_MESSAGES/hello_glade2.mo
766
761
  - samples/locale/ru/LC_MESSAGES/hello2.mo
767
762
  - samples/locale/ru/LC_MESSAGES/hello.mo
@@ -769,7 +764,6 @@ files:
769
764
  - samples/locale/ru/LC_MESSAGES/hello_plural.mo
770
765
  - samples/locale/nl/LC_MESSAGES/hello_noop.mo
771
766
  - samples/locale/nl/LC_MESSAGES/hello_gtk2.mo
772
- - samples/locale/nl/LC_MESSAGES/hello_gtk.mo
773
767
  - samples/locale/nl/LC_MESSAGES/hello_glade2.mo
774
768
  - samples/locale/nl/LC_MESSAGES/hello2.mo
775
769
  - samples/locale/nl/LC_MESSAGES/hello.mo
@@ -777,7 +771,6 @@ files:
777
771
  - samples/locale/nl/LC_MESSAGES/hello_plural.mo
778
772
  - samples/locale/eo/LC_MESSAGES/hello_noop.mo
779
773
  - samples/locale/eo/LC_MESSAGES/hello_gtk2.mo
780
- - samples/locale/eo/LC_MESSAGES/hello_gtk.mo
781
774
  - samples/locale/eo/LC_MESSAGES/hello_glade2.mo
782
775
  - samples/locale/eo/LC_MESSAGES/hello2.mo
783
776
  - samples/locale/eo/LC_MESSAGES/hello.mo
@@ -785,7 +778,6 @@ files:
785
778
  - samples/locale/eo/LC_MESSAGES/hello_plural.mo
786
779
  - samples/locale/nb/LC_MESSAGES/hello_noop.mo
787
780
  - samples/locale/nb/LC_MESSAGES/hello_gtk2.mo
788
- - samples/locale/nb/LC_MESSAGES/hello_gtk.mo
789
781
  - samples/locale/nb/LC_MESSAGES/hello_glade2.mo
790
782
  - samples/locale/nb/LC_MESSAGES/hello2.mo
791
783
  - samples/locale/nb/LC_MESSAGES/hello.mo
@@ -793,7 +785,6 @@ files:
793
785
  - samples/locale/nb/LC_MESSAGES/hello_plural.mo
794
786
  - samples/locale/vi/LC_MESSAGES/hello_noop.mo
795
787
  - samples/locale/vi/LC_MESSAGES/hello_gtk2.mo
796
- - samples/locale/vi/LC_MESSAGES/hello_gtk.mo
797
788
  - samples/locale/vi/LC_MESSAGES/hello_glade2.mo
798
789
  - samples/locale/vi/LC_MESSAGES/hello2.mo
799
790
  - samples/locale/vi/LC_MESSAGES/hello.mo
@@ -801,7 +792,6 @@ files:
801
792
  - samples/locale/vi/LC_MESSAGES/hello_plural.mo
802
793
  - samples/locale/hu/LC_MESSAGES/hello_noop.mo
803
794
  - samples/locale/hu/LC_MESSAGES/hello_gtk2.mo
804
- - samples/locale/hu/LC_MESSAGES/hello_gtk.mo
805
795
  - samples/locale/hu/LC_MESSAGES/hello_glade2.mo
806
796
  - samples/locale/hu/LC_MESSAGES/hello2.mo
807
797
  - samples/locale/hu/LC_MESSAGES/hello.mo
@@ -809,7 +799,6 @@ files:
809
799
  - samples/locale/hu/LC_MESSAGES/hello_plural.mo
810
800
  - samples/locale/pt_BR/LC_MESSAGES/hello_noop.mo
811
801
  - samples/locale/pt_BR/LC_MESSAGES/hello_gtk2.mo
812
- - samples/locale/pt_BR/LC_MESSAGES/hello_gtk.mo
813
802
  - samples/locale/pt_BR/LC_MESSAGES/hello_glade2.mo
814
803
  - samples/locale/pt_BR/LC_MESSAGES/hello2.mo
815
804
  - samples/locale/pt_BR/LC_MESSAGES/hello.mo
@@ -817,7 +806,6 @@ files:
817
806
  - samples/locale/pt_BR/LC_MESSAGES/hello_plural.mo
818
807
  - samples/locale/cs/LC_MESSAGES/hello_noop.mo
819
808
  - samples/locale/cs/LC_MESSAGES/hello_gtk2.mo
820
- - samples/locale/cs/LC_MESSAGES/hello_gtk.mo
821
809
  - samples/locale/cs/LC_MESSAGES/hello_glade2.mo
822
810
  - samples/locale/cs/LC_MESSAGES/hello2.mo
823
811
  - samples/locale/cs/LC_MESSAGES/hello.mo
@@ -825,7 +813,6 @@ files:
825
813
  - samples/locale/cs/LC_MESSAGES/hello_plural.mo
826
814
  - samples/locale/zh_TW/LC_MESSAGES/hello_noop.mo
827
815
  - samples/locale/zh_TW/LC_MESSAGES/hello_gtk2.mo
828
- - samples/locale/zh_TW/LC_MESSAGES/hello_gtk.mo
829
816
  - samples/locale/zh_TW/LC_MESSAGES/hello_glade2.mo
830
817
  - samples/locale/zh_TW/LC_MESSAGES/hello2.mo
831
818
  - samples/locale/zh_TW/LC_MESSAGES/hello.mo
@@ -833,7 +820,6 @@ files:
833
820
  - samples/locale/zh_TW/LC_MESSAGES/hello_plural.mo
834
821
  - samples/locale/es/LC_MESSAGES/hello_noop.mo
835
822
  - samples/locale/es/LC_MESSAGES/hello_gtk2.mo
836
- - samples/locale/es/LC_MESSAGES/hello_gtk.mo
837
823
  - samples/locale/es/LC_MESSAGES/hello_glade2.mo
838
824
  - samples/locale/es/LC_MESSAGES/hello2.mo
839
825
  - samples/locale/es/LC_MESSAGES/hello.mo
@@ -841,7 +827,6 @@ files:
841
827
  - samples/locale/es/LC_MESSAGES/hello_plural.mo
842
828
  - samples/locale/ko/LC_MESSAGES/hello_noop.mo
843
829
  - samples/locale/ko/LC_MESSAGES/hello_gtk2.mo
844
- - samples/locale/ko/LC_MESSAGES/hello_gtk.mo
845
830
  - samples/locale/ko/LC_MESSAGES/hello_glade2.mo
846
831
  - samples/locale/ko/LC_MESSAGES/hello2.mo
847
832
  - samples/locale/ko/LC_MESSAGES/hello.mo
@@ -851,10 +836,12 @@ files:
851
836
  - src/poparser.ry
852
837
  - test/run-test.rb
853
838
  - test/test_locale_path.rb
839
+ - test/test_mo.rb
854
840
  - test/test_class_info.rb
855
841
  - test/tools/test_msginit.rb
856
842
  - test/tools/test_xgettext.rb
857
843
  - test/tools/test_msgmerge.rb
844
+ - test/tools/test_po.rb
858
845
  - test/tools/test.pot
859
846
  - test/tools/files/de/app.po
860
847
  - test/tools/files/simple_translation.rb
@@ -865,9 +852,7 @@ files:
865
852
  - test/tools/files/app.pot
866
853
  - test/tools/files/simple_1.po
867
854
  - test/tools/test_tools.rb
868
- - test/test_mofile.rb
869
855
  - test/parser/test_ruby.rb
870
- - test/po/not_existed_msgid.pot
871
856
  - test/po/sl/plural.po
872
857
  - test/po/ir/plural.po
873
858
  - test/po/np_.pot
@@ -896,11 +881,9 @@ files:
896
881
  - test/po/_.pot
897
882
  - test/po/untranslated.pot
898
883
  - test/po/p_.pot
899
- - test/po/ascii.pot
900
884
  - test/po/da/plural.po
901
885
  - test/po/da/plural_error.po
902
886
  - test/po/po/plural.po
903
- - test/po/no_exist_msgid.pot
904
887
  - test/po/cr/plural.po
905
888
  - test/po/la/plural.po
906
889
  - test/po/la/plural_error.po
@@ -925,10 +908,10 @@ files:
925
908
  - test/fixtures/ns_.rb
926
909
  - test/fixtures/p_.rb
927
910
  - test/fixtures/simple.rb
911
+ - test/test_po_entry.rb
928
912
  - test/gettext-test-utils.rb
929
913
  - test/test_thread.rb
930
914
  - test/test_po_parser.rb
931
- - test/test_po_message.rb
932
915
  - test/test_parser.rb
933
916
  - test/test_textdomain_bind.rb
934
917
  - test/test_textdomain_toplevel.rb
@@ -983,7 +966,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
983
966
  version: '0'
984
967
  segments:
985
968
  - 0
986
- hash: -250750965956086741
969
+ hash: -3820019722187872966
987
970
  required_rubygems_version: !ruby/object:Gem::Requirement
988
971
  none: false
989
972
  requirements:
@@ -992,7 +975,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
992
975
  version: '0'
993
976
  segments:
994
977
  - 0
995
- hash: -250750965956086741
978
+ hash: -3820019722187872966
996
979
  requirements: []
997
980
  rubyforge_project: gettext
998
981
  rubygems_version: 1.8.23
@@ -1001,11 +984,11 @@ specification_version: 3
1001
984
  summary: Gettext is a pure Ruby libary and tools to localize messages.
1002
985
  test_files:
1003
986
  - test/test_locale_path.rb
987
+ - test/test_mo.rb
1004
988
  - test/test_class_info.rb
1005
- - test/test_mofile.rb
989
+ - test/test_po_entry.rb
1006
990
  - test/test_thread.rb
1007
991
  - test/test_po_parser.rb
1008
- - test/test_po_message.rb
1009
992
  - test/test_parser.rb
1010
993
  - test/test_textdomain_bind.rb
1011
994
  - test/test_textdomain_toplevel.rb
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
@@ -1,232 +0,0 @@
1
- # -*- coding: utf-8 -*-
2
- #
3
- # Copyright (C) 2012 Kouhei Sutou <kou@clear-code.com>
4
- # Copyright (C) 2010 masone (Christian Felder) <ema@rh-productions.ch>
5
- # Copyright (C) 2009 Masao Mutoh
6
- #
7
- # License: Ruby's or LGPL
8
- #
9
- # This library is free software: you can redistribute it and/or modify
10
- # it under the terms of the GNU Lesser General Public License as published by
11
- # the Free Software Foundation, either version 3 of the License, or
12
- # (at your option) any later version.
13
- #
14
- # This library is distributed in the hope that it will be useful,
15
- # but WITHOUT ANY WARRANTY; without even the implied warranty of
16
- # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17
- # GNU Lesser General Public License for more details.
18
- #
19
- # You should have received a copy of the GNU Lesser General Public License
20
- # along with this program. If not, see <http://www.gnu.org/licenses/>.
21
-
22
- module GetText
23
- class ParseError < StandardError
24
- end
25
-
26
- # Contains data related to the expression or sentence that
27
- # is to be translated.
28
- class PoMessage
29
- PARAMS = {
30
- :normal => [:msgid, :separator],
31
- :plural => [:msgid, :msgid_plural, :separator],
32
- :msgctxt => [:msgctxt, :msgid],
33
- :msgctxt_plural => [:msgctxt, :msgid, :msgid_plural]
34
- }
35
-
36
- class << self
37
- def escape(string)
38
- string.gsub(/([\\"\n])/) do
39
- special_character = $1
40
- if special_character == "\n"
41
- "\\n"
42
- else
43
- "\\#{special_character}"
44
- end
45
- end
46
- end
47
- end
48
-
49
- @@max_line_length = 70
50
-
51
- # Sets the max line length.
52
- def self.max_line_length=(len)
53
- @@max_line_length = len
54
- end
55
-
56
- # Gets the max line length.
57
- def self.max_line_length
58
- @@max_line_length
59
- end
60
-
61
- # Required
62
- attr_accessor :type # :normal, :plural, :msgctxt, :msgctxt_plural
63
- attr_accessor :msgid
64
- # Options
65
- attr_accessor :msgid_plural
66
- attr_accessor :separator
67
- attr_accessor :msgctxt
68
- attr_accessor :sources # ["file1:line1", "file2:line2", ...]
69
- attr_accessor :comment
70
-
71
- # Create the object. +type+ should be :normal, :plural, :msgctxt or :msgctxt_plural.
72
- def initialize(type)
73
- @type = type
74
- @sources = []
75
- @param_type = PARAMS[@type]
76
- end
77
-
78
- # Support for extracted comments. Explanation s.
79
- # http://www.gnu.org/software/gettext/manual/gettext.html#Names
80
- def add_comment(new_comment)
81
- if (new_comment and ! new_comment.empty?)
82
- @comment ||= ""
83
- @comment += new_comment
84
- end
85
- to_s
86
- end
87
-
88
- # Returns a parameter representation suitable for po-files
89
- # and other purposes.
90
- def escaped(param_name)
91
- orig = self.send param_name
92
- self.class.escape(orig.gsub(/\r/, ""))
93
- end
94
-
95
- # Checks if the other translation target is mergeable with
96
- # the current one. Relevant are msgid and translation context (msgctxt).
97
- def ==(other)
98
- other && other.msgid == self.msgid && other.msgctxt == self.msgctxt
99
- end
100
-
101
- # Merges two translation targets with the same msgid and returns the merged
102
- # result. If one is declared as plural and the other not, then the one
103
- # with the plural wins.
104
- def merge(other)
105
- return self unless other
106
- raise ParseError, "Translation targets do not match: \n" \
107
- " self: #{self.inspect}\n other: '#{other.inspect}'" unless self == other
108
- if other.msgid_plural && !self.msgid_plural
109
- res = other
110
- unless (res.sources.include? self.sources[0])
111
- res.sources += self.sources
112
- res.add_comment(self.comment)
113
- end
114
- else
115
- res = self
116
- unless (res.sources.include? other.sources[0])
117
- res.sources += other.sources
118
- res.add_comment(other.comment)
119
- end
120
- end
121
- res
122
- end
123
-
124
- # Output the po message for the po-file.
125
- def to_po_str
126
- raise "msgid is nil." unless @msgid
127
- raise "sources is nil." unless @sources
128
-
129
- str = ""
130
- # extracted comments
131
- if comment
132
- comment.split("\n").each do |comment_line|
133
- str << "\n#. #{comment_line.strip}"
134
- end
135
- end
136
-
137
- # references
138
- curr_pos = @@max_line_length
139
- sources.each do |e|
140
- if curr_pos + e.size > @@max_line_length
141
- str << "\n#:"
142
- curr_pos = 3
143
- else
144
- curr_pos += (e.size + 1)
145
- end
146
- str << " " << e
147
- end
148
-
149
- # msgctxt, msgid, msgstr
150
- str << "\nmsgctxt \"" << msgctxt << "\"" if msgctxt?
151
- str << "\nmsgid \"" << escaped(:msgid) << "\"\n"
152
- if plural?
153
- str << "msgid_plural \"" << escaped(:msgid_plural) << "\"\n"
154
- str << "msgstr[0] \"\"\n"
155
- str << "msgstr[1] \"\"\n"
156
- else
157
- str << "msgstr \"\"\n"
158
- end
159
- str
160
- end
161
-
162
- # Returns true if the type is kind of msgctxt.
163
- # And if this is a kind of msgctxt and msgctxt property
164
- # is nil, then raise an RuntimeException.
165
- def msgctxt?
166
- if [:msgctxt, :msgctxt_plural].include? @type
167
- raise "This PoMessage is a kind of msgctxt but the msgctxt property is nil. msgid: #{msgid}" unless @msgctxt
168
- true
169
- end
170
- end
171
-
172
- # Returns true if the type is kind of plural.
173
- # And if this is a kind of plural and msgid_plural property
174
- # is nil, then raise an RuntimeException.
175
- def plural?
176
- if [:plural, :msgctxt_plural].include? @type
177
- raise "This PoMessage is a kind of plural but the msgid_plural property is nil. msgid: #{msgid}" unless @msgid_plural
178
- true
179
- end
180
- end
181
-
182
- private
183
-
184
- # sets or extends the value of a translation target params like msgid,
185
- # msgctxt etc.
186
- # param is symbol with the name of param
187
- # value - new value
188
- def set_value(param, value)
189
- send "#{param}=", (send(param) || '') + value.gsub(/\n/, '\n')
190
- end
191
-
192
- public
193
- # For backward comatibility. This doesn't support "comment".
194
- # ary = [msgid1, "file1:line1", "file2:line"]
195
- def self.new_from_ary(ary)
196
- ary = ary.dup
197
- msgid = ary.shift
198
- sources = ary
199
- type = :normal
200
- msgctxt = nil
201
- msgid_plural = nil
202
-
203
- if msgid.include? "\004"
204
- msgctxt, msgid = msgid.split(/\004/)
205
- type = :msgctxt
206
- end
207
- if msgid.include? "\000"
208
- ids = msgid.split(/\000/)
209
- msgid = ids[0]
210
- msgid_plural = ids[1]
211
- if type == :msgctxt
212
- type = :msgctxt_plural
213
- else
214
- type = :plural
215
- end
216
- end
217
- ret = self.new(type)
218
- ret.msgid = msgid
219
- ret.sources = sources
220
- ret.msgctxt = msgctxt
221
- ret.msgid_plural = msgid_plural
222
- ret
223
- end
224
-
225
- def [](number)
226
- param = @param_type[number]
227
- raise ParseError, 'no more string parameters expected' unless param
228
- send param
229
- end
230
- end
231
-
232
- end