diff options
Diffstat (limited to 'vendor/gems/gettext-2.1.0/test/testlib')
-rw-r--r-- | vendor/gems/gettext-2.1.0/test/testlib/N_.rb | 66 | ||||
-rw-r--r-- | vendor/gems/gettext-2.1.0/test/testlib/erb.rhtml | 15 | ||||
-rw-r--r-- | vendor/gems/gettext-2.1.0/test/testlib/erb.rxml | 16 | ||||
-rw-r--r-- | vendor/gems/gettext-2.1.0/test/testlib/gettext.rb | 113 | ||||
-rw-r--r-- | vendor/gems/gettext-2.1.0/test/testlib/gladeparser.glade | 183 | ||||
-rw-r--r-- | vendor/gems/gettext-2.1.0/test/testlib/helper.rb | 11 | ||||
-rw-r--r-- | vendor/gems/gettext-2.1.0/test/testlib/multi_textdomain.rb | 131 | ||||
-rw-r--r-- | vendor/gems/gettext-2.1.0/test/testlib/ngettext.rb | 79 | ||||
-rw-r--r-- | vendor/gems/gettext-2.1.0/test/testlib/npgettext.rb | 31 | ||||
-rw-r--r-- | vendor/gems/gettext-2.1.0/test/testlib/nsgettext.rb | 42 | ||||
-rw-r--r-- | vendor/gems/gettext-2.1.0/test/testlib/pgettext.rb | 36 | ||||
-rw-r--r-- | vendor/gems/gettext-2.1.0/test/testlib/sgettext.rb | 46 | ||||
-rw-r--r-- | vendor/gems/gettext-2.1.0/test/testlib/simple.rb | 14 |
13 files changed, 783 insertions, 0 deletions
diff --git a/vendor/gems/gettext-2.1.0/test/testlib/N_.rb b/vendor/gems/gettext-2.1.0/test/testlib/N_.rb new file mode 100644 index 000000000..f69b6ede2 --- /dev/null +++ b/vendor/gems/gettext-2.1.0/test/testlib/N_.rb @@ -0,0 +1,66 @@ +require 'gettext' +include GetText + +class TestRubyParser_N + bindtextdomain("testN_rubyparser", :path => "locale") + + def testN_1 + N_("aaa") + end + + def testN_2 + N_("aaa\n") + end + + def testN_3 + N_("bbb\nccc") + end + + def testN_4 + N_("bbb +ccc +ddd +") + end + + def testN_5 + N_("eee") + end + + def testN_6 + N_("eee") + "foo" + N_("fff") + end + + def testN_7 + N_("ggg"\ + "hhh"\ + "iii") + end + + def testN_8 + N_('a"b"c"') + end + + def testN_9 + N_("d\"e\"f\"") + end + + def testN_10 + N_("jjj") + + N_("kkk") + end + + def testN_11 + N_("lll" + "mmm") + end + + def testN_12 + puts N_(msg), "ppp" #Ignored + end + + def testN_13 + N_("nnn\n" + + "ooo") + end +end + diff --git a/vendor/gems/gettext-2.1.0/test/testlib/erb.rhtml b/vendor/gems/gettext-2.1.0/test/testlib/erb.rhtml new file mode 100644 index 000000000..d19c75cf2 --- /dev/null +++ b/vendor/gems/gettext-2.1.0/test/testlib/erb.rhtml @@ -0,0 +1,15 @@ +<% + require 'gettext' + include GetText + bindtextdomain("helloerb", :path => "locale") +%> +<html> +<head> +<title><%= _("aaa") %></title> +</head> +<body> +<h1><%= _("aaa\n") %></h1> +<p><%= N_("bbb") %></p> +<p><%= n_("ccc1", "ccc2", 1) %></p> +</body> +</html> diff --git a/vendor/gems/gettext-2.1.0/test/testlib/erb.rxml b/vendor/gems/gettext-2.1.0/test/testlib/erb.rxml new file mode 100644 index 000000000..cb0f1a269 --- /dev/null +++ b/vendor/gems/gettext-2.1.0/test/testlib/erb.rxml @@ -0,0 +1,16 @@ +<?xml version="1.0" standalone="no"?> +<% + require 'gettext' + include GetText + bindtextdomain("helloerb", :path => "locale") +%> +<html> +<head> +<title><%= _("aaa") %></title> +</head> +<body> +<h1><%= _("aaa\n") %></h1> +<p><%= N_("bbb") %></p> +<p><%= n_("ccc1", "ccc2", 1) %></p> +</body> +</html> diff --git a/vendor/gems/gettext-2.1.0/test/testlib/gettext.rb b/vendor/gems/gettext-2.1.0/test/testlib/gettext.rb new file mode 100644 index 000000000..0324e9424 --- /dev/null +++ b/vendor/gems/gettext-2.1.0/test/testlib/gettext.rb @@ -0,0 +1,113 @@ +require 'gettext' +include GetText + +class TestRubyParser + bindtextdomain("rubyparser", :path => "locale") + + def test_1 + _("aaa") + end + + def test_2 + _("aaa\n") + end + + def test_3 + _("bbb\nccc") + end + + def test_4 + _("bbb +ccc +ddd +") + end + + def test_5 + _("eee") + end + + def test_6 + _("eee") + "foo" + _("fff") + end + + def test_7 + _("ggg"\ + "hhh"\ + "iii") + end + + def test_8 + _('a"b"c"') + end + + def test_9 + _("d\"e\"f\"") + end + + def test_10 + _("jjj") + + _("kkk") + end + + def test_11 + _("lll" + "mmm") + end + + def test_12 + puts _(msg), "ppp" #Ignored + end + + def test_13 + _("nnn\n" + + "ooo") + end + def test_14 + _("\#") + end + + def test_15 + _('#') + end + + def test_16 + _('\taaa') + end + + def test_17 + ret = _(<<EOF +Here document1 +Here document2 +EOF +) + end + + def test_18 + "<div>#{_('in_quote')}</div>" + end + + def about + puts ( + # TRANSLATORS: This is a proper name. See the gettext + # manual, section Names. Note this is actually a non-ASCII + # name: The first name is (with Unicode escapes) + # "Fran\u00e7ois" or (with HTML entities) "François". + # Pronunciation is like "fraa-swa pee-nar". + # This is an example from GNU gettext documentation. + _("Francois Pinard")) + + puts ( + # This comment should not be extracted because it does + # not start with 'TRANSLATORS:' + _('self explaining')) + end + +end + +module ActionController + class Base + end +end +class ApplicationController < ActionController::Base + "#{Time.now.strftime('%m/%d')}" +end diff --git a/vendor/gems/gettext-2.1.0/test/testlib/gladeparser.glade b/vendor/gems/gettext-2.1.0/test/testlib/gladeparser.glade new file mode 100644 index 000000000..0e278cc61 --- /dev/null +++ b/vendor/gems/gettext-2.1.0/test/testlib/gladeparser.glade @@ -0,0 +1,183 @@ +<?xml version="1.0" standalone="no"?> <!--*- mode: xml -*--> +<!DOCTYPE glade-interface SYSTEM "http://glade.gnome.org/glade-2.0.dtd"> + +<glade-interface> + +<widget class="GtkWindow" id="window1"> + <property name="visible">True</property> + <property name="title" translatable="yes">window1</property> + <property name="type">GTK_WINDOW_TOPLEVEL</property> + <property name="window_position">GTK_WIN_POS_NONE</property> + <property name="modal">False</property> + <property name="resizable">True</property> + <property name="destroy_with_parent">False</property> + <property name="decorated">True</property> + <property name="skip_taskbar_hint">False</property> + <property name="skip_pager_hint">False</property> + <property name="type_hint">GDK_WINDOW_TYPE_HINT_NORMAL</property> + <property name="gravity">GDK_GRAVITY_NORTH_WEST</property> + + <child> + <widget class="GtkVBox" id="vbox1"> + <property name="visible">True</property> + <property name="homogeneous">False</property> + <property name="spacing">0</property> + + <child> + <widget class="GtkLabel" id="label4"> + <property name="visible">True</property> + <property name="label" translatable="yes">normal text</property> + <property name="use_underline">False</property> + <property name="use_markup">False</property> + <property name="justify">GTK_JUSTIFY_LEFT</property> + <property name="wrap">False</property> + <property name="selectable">False</property> + <property name="xalign">0.5</property> + <property name="yalign">0.5</property> + <property name="xpad">0</property> + <property name="ypad">0</property> + </widget> + <packing> + <property name="padding">0</property> + <property name="expand">False</property> + <property name="fill">False</property> + </packing> + </child> + + <child> + <widget class="GtkLabel" id="label5"> + <property name="visible">True</property> + <property name="label" translatable="yes">1st line +2nd line +3rd line</property> + <property name="use_underline">False</property> + <property name="use_markup">False</property> + <property name="justify">GTK_JUSTIFY_LEFT</property> + <property name="wrap">False</property> + <property name="selectable">False</property> + <property name="xalign">0.5</property> + <property name="yalign">0.5</property> + <property name="xpad">0</property> + <property name="ypad">0</property> + </widget> + <packing> + <property name="padding">0</property> + <property name="expand">False</property> + <property name="fill">False</property> + </packing> + </child> + + <child> + <widget class="GtkLabel" id="label6"> + <property name="visible">True</property> + <property name="label" translatable="yes"><span color="red" weight="bold" size="large">markup </span></property> + <property name="use_underline">False</property> + <property name="use_markup">True</property> + <property name="justify">GTK_JUSTIFY_LEFT</property> + <property name="wrap">False</property> + <property name="selectable">False</property> + <property name="xalign">0.5</property> + <property name="yalign">0.5</property> + <property name="xpad">0</property> + <property name="ypad">0</property> + </widget> + <packing> + <property name="padding">0</property> + <property name="expand">False</property> + <property name="fill">False</property> + </packing> + </child> + + <child> + <widget class="GtkLabel" id="label7"> + <property name="visible">True</property> + <property name="label" translatable="yes"><span color="red">1st line markup </span> +<span color="blue">2nd line markup</span></property> + <property name="use_underline">False</property> + <property name="use_markup">True</property> + <property name="justify">GTK_JUSTIFY_LEFT</property> + <property name="wrap">False</property> + <property name="selectable">False</property> + <property name="xalign">0.5</property> + <property name="yalign">0.5</property> + <property name="xpad">0</property> + <property name="ypad">0</property> + </widget> + <packing> + <property name="padding">0</property> + <property name="expand">False</property> + <property name="fill">False</property> + </packing> + </child> + + <child> + <widget class="GtkLabel" id="label8"> + <property name="visible">True</property> + <property name="label" translatable="yes"><span>&quot;markup&quot; with &lt;escaped strings&gt;</span></property> + <property name="use_underline">False</property> + <property name="use_markup">True</property> + <property name="justify">GTK_JUSTIFY_LEFT</property> + <property name="wrap">False</property> + <property name="selectable">False</property> + <property name="xalign">0.5</property> + <property name="yalign">0.5</property> + <property name="xpad">0</property> + <property name="ypad">0</property> + </widget> + <packing> + <property name="padding">0</property> + <property name="expand">False</property> + <property name="fill">False</property> + </packing> + </child> + + <child> + <widget class="GtkLabel" id="label9"> + <property name="visible">True</property> + <property name="label" translatable="yes">duplicated</property> + <property name="use_underline">False</property> + <property name="use_markup">False</property> + <property name="justify">GTK_JUSTIFY_LEFT</property> + <property name="wrap">False</property> + <property name="selectable">False</property> + <property name="xalign">0.5</property> + <property name="yalign">0.5</property> + <property name="xpad">0</property> + <property name="ypad">0</property> + </widget> + <packing> + <property name="padding">0</property> + <property name="expand">False</property> + <property name="fill">False</property> + </packing> + </child> + + <child> + <widget class="GtkLabel" id="label10"> + <property name="visible">True</property> + <property name="label" translatable="yes">duplicated</property> + <property name="use_underline">False</property> + <property name="use_markup">False</property> + <property name="justify">GTK_JUSTIFY_LEFT</property> + <property name="wrap">False</property> + <property name="selectable">False</property> + <property name="xalign">0.5</property> + <property name="yalign">0.5</property> + <property name="xpad">0</property> + <property name="ypad">0</property> + </widget> + <packing> + <property name="padding">0</property> + <property name="expand">False</property> + <property name="fill">False</property> + </packing> + </child> + + <child> + <placeholder/> + </child> + </widget> + </child> +</widget> + +</glade-interface> diff --git a/vendor/gems/gettext-2.1.0/test/testlib/helper.rb b/vendor/gems/gettext-2.1.0/test/testlib/helper.rb new file mode 100644 index 000000000..17754901c --- /dev/null +++ b/vendor/gems/gettext-2.1.0/test/testlib/helper.rb @@ -0,0 +1,11 @@ +$LOAD_PATH.unshift File.expand_path("../../lib", File.dirname(__FILE__)) +require 'test/unit' + +require 'rubygems' +require 'gettext' + +#optional gems +begin + require 'redgreen' +rescue LoadError +end diff --git a/vendor/gems/gettext-2.1.0/test/testlib/multi_textdomain.rb b/vendor/gems/gettext-2.1.0/test/testlib/multi_textdomain.rb new file mode 100644 index 000000000..dd9070b01 --- /dev/null +++ b/vendor/gems/gettext-2.1.0/test/testlib/multi_textdomain.rb @@ -0,0 +1,131 @@ +class C11 + include GetText + def initialize + bindtextdomain("test1", :path => "locale") + bindtextdomain("test2", :path => "locale") + end + def test + _("language") + end + def test2 + _("LANGUAGE") + end +end + +class C12 + include GetText + bindtextdomain("test1", :path => "locale") + bindtextdomain("test2", :path => "locale") + + def test + _("language") + end + def test2 + _("LANGUAGE") + end +end + +class C21 < C11 +end + +class C22 < C12 +end + +module M1 + include GetText + bindtextdomain("test1", :path => "locale") + + module_function + def test + _("language") + end + + module M1M1 + include GetText + module_function + def test + _("language") + end + # Doesn't translate + def test2 + _("LANGUAGE") + end + end + + class M1C1 + include GetText + bindtextdomain("test2", :path => "locale") + def test + _("language") + end + def test2 + _("LANGUAGE") + end + end + + class M1C2 + include GetText + def initialize + bindtextdomain("test2", :path => "locale") + end + def test + _("language") + end + def test2 + _("LANGUAGE") + end + end + +end + +class C2 + include GetText + def initialize + bindtextdomain("test1", :path => "locale") + end + + def test + _("language") + end + + def test_eval + eval("_(\"language\")") + end +end + +class C3 + include GetText + bindtextdomain("test1", :path => "locale") + + def test + _("language") + end + + def self.test + _("language") + end +end + +class C4 < C3 + bindtextdomain("test2", :path => "locale") + + def test2 + _("LANGUAGE") + end + + def test3 + _("no data") + end +end + +class C51 + include GetText + bindtextdomain("test3", :path => "locale") + def test + _("language") + end +end + +class C52 < C12 + bindtextdomain("test3", :path => "locale") +end diff --git a/vendor/gems/gettext-2.1.0/test/testlib/ngettext.rb b/vendor/gems/gettext-2.1.0/test/testlib/ngettext.rb new file mode 100644 index 000000000..d28eda695 --- /dev/null +++ b/vendor/gems/gettext-2.1.0/test/testlib/ngettext.rb @@ -0,0 +1,79 @@ +require 'gettext' +include GetText + +class TestRubyParser_n + bindtextdomain("rubyparser", :path => "locale") + + def test_1 + n_("aaa","aaa2",1) + end + + def test_2 + n_("bbb\n", "ccc2\nccc2", 1) + end + + def test_3_1 + n_("ddd\nddd", + "ddd2\nddd2", + 1) + end + def test_3_2 + n_("eee\neee\n" , + "eee2\neee2\n" , + 1) + end + + def test_4 + n_("ddd +eee +", "ddd +eee2", 1) + end + + def test_5_1 + n_("fff", "fff2", 1) + end + + def test_5_2 + n_("fff", "fff2", 1) + "foo" + n_("ggg", "ggg2", 1) + end + + def test_6 + n_("ggg"\ + "hhh"\ + "iii", + "jjj"\ + "kkk"\ + "lll", 1) + end + + def test_7 + n_('a"b"c"', 'a"b"c"2', 1) + end + + def test_8 + n_("d\"e\"f\"", "d\"e\"f\"2", 1) + end + + def test_9 + n_("mmm" + "mmm","mmm2" + "mmm2",1) + + n_("nnn" ,"nnn2" ,1) + end + + def test_10 + _("ooo") + n_("ooo", "ppp", 1) + end + + def test_11 + n_("qqq", "rrr", 1) + n_("qqq", "sss", 1) # This is merged to "qqq" with plural form "rrr". + end + + def extracted_comments + # TRANSLATORS:please provide translations for all + # the plural forms! + n_('comment', 'comments', 2) + end +end + diff --git a/vendor/gems/gettext-2.1.0/test/testlib/npgettext.rb b/vendor/gems/gettext-2.1.0/test/testlib/npgettext.rb new file mode 100644 index 000000000..b92c6cda7 --- /dev/null +++ b/vendor/gems/gettext-2.1.0/test/testlib/npgettext.rb @@ -0,0 +1,31 @@ +require 'gettext' + +class TestNPGetText + include GetText + bindtextdomain("npgettext", :path => "locale") + + def test_1 + [np_("Magazine", "a book", "%{num} books", 1), + np_("Magazine", "a book", "%{num} books", 2)] + end + + def test_2 + [npgettext("Magazine", "a book", "%{num} books", 1), + npgettext("Magazine", "a book", "%{num} books", 2)] + end + + def test_3 + [np_("Hardcover", "a book", "%{num} books", 1), + np_("Hardcover", "a book", "%{num} books", 2)] + end + + def test_4 + [np_("Magaine", "I have a magazine", "I have %{num} magazines", 1), + np_("Magaine", "I have a magazine", "I have %{num} magazines", 2)] + end + + def test_5 + [np_("Hardcover", "a picture", "%{num} pictures", 1), + np_("Hardcover", "a picture", "%{num} pictures", 2)] #not found. + end +end diff --git a/vendor/gems/gettext-2.1.0/test/testlib/nsgettext.rb b/vendor/gems/gettext-2.1.0/test/testlib/nsgettext.rb new file mode 100644 index 000000000..67ef25be5 --- /dev/null +++ b/vendor/gems/gettext-2.1.0/test/testlib/nsgettext.rb @@ -0,0 +1,42 @@ +require 'gettext' + +class TestNSGetText + include GetText + bindtextdomain("nsgettext", :path => "locale") + + def test_1 + [ns_("AAA|BBB", "CCC", 1), ns_("AAA|BBB", "CCC", 2)] + end + + def test_2 + [nsgettext("AAA|BBB", "CCC", 1), nsgettext("AAA|BBB", "CCC", 2)] + end + + def test_3 + [ns_("AAA", "BBB", 1), ns_("AAA", "BBB", 2)] #not found + end + + def test_4 + [ns_("AAA|CCC", "DDD", 1), ns_("AAA|CCC", "DDD", 2)] #not found + end + + def test_5 + [ns_("AAA|BBB|CCC", "DDD", 1), ns_("AAA|BBB|CCC", "DDD", 2)] #not found + end + + def test_6 + [ns_("AAA$BBB", "CCC", 1, "$"), ns_("AAA$BBB", "CCC", 2, "$")] #not found + end + + def test_7 + [ns_("AAA$B|BB", "CCC", 1, "$"), ns_("AAA$B|BB", "CCC", 2, "$")] #not found + end + + def test_8 + [ns_("AAA$B|CC", "DDD", 1, "$"), ns_("AAA$B|CC", "DDD", 2, "$")] + end + + def test_9 + [ns_("AAA|CCC|BBB", "DDD", 1), ns_("AAA|CCC|BBB", "DDD", 2)] #not found + end +end diff --git a/vendor/gems/gettext-2.1.0/test/testlib/pgettext.rb b/vendor/gems/gettext-2.1.0/test/testlib/pgettext.rb new file mode 100644 index 000000000..2d4c6fd60 --- /dev/null +++ b/vendor/gems/gettext-2.1.0/test/testlib/pgettext.rb @@ -0,0 +1,36 @@ +require 'gettext' + +class TestPGetText + include GetText + bindtextdomain("pgettext", :path => "locale") + + def test_1 + p_("AAA", "BBB") + end + + def test_2 + pgettext("AAA", "BBB") + end + + def test_3 + pgettext("AAA|BBB", "CCC") + end + + def test_4 + p_("AAA", "CCC") #not found + end + + def test_5 + p_("CCC", "BBB") + end + + def test_6 # not pgettext. + _("BBB") + end + + def with_context + # TRANSLATORS:please translate 'name' in the context of 'program'. + # Hint: the translation should NOT contain the translation of 'program'. + p_('program', 'name') + end +end diff --git a/vendor/gems/gettext-2.1.0/test/testlib/sgettext.rb b/vendor/gems/gettext-2.1.0/test/testlib/sgettext.rb new file mode 100644 index 000000000..050e266bf --- /dev/null +++ b/vendor/gems/gettext-2.1.0/test/testlib/sgettext.rb @@ -0,0 +1,46 @@ +require 'gettext' + +class TestSGetText + include GetText + bindtextdomain("sgettext", :path => "locale") + + def test_1 + s_("AAA|BBB") + end + + def test_2 + sgettext("AAA|BBB") + end + + def test_3 + s_("AAA") #not found + end + + def test_4 + s_("AAA|CCC") #not found + end + + def test_5 + s_("AAA|BBB|CCC") #not found + end + + def test_6 + s_("AAA$BBB", "$") #not found + end + + def test_7 + s_("AAA$B|BB", "$") #not found + end + + def test_8 + s_("AAA$B|CC", "$") + end + + def test_9 + s_("AAA|CCC|BBB") #not found + end + + def setlocale(locale) + __setlocale(locale) + end +end diff --git a/vendor/gems/gettext-2.1.0/test/testlib/simple.rb b/vendor/gems/gettext-2.1.0/test/testlib/simple.rb new file mode 100644 index 000000000..64339894a --- /dev/null +++ b/vendor/gems/gettext-2.1.0/test/testlib/simple.rb @@ -0,0 +1,14 @@ +require 'gettext' + +class Simple + include GetText + bindtextdomain("test1", :path => "locale") + + def test + _("language") + end + + def test_formatted_string + _("one is %d.") % 1 + end +end |