gettext 2.2.1 → 2.3.0
Sign up to get free protection for your applications and to get access to all the features.
- data/COPYING +2 -1
- data/README.rdoc +9 -9
- data/Rakefile +94 -149
- data/bin/rmsgfmt +23 -20
- data/bin/rmsginit +29 -0
- data/bin/rmsgmerge +22 -20
- data/bin/rxgettext +24 -0
- data/doc/text/news.md +60 -0
- data/gettext.gemspec +7 -4
- data/lib/gettext.rb +3 -3
- data/lib/gettext/core_ext/string.rb +2 -1
- data/lib/gettext/runtime/locale_path.rb +6 -4
- data/lib/gettext/runtime/textdomain.rb +14 -8
- data/lib/gettext/runtime/textdomain_manager.rb +3 -3
- data/lib/gettext/task.rb +203 -0
- data/lib/gettext/tools.rb +33 -24
- data/lib/gettext/tools/msgfmt.rb +104 -0
- data/lib/gettext/tools/msginit.rb +363 -0
- data/lib/gettext/tools/msgmerge.rb +510 -0
- data/lib/gettext/tools/parser/ruby.rb +12 -17
- data/lib/gettext/tools/pomessage.rb +37 -4
- data/lib/gettext/tools/poparser.rb +27 -24
- data/lib/gettext/tools/xgettext.rb +327 -0
- data/lib/gettext/version.rb +2 -2
- data/po/bg/rgettext.po +2 -2
- data/po/bs/rgettext.po +2 -2
- data/po/ca/rgettext.po +2 -2
- data/po/cs/rgettext.po +2 -2
- data/po/de/gettext.po +668 -0
- data/po/de/gettext.po.bak +589 -0
- data/po/de/rgettext.po +2 -2
- data/po/el/gettext.po +571 -0
- data/po/el/rgettext.po +2 -2
- data/po/eo/rgettext.po +2 -2
- data/po/es/rgettext.po +2 -2
- data/po/et/rgettext.po +2 -2
- data/po/fr/gettext.po +589 -0
- data/po/fr/rgettext.po +2 -2
- data/po/gettext.pot +638 -0
- data/po/gettext.pot~ +638 -0
- data/po/hr/rgettext.po +2 -2
- data/po/hu/rgettext.po +2 -2
- data/po/it/gettext.po +589 -0
- data/po/it/rgettext.po +2 -2
- data/po/ja/gettext.po +591 -0
- data/po/ja/rgettext.po +112 -69
- data/po/ko/rgettext.po +2 -2
- data/po/lv/rgettext.po +2 -2
- data/po/nb/rgettext.po +2 -2
- data/po/nl/rgettext.po +2 -2
- data/po/pt_BR/rgettext.po +2 -2
- data/po/ru/rgettext.po +2 -2
- data/po/sr/rgettext.po +2 -2
- data/po/sv/rgettext.po +2 -2
- data/po/uk/gettext.po +571 -0
- data/po/uk/rgettext.po +2 -2
- data/po/vi/rgettext.po +2 -2
- data/po/zh/rgettext.po +2 -2
- data/po/zh_TW/rgettext.po +2 -2
- data/samples/README +2 -4
- data/samples/cgi/README +1 -1
- data/samples/cgi/cookie.cgi +1 -1
- data/samples/cgi/gettext.css +1 -1
- data/samples/cgi/helloerb.rhtml +1 -1
- data/samples/cgi/hellolib.rb +1 -1
- data/samples/cgi/http.rb +2 -2
- data/samples/cgi/index.cgi +1 -1
- data/samples/cgi/locale/bg/LC_MESSAGES/helloerb1.mo +0 -0
- data/samples/cgi/locale/bg/LC_MESSAGES/helloerb2.mo +0 -0
- data/samples/cgi/locale/bg/LC_MESSAGES/main.mo +0 -0
- data/samples/cgi/locale/bs/LC_MESSAGES/helloerb1.mo +0 -0
- data/samples/cgi/locale/bs/LC_MESSAGES/helloerb2.mo +0 -0
- data/samples/cgi/locale/bs/LC_MESSAGES/main.mo +0 -0
- data/samples/cgi/locale/ca/LC_MESSAGES/helloerb1.mo +0 -0
- data/samples/cgi/locale/ca/LC_MESSAGES/helloerb2.mo +0 -0
- data/samples/cgi/locale/ca/LC_MESSAGES/main.mo +0 -0
- data/samples/cgi/locale/cs/LC_MESSAGES/helloerb1.mo +0 -0
- data/samples/cgi/locale/cs/LC_MESSAGES/helloerb2.mo +0 -0
- data/samples/cgi/locale/cs/LC_MESSAGES/main.mo +0 -0
- data/samples/cgi/locale/de/LC_MESSAGES/helloerb1.mo +0 -0
- data/samples/cgi/locale/de/LC_MESSAGES/helloerb2.mo +0 -0
- data/samples/cgi/locale/de/LC_MESSAGES/main.mo +0 -0
- data/samples/cgi/locale/el/LC_MESSAGES/helloerb1.mo +0 -0
- data/samples/cgi/locale/el/LC_MESSAGES/helloerb2.mo +0 -0
- data/samples/cgi/locale/el/LC_MESSAGES/main.mo +0 -0
- data/samples/cgi/locale/eo/LC_MESSAGES/helloerb1.mo +0 -0
- data/samples/cgi/locale/eo/LC_MESSAGES/helloerb2.mo +0 -0
- data/samples/cgi/locale/eo/LC_MESSAGES/main.mo +0 -0
- data/samples/cgi/locale/es/LC_MESSAGES/helloerb1.mo +0 -0
- data/samples/cgi/locale/es/LC_MESSAGES/helloerb2.mo +0 -0
- data/samples/cgi/locale/es/LC_MESSAGES/main.mo +0 -0
- data/samples/cgi/locale/fr/LC_MESSAGES/helloerb1.mo +0 -0
- data/samples/cgi/locale/fr/LC_MESSAGES/helloerb2.mo +0 -0
- data/samples/cgi/locale/fr/LC_MESSAGES/main.mo +0 -0
- data/samples/cgi/locale/hr/LC_MESSAGES/helloerb1.mo +0 -0
- data/samples/cgi/locale/hr/LC_MESSAGES/helloerb2.mo +0 -0
- data/samples/cgi/locale/hr/LC_MESSAGES/main.mo +0 -0
- data/samples/cgi/locale/hu/LC_MESSAGES/helloerb1.mo +0 -0
- data/samples/cgi/locale/hu/LC_MESSAGES/helloerb2.mo +0 -0
- data/samples/cgi/locale/hu/LC_MESSAGES/main.mo +0 -0
- data/samples/cgi/locale/it/LC_MESSAGES/helloerb1.mo +0 -0
- data/samples/cgi/locale/it/LC_MESSAGES/helloerb2.mo +0 -0
- data/samples/cgi/locale/it/LC_MESSAGES/main.mo +0 -0
- data/samples/cgi/locale/ja/LC_MESSAGES/helloerb1.mo +0 -0
- data/samples/cgi/locale/ja/LC_MESSAGES/helloerb2.mo +0 -0
- data/samples/cgi/locale/ja/LC_MESSAGES/main.mo +0 -0
- data/samples/cgi/locale/ko/LC_MESSAGES/helloerb1.mo +0 -0
- data/samples/cgi/locale/ko/LC_MESSAGES/helloerb2.mo +0 -0
- data/samples/cgi/locale/ko/LC_MESSAGES/main.mo +0 -0
- data/samples/cgi/locale/lv/LC_MESSAGES/helloerb1.mo +0 -0
- data/samples/cgi/locale/lv/LC_MESSAGES/helloerb2.mo +0 -0
- data/samples/cgi/locale/lv/LC_MESSAGES/main.mo +0 -0
- data/samples/cgi/locale/nb/LC_MESSAGES/helloerb1.mo +0 -0
- data/samples/cgi/locale/nb/LC_MESSAGES/helloerb2.mo +0 -0
- data/samples/cgi/locale/nb/LC_MESSAGES/main.mo +0 -0
- data/samples/cgi/locale/nl/LC_MESSAGES/helloerb1.mo +0 -0
- data/samples/cgi/locale/nl/LC_MESSAGES/helloerb2.mo +0 -0
- data/samples/cgi/locale/nl/LC_MESSAGES/main.mo +0 -0
- data/samples/cgi/locale/pt_BR/LC_MESSAGES/helloerb1.mo +0 -0
- data/samples/cgi/locale/pt_BR/LC_MESSAGES/helloerb2.mo +0 -0
- data/samples/cgi/locale/pt_BR/LC_MESSAGES/main.mo +0 -0
- data/samples/cgi/locale/ru/LC_MESSAGES/helloerb1.mo +0 -0
- data/samples/cgi/locale/ru/LC_MESSAGES/helloerb2.mo +0 -0
- data/samples/cgi/locale/ru/LC_MESSAGES/main.mo +0 -0
- data/samples/cgi/locale/sr/LC_MESSAGES/helloerb1.mo +0 -0
- data/samples/cgi/locale/sr/LC_MESSAGES/helloerb2.mo +0 -0
- data/samples/cgi/locale/sr/LC_MESSAGES/main.mo +0 -0
- data/samples/cgi/locale/uk/LC_MESSAGES/helloerb1.mo +0 -0
- data/samples/cgi/locale/uk/LC_MESSAGES/helloerb2.mo +0 -0
- data/samples/cgi/locale/uk/LC_MESSAGES/main.mo +0 -0
- data/samples/cgi/locale/vi/LC_MESSAGES/helloerb1.mo +0 -0
- data/samples/cgi/locale/vi/LC_MESSAGES/helloerb2.mo +0 -0
- data/samples/cgi/locale/vi/LC_MESSAGES/main.mo +0 -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/main.mo +0 -0
- data/samples/cgi/locale/zh_TW/LC_MESSAGES/helloerb1.mo +0 -0
- data/samples/cgi/locale/zh_TW/LC_MESSAGES/helloerb2.mo +0 -0
- data/samples/cgi/locale/zh_TW/LC_MESSAGES/main.mo +0 -0
- data/samples/cgi/other.rhtml +1 -1
- data/samples/cgi/po/bg/helloerb1.po +4 -4
- data/samples/cgi/po/bg/helloerb2.po +4 -4
- data/samples/cgi/po/bg/hellolib.po +2 -2
- data/samples/cgi/po/bg/main.po +4 -4
- data/samples/cgi/po/bs/helloerb1.po +3 -3
- data/samples/cgi/po/bs/helloerb2.po +3 -3
- data/samples/cgi/po/bs/hellolib.po +2 -2
- data/samples/cgi/po/bs/main.po +3 -3
- data/samples/cgi/po/ca/helloerb1.po +4 -4
- data/samples/cgi/po/ca/helloerb2.po +4 -4
- data/samples/cgi/po/ca/hellolib.po +2 -2
- data/samples/cgi/po/ca/main.po +4 -4
- data/samples/cgi/po/cs/helloerb1.po +4 -4
- data/samples/cgi/po/cs/helloerb2.po +4 -4
- data/samples/cgi/po/cs/hellolib.po +2 -2
- data/samples/cgi/po/cs/main.po +4 -4
- data/samples/cgi/po/de/helloerb1.po +3 -3
- data/samples/cgi/po/de/helloerb2.po +3 -3
- data/samples/cgi/po/de/hellolib.po +2 -2
- data/samples/cgi/po/de/main.po +3 -3
- data/samples/cgi/po/el/helloerb1.po +3 -3
- data/samples/cgi/po/el/helloerb2.po +3 -3
- data/samples/cgi/po/el/hellolib.po +2 -2
- data/samples/cgi/po/el/main.po +3 -3
- data/samples/cgi/po/eo/helloerb1.po +3 -3
- data/samples/cgi/po/eo/helloerb2.po +3 -3
- data/samples/cgi/po/eo/hellolib.po +2 -2
- data/samples/cgi/po/eo/main.po +3 -3
- data/samples/cgi/po/es/helloerb1.po +4 -4
- data/samples/cgi/po/es/helloerb2.po +4 -4
- data/samples/cgi/po/es/hellolib.po +2 -2
- data/samples/cgi/po/es/main.po +4 -4
- data/samples/cgi/po/fr/helloerb1.po +4 -4
- data/samples/cgi/po/fr/helloerb2.po +4 -4
- data/samples/cgi/po/fr/hellolib.po +2 -2
- data/samples/cgi/po/fr/main.po +4 -4
- data/samples/cgi/po/hr/helloerb1.po +3 -3
- data/samples/cgi/po/hr/helloerb2.po +3 -3
- data/samples/cgi/po/hr/hellolib.po +2 -2
- data/samples/cgi/po/hr/main.po +3 -3
- data/samples/cgi/po/hu/helloerb1.po +4 -4
- data/samples/cgi/po/hu/helloerb2.po +4 -4
- data/samples/cgi/po/hu/hellolib.po +2 -2
- data/samples/cgi/po/hu/main.po +4 -4
- data/samples/cgi/po/it/helloerb1.po +3 -3
- data/samples/cgi/po/it/helloerb2.po +3 -3
- data/samples/cgi/po/it/hellolib.po +2 -2
- data/samples/cgi/po/it/main.po +3 -3
- data/samples/cgi/po/ja/helloerb1.po +4 -4
- data/samples/cgi/po/ja/helloerb2.po +4 -4
- data/samples/cgi/po/ja/hellolib.po +2 -2
- data/samples/cgi/po/ja/main.po +3 -3
- data/samples/cgi/po/ko/helloerb1.po +3 -3
- data/samples/cgi/po/ko/helloerb2.po +3 -3
- data/samples/cgi/po/ko/hellolib.po +2 -2
- data/samples/cgi/po/ko/main.po +3 -3
- data/samples/cgi/po/lv/helloerb1.po +4 -4
- data/samples/cgi/po/lv/helloerb2.po +4 -4
- data/samples/cgi/po/lv/hellolib.po +2 -2
- data/samples/cgi/po/lv/main.po +4 -4
- data/samples/cgi/po/nb/helloerb1.po +3 -3
- data/samples/cgi/po/nb/helloerb2.po +3 -3
- data/samples/cgi/po/nb/hellolib.po +2 -2
- data/samples/cgi/po/nb/main.po +3 -3
- data/samples/cgi/po/nl/helloerb1.po +4 -4
- data/samples/cgi/po/nl/helloerb2.po +4 -4
- data/samples/cgi/po/nl/hellolib.po +2 -2
- data/samples/cgi/po/nl/main.po +4 -4
- data/samples/cgi/po/pt_BR/helloerb1.po +4 -4
- data/samples/cgi/po/pt_BR/helloerb2.po +4 -4
- data/samples/cgi/po/pt_BR/hellolib.po +2 -2
- data/samples/cgi/po/pt_BR/main.po +4 -4
- data/samples/cgi/po/ru/helloerb1.po +4 -4
- data/samples/cgi/po/ru/helloerb2.po +4 -4
- data/samples/cgi/po/ru/hellolib.po +2 -2
- data/samples/cgi/po/ru/main.po +4 -4
- data/samples/cgi/po/sr/helloerb1.po +4 -4
- data/samples/cgi/po/sr/helloerb2.po +4 -4
- data/samples/cgi/po/sr/hellolib.po +2 -2
- data/samples/cgi/po/sr/main.po +4 -4
- data/samples/cgi/po/uk/helloerb1.po +4 -4
- data/samples/cgi/po/uk/helloerb2.po +4 -4
- data/samples/cgi/po/uk/hellolib.po +2 -2
- data/samples/cgi/po/uk/main.po +4 -4
- data/samples/cgi/po/vi/helloerb1.po +3 -3
- data/samples/cgi/po/vi/helloerb2.po +3 -3
- data/samples/cgi/po/vi/hellolib.po +2 -2
- data/samples/cgi/po/vi/main.po +3 -3
- data/samples/cgi/po/zh/helloerb1.po +4 -4
- data/samples/cgi/po/zh/helloerb2.po +4 -4
- data/samples/cgi/po/zh/hellolib.po +2 -2
- data/samples/cgi/po/zh/main.po +4 -4
- data/samples/cgi/po/zh_TW/helloerb1.po +4 -4
- data/samples/cgi/po/zh_TW/helloerb2.po +4 -4
- data/samples/cgi/po/zh_TW/hellolib.po +2 -2
- data/samples/cgi/po/zh_TW/main.po +4 -4
- data/samples/hello.rb +1 -1
- data/samples/hello2.rb +1 -1
- data/samples/hello_glade2.rb +1 -1
- data/samples/hello_gtk2.rb +2 -2
- data/samples/hello_noop.rb +1 -1
- data/samples/hello_plural.rb +1 -1
- data/samples/hello_tk.rb +1 -1
- data/samples/locale/bg/LC_MESSAGES/hello_gtk2.mo +0 -0
- data/samples/locale/bs/LC_MESSAGES/hello_gtk2.mo +0 -0
- data/samples/locale/ca/LC_MESSAGES/hello_gtk2.mo +0 -0
- data/samples/locale/cs/LC_MESSAGES/hello_gtk2.mo +0 -0
- data/samples/locale/de/LC_MESSAGES/hello_gtk2.mo +0 -0
- data/samples/locale/el/LC_MESSAGES/hello_gtk2.mo +0 -0
- data/samples/locale/eo/LC_MESSAGES/hello_gtk2.mo +0 -0
- data/samples/locale/es/LC_MESSAGES/hello_gtk2.mo +0 -0
- data/samples/locale/fr/LC_MESSAGES/hello_gtk2.mo +0 -0
- data/samples/locale/hr/LC_MESSAGES/hello_gtk2.mo +0 -0
- data/samples/locale/hu/LC_MESSAGES/hello_gtk2.mo +0 -0
- data/samples/locale/it/LC_MESSAGES/hello_gtk2.mo +0 -0
- data/samples/locale/ja/LC_MESSAGES/hello_gtk2.mo +0 -0
- data/samples/locale/ko/LC_MESSAGES/hello_gtk2.mo +0 -0
- data/samples/locale/lv/LC_MESSAGES/hello_gtk2.mo +0 -0
- data/samples/locale/nb/LC_MESSAGES/hello_gtk2.mo +0 -0
- data/samples/locale/nl/LC_MESSAGES/hello_gtk2.mo +0 -0
- data/samples/locale/pt_BR/LC_MESSAGES/hello_gtk2.mo +0 -0
- data/samples/locale/ru/LC_MESSAGES/hello_gtk2.mo +0 -0
- data/samples/locale/sr/LC_MESSAGES/hello_gtk2.mo +0 -0
- data/samples/locale/sv/LC_MESSAGES/hello_gtk2.mo +0 -0
- data/samples/locale/uk/LC_MESSAGES/hello_gtk2.mo +0 -0
- data/samples/locale/vi/LC_MESSAGES/hello_gtk2.mo +0 -0
- data/samples/locale/zh/LC_MESSAGES/hello_gtk2.mo +0 -0
- data/samples/locale/zh_TW/LC_MESSAGES/hello_gtk2.mo +0 -0
- data/samples/po/bg/hello.po +2 -2
- data/samples/po/bg/hello2.po +1 -1
- data/samples/po/bg/hello_glade2.po +1 -1
- data/samples/po/bg/{hello_gtk.po → hello_gtk2.po} +1 -1
- data/samples/po/bg/hello_noop.po +1 -1
- data/samples/po/bg/hello_plural.po +1 -1
- data/samples/po/bg/hello_tk.po +1 -1
- data/samples/po/bs/hello.po +2 -2
- data/samples/po/bs/hello2.po +1 -1
- data/samples/po/bs/hello_glade2.po +1 -1
- data/samples/po/bs/{hello_gtk.po → hello_gtk2.po} +1 -1
- data/samples/po/bs/hello_noop.po +1 -1
- data/samples/po/bs/hello_plural.po +1 -1
- data/samples/po/bs/hello_tk.po +1 -1
- data/samples/po/ca/hello.po +2 -2
- data/samples/po/ca/hello2.po +1 -1
- data/samples/po/ca/hello_glade2.po +1 -1
- data/samples/po/ca/{hello_gtk.po → hello_gtk2.po} +1 -1
- data/samples/po/ca/hello_noop.po +1 -1
- data/samples/po/ca/hello_plural.po +1 -1
- data/samples/po/ca/hello_tk.po +1 -1
- data/samples/po/cs/hello.po +1 -1
- data/samples/po/cs/hello_glade2.po +1 -1
- data/samples/po/cs/{hello_gtk.po → hello_gtk2.po} +0 -0
- data/samples/po/cs/hello_plural.po +1 -1
- data/samples/po/de/hello.po +1 -1
- data/samples/po/de/{hello_gtk.po → hello_gtk2.po} +0 -0
- data/samples/po/de/hello_plural.po +1 -1
- data/samples/po/el/hello.po +2 -2
- data/samples/po/el/hello2.po +1 -1
- data/samples/po/el/hello_glade2.po +1 -1
- data/samples/po/el/{hello_gtk.po → hello_gtk2.po} +1 -1
- data/samples/po/el/hello_noop.po +1 -1
- data/samples/po/el/hello_plural.po +1 -1
- data/samples/po/el/hello_tk.po +1 -1
- data/samples/po/eo/hello.po +2 -2
- data/samples/po/eo/hello2.po +1 -1
- data/samples/po/eo/hello_glade2.po +1 -1
- data/samples/po/eo/{hello_gtk.po → hello_gtk2.po} +1 -1
- data/samples/po/eo/hello_noop.po +1 -1
- data/samples/po/eo/hello_plural.po +1 -1
- data/samples/po/eo/hello_tk.po +1 -1
- data/samples/po/es/{hello_gtk.po → hello_gtk2.po} +0 -0
- data/samples/po/fr/{hello_gtk.po → hello_gtk2.po} +0 -0
- data/samples/po/hello.pot +13 -13
- data/samples/po/hello2.pot +17 -17
- data/samples/po/hello_glade2.pot +12 -13
- data/{test/pot/backslash.pot → samples/po/hello_gtk2.pot} +8 -6
- data/samples/po/hello_noop.pot +13 -13
- data/samples/po/hello_plural.pot +14 -15
- data/samples/po/hello_tk.pot +9 -10
- data/samples/po/hr/hello.po +2 -2
- data/samples/po/hr/hello2.po +1 -1
- data/samples/po/hr/hello_glade2.po +1 -1
- data/samples/po/hr/{hello_gtk.po → hello_gtk2.po} +1 -1
- data/samples/po/hr/hello_noop.po +1 -1
- data/samples/po/hr/hello_plural.po +1 -1
- data/samples/po/hr/hello_tk.po +1 -1
- data/samples/po/hu/hello.po +2 -2
- data/samples/po/hu/hello2.po +1 -1
- data/samples/po/hu/hello_glade2.po +1 -1
- data/samples/po/hu/{hello_gtk.po → hello_gtk2.po} +1 -1
- data/samples/po/hu/hello_noop.po +1 -1
- data/samples/po/hu/hello_plural.po +1 -1
- data/samples/po/hu/hello_tk.po +1 -1
- data/samples/po/it/hello.po +1 -1
- data/samples/po/it/{hello_gtk.po → hello_gtk2.po} +0 -0
- data/samples/po/ja/{hello_gtk.po → hello_gtk2.po} +0 -0
- data/samples/po/ko/{hello_gtk.po → hello_gtk2.po} +0 -0
- data/samples/po/ko/hello_plural.po +1 -1
- data/samples/po/lv/hello.po +2 -2
- data/samples/po/lv/hello2.po +1 -1
- data/samples/po/lv/hello_glade2.po +1 -1
- data/samples/po/lv/{hello_gtk.po → hello_gtk2.po} +1 -1
- data/samples/po/lv/hello_noop.po +1 -1
- data/samples/po/lv/hello_plural.po +1 -1
- data/samples/po/lv/hello_tk.po +1 -1
- data/samples/po/nb/hello.po +2 -2
- data/samples/po/nb/hello2.po +1 -1
- data/samples/po/nb/hello_glade2.po +1 -1
- data/samples/po/nb/{hello_gtk.po → hello_gtk2.po} +1 -1
- data/samples/po/nb/hello_noop.po +1 -1
- data/samples/po/nb/hello_plural.po +1 -1
- data/samples/po/nb/hello_tk.po +1 -1
- data/samples/po/nl/hello.po +2 -2
- data/samples/po/nl/hello2.po +1 -1
- data/samples/po/nl/hello_glade2.po +1 -1
- data/samples/po/nl/{hello_gtk.po → hello_gtk2.po} +1 -1
- data/samples/po/nl/hello_noop.po +1 -1
- data/samples/po/nl/hello_plural.po +1 -1
- data/samples/po/nl/hello_tk.po +1 -1
- data/samples/po/pt_BR/{hello_gtk.po → hello_gtk2.po} +0 -0
- data/samples/po/ru/hello.po +2 -2
- data/samples/po/ru/hello2.po +1 -1
- data/samples/po/ru/hello_glade2.po +1 -1
- data/samples/po/ru/{hello_gtk.po → hello_gtk2.po} +1 -1
- data/samples/po/ru/hello_noop.po +1 -1
- data/samples/po/ru/hello_plural.po +1 -1
- data/samples/po/ru/hello_tk.po +1 -1
- data/samples/po/sr/hello.po +2 -2
- data/samples/po/sr/hello2.po +1 -1
- data/samples/po/sr/hello_glade2.po +1 -1
- data/samples/po/sr/{hello_gtk.po → hello_gtk2.po} +1 -1
- data/samples/po/sr/hello_noop.po +1 -1
- data/samples/po/sr/hello_plural.po +1 -1
- data/samples/po/sr/hello_tk.po +1 -1
- data/samples/po/sv/{hello_gtk.po → hello_gtk2.po} +0 -0
- data/samples/po/uk/hello.po +2 -2
- data/samples/po/uk/hello2.po +1 -1
- data/samples/po/uk/hello_glade2.po +1 -1
- data/samples/po/uk/{hello_gtk.po → hello_gtk2.po} +1 -1
- data/samples/po/uk/hello_noop.po +1 -1
- data/samples/po/uk/hello_plural.po +1 -1
- data/samples/po/uk/hello_tk.po +1 -1
- data/samples/po/vi/hello.po +2 -2
- data/samples/po/vi/hello2.po +1 -1
- data/samples/po/vi/hello_glade2.po +1 -1
- data/samples/po/vi/{hello_gtk.po → hello_gtk2.po} +1 -1
- data/samples/po/vi/hello_noop.po +1 -1
- data/samples/po/vi/hello_plural.po +1 -1
- data/samples/po/vi/hello_tk.po +1 -1
- data/samples/po/zh/hello.po +2 -2
- data/samples/po/zh/hello2.po +1 -1
- data/samples/po/zh/hello_glade2.po +1 -1
- data/samples/po/zh/{hello_gtk.po → hello_gtk2.po} +1 -1
- data/samples/po/zh/hello_noop.po +1 -1
- data/samples/po/zh/hello_plural.po +1 -1
- data/samples/po/zh/hello_tk.po +1 -1
- data/samples/po/zh_TW/hello.po +2 -2
- data/samples/po/zh_TW/hello2.po +1 -1
- data/samples/po/zh_TW/hello_glade2.po +1 -1
- data/samples/po/zh_TW/{hello_gtk.po → hello_gtk2.po} +1 -1
- data/samples/po/zh_TW/hello_noop.po +1 -1
- data/samples/po/zh_TW/hello_plural.po +1 -1
- data/samples/po/zh_TW/hello_tk.po +1 -1
- data/src/poparser.ry +18 -14
- data/test/{testlib → fixtures}/N_.rb +0 -0
- data/test/{testlib/gettext.rb → fixtures/_.rb} +27 -1
- data/test/fixtures/_/one_line.rb +32 -0
- data/test/fixtures/backslash.rb +29 -0
- data/test/{testlib → fixtures}/erb.rhtml +0 -0
- data/test/{testlib → fixtures}/erb.rxml +0 -0
- data/test/{testlib → fixtures}/gladeparser.glade +0 -0
- data/test/{testlib → fixtures}/multi_textdomain.rb +0 -0
- data/test/{testlib/ngettext.rb → fixtures/n_.rb} +20 -1
- data/test/{testlib → fixtures}/non_ascii.rb +0 -0
- data/test/fixtures/np_.rb +51 -0
- data/test/{testlib/nsgettext.rb → fixtures/ns_.rb} +20 -2
- data/test/fixtures/ns_/custom.rb +32 -0
- data/test/fixtures/p_.rb +57 -0
- data/test/fixtures/s_.rb +66 -0
- data/test/fixtures/s_/custom.rb +32 -0
- data/test/{testlib → fixtures}/simple.rb +0 -0
- data/test/gettext-test-utils.rb +44 -0
- data/test/locale/ja/LC_MESSAGES/_.mo +0 -0
- data/test/locale/ja/LC_MESSAGES/backslash.mo +0 -0
- data/test/locale/ja/LC_MESSAGES/np_.mo +0 -0
- data/test/locale/ja/LC_MESSAGES/ns_.mo +0 -0
- data/test/locale/ja/LC_MESSAGES/p_.mo +0 -0
- data/test/locale/ja/LC_MESSAGES/s_.mo +0 -0
- data/test/parser/test_ruby.rb +121 -0
- data/test/po/_.pot +109 -0
- data/test/{pot/sgettext.pot → po/backslash.pot} +10 -4
- data/test/po/ja/_.po +114 -0
- data/test/po/ja/backslash.po +3 -3
- data/test/po/ja/non_ascii.po +1 -1
- data/test/po/ja/{npgettext.po → np_.po} +6 -6
- data/test/po/ja/{nsgettext.po → ns_.po} +16 -10
- data/test/po/ja/{pgettext.po → p_.po} +5 -5
- data/test/po/ja/{sgettext.po → s_.po} +0 -0
- data/test/{pot → po}/non_ascii.pot +7 -5
- data/test/{pot/npgettext.pot → po/np_.pot} +10 -9
- data/test/{pot/nsgettext.pot → po/ns_.pot} +20 -12
- data/test/{pot/pgettext.pot → po/p_.pot} +12 -10
- data/test/po/s_.pot +55 -0
- data/test/run-test.rb +5 -0
- data/test/test_class_info.rb +0 -1
- data/test/test_gettext.rb +49 -12
- data/test/test_locale_path.rb +1 -4
- data/test/test_mofile.rb +0 -1
- data/test/test_parser.rb +119 -88
- data/test/test_po_generation.rb +32 -9
- data/test/{test_pomessage.rb → test_po_message.rb} +18 -1
- data/test/test_po_parser.rb +117 -0
- data/test/test_string.rb +0 -2
- data/test/test_textdomain_bind.rb +0 -2
- data/test/test_textdomain_multi.rb +1 -2
- data/test/test_textdomain_toplevel.rb +0 -1
- data/test/test_thread.rb +0 -1
- data/test/tools/test_msginit.rb +351 -0
- data/test/tools/test_msgmerge.rb +202 -0
- data/test/tools/test_tools.rb +0 -2
- data/test/tools/test_xgettext.rb +154 -0
- metadata +822 -753
- data/bin/rgettext +0 -23
- data/data/locale/bg/LC_MESSAGES/rgettext.mo +0 -0
- data/data/locale/bs/LC_MESSAGES/rgettext.mo +0 -0
- data/data/locale/ca/LC_MESSAGES/rgettext.mo +0 -0
- data/data/locale/cs/LC_MESSAGES/rgettext.mo +0 -0
- data/data/locale/de/LC_MESSAGES/rgettext.mo +0 -0
- data/data/locale/el/LC_MESSAGES/rgettext.mo +0 -0
- data/data/locale/eo/LC_MESSAGES/rgettext.mo +0 -0
- data/data/locale/es/LC_MESSAGES/rgettext.mo +0 -0
- data/data/locale/et/LC_MESSAGES/rgettext.mo +0 -0
- data/data/locale/fr/LC_MESSAGES/rgettext.mo +0 -0
- data/data/locale/hr/LC_MESSAGES/rgettext.mo +0 -0
- data/data/locale/hu/LC_MESSAGES/rgettext.mo +0 -0
- data/data/locale/it/LC_MESSAGES/rgettext.mo +0 -0
- data/data/locale/ja/LC_MESSAGES/rgettext.mo +0 -0
- data/data/locale/ko/LC_MESSAGES/rgettext.mo +0 -0
- data/data/locale/lv/LC_MESSAGES/rgettext.mo +0 -0
- data/data/locale/nb/LC_MESSAGES/rgettext.mo +0 -0
- data/data/locale/nl/LC_MESSAGES/rgettext.mo +0 -0
- data/data/locale/pt_BR/LC_MESSAGES/rgettext.mo +0 -0
- data/data/locale/ru/LC_MESSAGES/rgettext.mo +0 -0
- data/data/locale/sr/LC_MESSAGES/rgettext.mo +0 -0
- data/data/locale/sv/LC_MESSAGES/rgettext.mo +0 -0
- data/data/locale/uk/LC_MESSAGES/rgettext.mo +0 -0
- data/data/locale/vi/LC_MESSAGES/rgettext.mo +0 -0
- data/data/locale/zh/LC_MESSAGES/rgettext.mo +0 -0
- data/data/locale/zh_TW/LC_MESSAGES/rgettext.mo +0 -0
- data/lib/gettext/tools/rgettext.rb +0 -251
- data/lib/gettext/tools/rmsgfmt.rb +0 -86
- data/lib/gettext/tools/rmsgmerge.rb +0 -500
- data/samples/makemo.rb +0 -6
- data/samples/po/hello_gtk.pot +0 -23
- data/samples/po/test.rb +0 -13
- data/test/testlib/backslash.rb +0 -12
- data/test/testlib/helper.rb +0 -13
- data/test/testlib/npgettext.rb +0 -33
- data/test/testlib/pgettext.rb +0 -38
- data/test/testlib/sgettext.rb +0 -48
data/test/test_po_generation.rb
CHANGED
@@ -1,17 +1,40 @@
|
|
1
|
-
#
|
1
|
+
# -*- coding: utf-8 -*-
|
2
|
+
#
|
3
|
+
# Copyright (C) 2012 Kouhei Sutou <kou@clear-code.com>
|
4
|
+
# Copyright (C) 2012 Haruka Yoshihara <yoshihara@clear-code.com>
|
5
|
+
# Copyright (C) 2010 masone (Christian Felder) <ema@rh-productions.ch>
|
6
|
+
# Copyright (C) 2009 Masao Mutoh
|
7
|
+
# Copyright (C) 2009 Vladimir Dobriakov <vladimir@geekq.net>
|
8
|
+
#
|
9
|
+
# License: Ruby's or LGPL
|
10
|
+
#
|
11
|
+
# This library is free software: you can redistribute it and/or modify
|
12
|
+
# it under the terms of the GNU Lesser General Public License as published by
|
13
|
+
# the Free Software Foundation, either version 3 of the License, or
|
14
|
+
# (at your option) any later version.
|
15
|
+
#
|
16
|
+
# This library is distributed in the hope that it will be useful,
|
17
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
18
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
19
|
+
# GNU Lesser General Public License for more details.
|
20
|
+
#
|
21
|
+
# You should have received a copy of the GNU Lesser General Public License
|
22
|
+
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
2
23
|
|
3
|
-
require 'testlib/helper.rb'
|
4
24
|
require 'gettext'
|
5
|
-
require 'gettext/tools/
|
6
|
-
require 'stringio'
|
25
|
+
require 'gettext/tools/xgettext.rb'
|
7
26
|
|
8
27
|
class TestPoGeneration < Test::Unit::TestCase
|
9
28
|
def test_extracted_comments
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
29
|
+
input_file = File.join(File.dirname(__FILE__), 'fixtures/_.rb')
|
30
|
+
res = ""
|
31
|
+
Dir.mktmpdir do |dir|
|
32
|
+
Dir.chdir(dir) do
|
33
|
+
out = "comments.pot"
|
34
|
+
GetText::Tools::XGetText.run(input_file, "-o", out)
|
35
|
+
res = File.read(out)
|
36
|
+
end
|
37
|
+
end
|
15
38
|
# Use following to debug the content of the
|
16
39
|
# created file: File.open('/tmp/test.po', 'w').write(res)
|
17
40
|
|
@@ -1,6 +1,5 @@
|
|
1
1
|
# encoding: utf-8
|
2
2
|
|
3
|
-
require 'testlib/helper.rb'
|
4
3
|
require 'gettext/tools/parser/ruby'
|
5
4
|
|
6
5
|
# Most functionality of PoMessage is thoroughly tested together
|
@@ -98,4 +97,22 @@ class TestPoMessage < Test::Unit::TestCase
|
|
98
97
|
po.sources = ["file1:1", "file2:10"]
|
99
98
|
assert_raise(RuntimeError){ po.to_po_str }
|
100
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
|
101
118
|
end
|
@@ -0,0 +1,117 @@
|
|
1
|
+
# -*- coding: utf-8 -*-
|
2
|
+
#
|
3
|
+
# Copyright (C) 2012 Kouhei Sutou <kou@clear-code.com>
|
4
|
+
# Copyright (C) 2012 Haruka Yoshihara <yoshihara@clear-code.com>
|
5
|
+
#
|
6
|
+
# License: Ruby's or LGPL
|
7
|
+
#
|
8
|
+
# This library is free software: you can redistribute it and/or modify
|
9
|
+
# it under the terms of the GNU Lesser General Public License as published by
|
10
|
+
# the Free Software Foundation, either version 3 of the License, or
|
11
|
+
# (at your option) any later version.
|
12
|
+
#
|
13
|
+
# This library is distributed in the hope that it will be useful,
|
14
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
15
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
16
|
+
# GNU Lesser General Public License for more details.
|
17
|
+
#
|
18
|
+
# You should have received a copy of the GNU Lesser General Public License
|
19
|
+
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
20
|
+
|
21
|
+
require "gettext/tools/poparser"
|
22
|
+
|
23
|
+
class TestPoParser < Test::Unit::TestCase
|
24
|
+
def test_msgstr_not_existing
|
25
|
+
po_file = create_po_file(<<-EOP)
|
26
|
+
msgid "Hello"
|
27
|
+
msgstr ""
|
28
|
+
EOP
|
29
|
+
messages = parse_po_file(po_file)
|
30
|
+
|
31
|
+
assert_equal("", messages["Hello"])
|
32
|
+
end
|
33
|
+
|
34
|
+
private
|
35
|
+
def create_po_file(content)
|
36
|
+
po_file = Tempfile.new("hello.po")
|
37
|
+
po_file.print(content)
|
38
|
+
po_file.close
|
39
|
+
po_file
|
40
|
+
end
|
41
|
+
|
42
|
+
def parse_po_file(po_file)
|
43
|
+
parser = GetText::PoParser.new
|
44
|
+
parser.parse_file(po_file.path, MoFile.new)
|
45
|
+
end
|
46
|
+
|
47
|
+
class FuzzyTest < self
|
48
|
+
def setup
|
49
|
+
@po = <<-EOP
|
50
|
+
#, fuzzy
|
51
|
+
msgid "Hello"
|
52
|
+
msgstr "Bonjour"
|
53
|
+
EOP
|
54
|
+
@po_file = Tempfile.new("hello.po")
|
55
|
+
@po_file.print(@po)
|
56
|
+
@po_file.close
|
57
|
+
end
|
58
|
+
|
59
|
+
class IgnoreTest < self
|
60
|
+
def test_report_warning
|
61
|
+
mock($stderr).print("Warning: fuzzy message was ignored.\n")
|
62
|
+
mock($stderr).print(" #{@po_file.path}: msgid 'Hello'\n")
|
63
|
+
messages = parse do |parser|
|
64
|
+
parser.ignore_fuzzy = true
|
65
|
+
parser.report_warning = true
|
66
|
+
end
|
67
|
+
assert_nil(messages["Hello"])
|
68
|
+
end
|
69
|
+
|
70
|
+
def test_not_report_warning
|
71
|
+
dont_allow($stderr).print("Warning: fuzzy message was ignored.\n")
|
72
|
+
dont_allow($stderr).print(" #{@po_file.path}: msgid 'Hello'\n")
|
73
|
+
messages = parse do |parser|
|
74
|
+
parser.ignore_fuzzy = true
|
75
|
+
parser.report_warning = false
|
76
|
+
end
|
77
|
+
assert_nil(messages["Hello"])
|
78
|
+
end
|
79
|
+
end
|
80
|
+
|
81
|
+
class NotIgnore < self
|
82
|
+
def test_report_warning
|
83
|
+
mock($stderr).print("Warning: fuzzy message was used.\n")
|
84
|
+
mock($stderr).print(" #{@po_file.path}: msgid 'Hello'\n")
|
85
|
+
messages = parse do |parser|
|
86
|
+
parser.ignore_fuzzy = false
|
87
|
+
parser.report_warning = true
|
88
|
+
end
|
89
|
+
assert_equal("Bonjour", messages["Hello"])
|
90
|
+
end
|
91
|
+
|
92
|
+
def test_not_report_warning
|
93
|
+
dont_allow($stderr).print("Warning: fuzzy message was used.\n")
|
94
|
+
dont_allow($stderr).print(" #{@po_file.path}: msgid 'Hello'\n")
|
95
|
+
messages = parse do |parser|
|
96
|
+
parser.ignore_fuzzy = false
|
97
|
+
parser.report_warning = false
|
98
|
+
end
|
99
|
+
assert_equal("Bonjour", messages["Hello"])
|
100
|
+
end
|
101
|
+
end
|
102
|
+
|
103
|
+
private
|
104
|
+
def parse
|
105
|
+
parser = GetText::PoParser.new
|
106
|
+
class << parser
|
107
|
+
def _(message_id)
|
108
|
+
message_id
|
109
|
+
end
|
110
|
+
end
|
111
|
+
messages = MoFile.new
|
112
|
+
yield parser
|
113
|
+
parser.parse_file(@po_file.path, messages)
|
114
|
+
messages
|
115
|
+
end
|
116
|
+
end
|
117
|
+
end
|
data/test/test_string.rb
CHANGED
data/test/test_thread.rb
CHANGED
@@ -0,0 +1,351 @@
|
|
1
|
+
# -*- coding: utf-8 -*-
|
2
|
+
#
|
3
|
+
# Copyright (C) 2012 Haruka Yoshihara <yoshihara@clear-code.com>
|
4
|
+
# Copyright (C) 2012 Kouhei Sutou <kou@clear-code.com>
|
5
|
+
#
|
6
|
+
# License: Ruby's or LGPL
|
7
|
+
#
|
8
|
+
# This library is free software: you can redistribute it and/or modify
|
9
|
+
# it under the terms of the GNU Lesser General Public License as published by
|
10
|
+
# the Free Software Foundation, either version 3 of the License, or
|
11
|
+
# (at your option) any later version.
|
12
|
+
#
|
13
|
+
# This library is distributed in the hope that it will be useful,
|
14
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
15
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
16
|
+
# GNU Lesser General Public License for more details.
|
17
|
+
#
|
18
|
+
# You should have received a copy of the GNU Lesser General Public License
|
19
|
+
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
20
|
+
|
21
|
+
require "gettext/tools/msginit"
|
22
|
+
|
23
|
+
class TestToolsMsgInit < Test::Unit::TestCase
|
24
|
+
def setup
|
25
|
+
@msginit = GetText::Tools::MsgInit.new
|
26
|
+
stub(@msginit).read_translator_full_name {translator_full_name}
|
27
|
+
stub(@msginit).read_translator_mail {translator_mail}
|
28
|
+
|
29
|
+
Locale.current = "ja_JP.UTF-8"
|
30
|
+
@pot_create_date = "2012-08-24 11:35+0900"
|
31
|
+
@po_revision_date = Time.now.strftime("%Y-%m-%d %H:%M%z")
|
32
|
+
end
|
33
|
+
|
34
|
+
def test_all_options
|
35
|
+
Dir.mktmpdir do |dir|
|
36
|
+
pot_file_path = File.join(dir, "test.pot")
|
37
|
+
create_pot_file(pot_file_path)
|
38
|
+
po_file_path = File.join(dir, "test.po")
|
39
|
+
locale = "en"
|
40
|
+
language = locale
|
41
|
+
|
42
|
+
@msginit.run("--input", pot_file_path,
|
43
|
+
"--output", po_file_path,
|
44
|
+
"--locale", locale)
|
45
|
+
|
46
|
+
actual_po_header = normalize_po_header(po_file_path)
|
47
|
+
expected_po_header = po_header(locale, language)
|
48
|
+
assert_equal(expected_po_header, actual_po_header)
|
49
|
+
end
|
50
|
+
end
|
51
|
+
|
52
|
+
def test_locale_including_language
|
53
|
+
Dir.mktmpdir do |dir|
|
54
|
+
Dir.chdir(dir) do
|
55
|
+
create_pot_file("test.pot")
|
56
|
+
locale = "en"
|
57
|
+
language = locale
|
58
|
+
po_file_path = "#{locale}.po"
|
59
|
+
|
60
|
+
@msginit.run("--locale", locale)
|
61
|
+
|
62
|
+
actual_po_header = normalize_po_header(po_file_path)
|
63
|
+
expected_po_header = po_header(locale, language)
|
64
|
+
assert_equal(expected_po_header, actual_po_header)
|
65
|
+
end
|
66
|
+
end
|
67
|
+
end
|
68
|
+
|
69
|
+
def test_locale_including_language_and_region
|
70
|
+
Dir.mktmpdir do |dir|
|
71
|
+
Dir.chdir(dir) do
|
72
|
+
create_pot_file("test.pot")
|
73
|
+
locale = "en_US"
|
74
|
+
language = "en"
|
75
|
+
po_file_path = "#{locale}.po"
|
76
|
+
|
77
|
+
@msginit.run("--locale", locale)
|
78
|
+
|
79
|
+
actual_po_header = normalize_po_header(po_file_path)
|
80
|
+
expected_po_header = po_header(locale, language)
|
81
|
+
assert_equal(expected_po_header, actual_po_header)
|
82
|
+
end
|
83
|
+
end
|
84
|
+
end
|
85
|
+
|
86
|
+
def test_locale_including_language_and_region_with_charset
|
87
|
+
Dir.mktmpdir do |dir|
|
88
|
+
Dir.chdir(dir) do
|
89
|
+
create_pot_file("test.pot")
|
90
|
+
locale = "en_US"
|
91
|
+
language = "en"
|
92
|
+
charset = "UTF-8"
|
93
|
+
po_file_path = "en_US.po"
|
94
|
+
|
95
|
+
@msginit.run("--locale", "#{locale}.#{charset}")
|
96
|
+
|
97
|
+
actual_po_header = normalize_po_header(po_file_path)
|
98
|
+
expected_po_header = po_header(locale, language)
|
99
|
+
assert_equal(expected_po_header, actual_po_header)
|
100
|
+
end
|
101
|
+
end
|
102
|
+
end
|
103
|
+
|
104
|
+
def test_pot_file_and_po_file
|
105
|
+
Dir.mktmpdir do |dir|
|
106
|
+
pot_file_path = File.join(dir, "test.pot")
|
107
|
+
create_pot_file(pot_file_path)
|
108
|
+
locale = current_locale
|
109
|
+
language = current_language
|
110
|
+
po_file_path = File.join(dir, "test.po")
|
111
|
+
|
112
|
+
@msginit.run("--input", pot_file_path, "--output", po_file_path)
|
113
|
+
|
114
|
+
actual_po_header = normalize_po_header(po_file_path)
|
115
|
+
expected_po_header = po_header(locale, language)
|
116
|
+
assert_equal(expected_po_header, actual_po_header)
|
117
|
+
end
|
118
|
+
end
|
119
|
+
|
120
|
+
def test_pot_file
|
121
|
+
Dir.mktmpdir do |dir|
|
122
|
+
Dir.chdir(dir) do
|
123
|
+
pot_file_path = "test.pot"
|
124
|
+
create_pot_file(pot_file_path)
|
125
|
+
locale = current_locale
|
126
|
+
language = current_language
|
127
|
+
po_file_path = "#{locale}.po"
|
128
|
+
|
129
|
+
@msginit.run("--input", pot_file_path)
|
130
|
+
|
131
|
+
actual_po_header = normalize_po_header(po_file_path)
|
132
|
+
expected_po_header = po_header(locale, language)
|
133
|
+
assert_equal(expected_po_header, actual_po_header)
|
134
|
+
end
|
135
|
+
end
|
136
|
+
end
|
137
|
+
|
138
|
+
def test_no_options
|
139
|
+
Dir.mktmpdir do |dir|
|
140
|
+
Dir.chdir(dir) do
|
141
|
+
create_pot_file("test.pot")
|
142
|
+
locale = current_locale
|
143
|
+
language = current_language
|
144
|
+
po_file_path = "#{locale}.po"
|
145
|
+
|
146
|
+
@msginit.run
|
147
|
+
|
148
|
+
actual_po_header = normalize_po_header(po_file_path)
|
149
|
+
expected_po_header = po_header(locale, language)
|
150
|
+
assert_equal(expected_po_header, actual_po_header)
|
151
|
+
end
|
152
|
+
end
|
153
|
+
end
|
154
|
+
|
155
|
+
def test_no_translator
|
156
|
+
stub(@msginit).read_translator_full_name {nil}
|
157
|
+
stub(@msginit).read_translator_mail {nil}
|
158
|
+
|
159
|
+
Dir.mktmpdir do |dir|
|
160
|
+
Dir.chdir(dir) do
|
161
|
+
create_pot_file("test.pot")
|
162
|
+
locale = current_locale
|
163
|
+
language = current_language
|
164
|
+
po_file_path = "#{locale}.po"
|
165
|
+
|
166
|
+
@msginit.run
|
167
|
+
|
168
|
+
actual_po_header = normalize_po_header(po_file_path)
|
169
|
+
expected_po_header = no_translator_po_header(locale, language)
|
170
|
+
assert_equal(expected_po_header, actual_po_header)
|
171
|
+
end
|
172
|
+
end
|
173
|
+
end
|
174
|
+
|
175
|
+
def test_no_translator_full_name
|
176
|
+
stub(@msginit).read_translator_full_name {nil}
|
177
|
+
|
178
|
+
Dir.mktmpdir do |dir|
|
179
|
+
Dir.chdir(dir) do
|
180
|
+
create_pot_file("test.pot")
|
181
|
+
locale = current_locale
|
182
|
+
language = current_language
|
183
|
+
po_file_path = "#{locale}.po"
|
184
|
+
|
185
|
+
@msginit.run
|
186
|
+
|
187
|
+
actual_po_header = normalize_po_header(po_file_path)
|
188
|
+
expected_po_header = no_translator_po_header(locale, language)
|
189
|
+
assert_equal(expected_po_header, actual_po_header)
|
190
|
+
end
|
191
|
+
end
|
192
|
+
end
|
193
|
+
|
194
|
+
def test_no_translator_mail
|
195
|
+
stub(@msginit).read_translator_mail {nil}
|
196
|
+
|
197
|
+
Dir.mktmpdir do |dir|
|
198
|
+
Dir.chdir(dir) do
|
199
|
+
create_pot_file("test.pot")
|
200
|
+
locale = current_locale
|
201
|
+
language = current_language
|
202
|
+
po_file_path = "#{locale}.po"
|
203
|
+
|
204
|
+
@msginit.run
|
205
|
+
|
206
|
+
actual_po_header = normalize_po_header(po_file_path)
|
207
|
+
expected_po_header = no_translator_po_header(locale, language)
|
208
|
+
assert_equal(expected_po_header, actual_po_header)
|
209
|
+
end
|
210
|
+
end
|
211
|
+
end
|
212
|
+
|
213
|
+
def test_package_name_specified_in_project_id_version
|
214
|
+
Dir.mktmpdir do |dir|
|
215
|
+
Dir.chdir(dir) do
|
216
|
+
pot_file_name = "test.pot"
|
217
|
+
options = {:package_name => "test-package"}
|
218
|
+
pot_file = create_pot_file(pot_file_name, options)
|
219
|
+
locale = current_locale
|
220
|
+
language = current_language
|
221
|
+
po_file_path = "#{locale}.po"
|
222
|
+
|
223
|
+
@msginit.run("--input", pot_file_name)
|
224
|
+
|
225
|
+
expected_po_header = po_header(locale, language, options)
|
226
|
+
actual_po_header = normalize_po_header(po_file_path)
|
227
|
+
|
228
|
+
assert_equal(expected_po_header, actual_po_header)
|
229
|
+
end
|
230
|
+
end
|
231
|
+
end
|
232
|
+
|
233
|
+
private
|
234
|
+
def current_locale
|
235
|
+
Locale.current.to_simple.to_s
|
236
|
+
end
|
237
|
+
|
238
|
+
def current_language
|
239
|
+
Locale.current.language
|
240
|
+
end
|
241
|
+
|
242
|
+
def translator_full_name
|
243
|
+
"me"
|
244
|
+
end
|
245
|
+
|
246
|
+
def translator_mail
|
247
|
+
"me@example.com"
|
248
|
+
end
|
249
|
+
|
250
|
+
def create_pot_file(path, options=nil)
|
251
|
+
options ||= {}
|
252
|
+
File.open(path, "w") do |pot_file|
|
253
|
+
pot_file.puts(pot_header(options))
|
254
|
+
end
|
255
|
+
end
|
256
|
+
|
257
|
+
def pot_header(options)
|
258
|
+
package_name = options[:package_name] || default_package_name
|
259
|
+
<<EOF
|
260
|
+
# SOME DESCRIPTIVE TITLE.
|
261
|
+
# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
|
262
|
+
# This file is distributed under the same license as the PACKAGE package.
|
263
|
+
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
|
264
|
+
#
|
265
|
+
#, fuzzy
|
266
|
+
msgid ""
|
267
|
+
msgstr ""
|
268
|
+
"Project-Id-Version: #{package_name} VERSION\\n"
|
269
|
+
"POT-Creation-Date: #{@pot_create_date}\\n"
|
270
|
+
"PO-Revision-Date: #{@pot_create_date}\\n"
|
271
|
+
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\\n"
|
272
|
+
"Language: \\n"
|
273
|
+
"Language-Team: LANGUAGE <LL@li.org>\\n"
|
274
|
+
"MIME-Version: 1.0\\n"
|
275
|
+
"Content-Type: text/plain; charset=UTF-8\\n"
|
276
|
+
"Content-Transfer-Encoding: 8bit\\n"
|
277
|
+
"Plural-Forms: nplurals=INTEGER; plural=EXPRESSION;\\n"
|
278
|
+
EOF
|
279
|
+
end
|
280
|
+
|
281
|
+
def normalize_po_header(po_file_path)
|
282
|
+
po_file = ""
|
283
|
+
File.open(po_file_path) do |file|
|
284
|
+
po_file = file.read
|
285
|
+
end
|
286
|
+
|
287
|
+
po_file = po_file.gsub(/#{Regexp.escape(@pot_create_date)}/,
|
288
|
+
"XXXX-XX-XX XX:XX+XXXX")
|
289
|
+
po_file = po_file.gsub(/#{Regexp.escape(@po_revision_date)}/,
|
290
|
+
"YYYY-YY-YY YY:YY+YYYY")
|
291
|
+
po_file.gsub(/#{Time.now.year}/, "YEAR")
|
292
|
+
end
|
293
|
+
|
294
|
+
def po_header(locale, language, options=nil)
|
295
|
+
options ||= {}
|
296
|
+
package_name = options[:package_name] || default_package_name
|
297
|
+
full_name = translator_full_name
|
298
|
+
mail = translator_mail
|
299
|
+
language_name = Locale::Info.get_language(language).name
|
300
|
+
plural_forms = @msginit.send(:plural_forms, language)
|
301
|
+
|
302
|
+
<<EOF
|
303
|
+
# #{language_name} translations for #{package_name} package.
|
304
|
+
# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
|
305
|
+
# This file is distributed under the same license as the PACKAGE package.
|
306
|
+
# #{full_name} <#{mail}>, YEAR.
|
307
|
+
#
|
308
|
+
msgid ""
|
309
|
+
msgstr ""
|
310
|
+
"Project-Id-Version: #{package_name} VERSION\\n"
|
311
|
+
"POT-Creation-Date: XXXX-XX-XX XX:XX+XXXX\\n"
|
312
|
+
"PO-Revision-Date: YYYY-YY-YY YY:YY+YYYY\\n"
|
313
|
+
"Last-Translator: #{full_name} <#{mail}>\\n"
|
314
|
+
"Language: #{locale}\\n"
|
315
|
+
"Language-Team: #{language_name}\\n"
|
316
|
+
"MIME-Version: 1.0\\n"
|
317
|
+
"Content-Type: text/plain; charset=UTF-8\\n"
|
318
|
+
"Content-Transfer-Encoding: 8bit\\n"
|
319
|
+
"Plural-Forms: #{plural_forms}\\n"
|
320
|
+
EOF
|
321
|
+
end
|
322
|
+
|
323
|
+
def default_package_name
|
324
|
+
"PACKAGE"
|
325
|
+
end
|
326
|
+
|
327
|
+
def no_translator_po_header(locale, language)
|
328
|
+
language_name = Locale::Info.get_language(language).name
|
329
|
+
plural_forms = @msginit.send(:plural_forms, language)
|
330
|
+
|
331
|
+
<<EOF
|
332
|
+
# #{language_name} translations for PACKAGE package.
|
333
|
+
# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
|
334
|
+
# This file is distributed under the same license as the PACKAGE package.
|
335
|
+
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
|
336
|
+
#
|
337
|
+
msgid ""
|
338
|
+
msgstr ""
|
339
|
+
"Project-Id-Version: PACKAGE VERSION\\n"
|
340
|
+
"POT-Creation-Date: XXXX-XX-XX XX:XX+XXXX\\n"
|
341
|
+
"PO-Revision-Date: YYYY-YY-YY YY:YY+YYYY\\n"
|
342
|
+
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\\n"
|
343
|
+
"Language: #{locale}\\n"
|
344
|
+
"Language-Team: #{language_name}\\n"
|
345
|
+
"MIME-Version: 1.0\\n"
|
346
|
+
"Content-Type: text/plain; charset=UTF-8\\n"
|
347
|
+
"Content-Transfer-Encoding: 8bit\\n"
|
348
|
+
"Plural-Forms: #{plural_forms}\\n"
|
349
|
+
EOF
|
350
|
+
end
|
351
|
+
end
|