activesupport 2.3.5 → 2.3.6.pre
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of activesupport might be problematic. Click here for more details.
- data/CHANGELOG +23 -0
- data/lib/active_support.rb +1 -0
- data/lib/active_support/core_ext/date_time/conversions.rb +14 -3
- data/lib/active_support/core_ext/enumerable.rb +6 -0
- data/lib/active_support/core_ext/file/atomic.rb +2 -1
- data/lib/active_support/core_ext/numeric/conversions.rb +2 -2
- data/lib/active_support/core_ext/object.rb +1 -0
- data/lib/active_support/core_ext/object/metaclass.rb +6 -5
- data/lib/active_support/core_ext/object/singleton_class.rb +13 -0
- data/lib/active_support/core_ext/string.rb +0 -1
- data/lib/active_support/core_ext/string/output_safety.rb +148 -44
- data/lib/active_support/core_ext/time/calculations.rb +1 -1
- data/lib/active_support/inflector.rb +1 -1
- data/lib/active_support/json/backends/yajl.rb +40 -0
- data/lib/active_support/json/decoding.rb +16 -1
- data/lib/active_support/json/encoding.rb +11 -2
- data/lib/active_support/ordered_hash.rb +24 -1
- data/lib/active_support/vendor.rb +10 -2
- data/lib/active_support/vendor/i18n-0.3.3/CHANGELOG.textile +76 -0
- data/lib/active_support/vendor/{i18n-0.1.3 → i18n-0.3.3}/MIT-LICENSE +0 -0
- data/lib/active_support/vendor/i18n-0.3.3/README.textile +81 -0
- data/lib/active_support/vendor/i18n-0.3.3/Rakefile +24 -0
- data/lib/active_support/vendor/i18n-0.3.3/benchmark/example.yml +144 -0
- data/lib/active_support/vendor/i18n-0.3.3/benchmark/run.rb +71 -0
- data/lib/active_support/vendor/i18n-0.3.3/contributors.txt +17 -0
- data/lib/active_support/vendor/i18n-0.3.3/i18n.gemspec +165 -0
- data/lib/active_support/vendor/i18n-0.3.3/init.rb +1 -0
- data/lib/active_support/vendor/{i18n-0.1.3 → i18n-0.3.3}/lib/i18n.rb +99 -21
- data/lib/active_support/vendor/i18n-0.3.3/lib/i18n/backend.rb +17 -0
- data/lib/active_support/vendor/i18n-0.3.3/lib/i18n/backend/active_record.rb +70 -0
- data/lib/active_support/vendor/i18n-0.3.3/lib/i18n/backend/active_record/missing.rb +67 -0
- data/lib/active_support/vendor/i18n-0.3.3/lib/i18n/backend/active_record/store_procs.rb +38 -0
- data/lib/active_support/vendor/i18n-0.3.3/lib/i18n/backend/active_record/translation.rb +83 -0
- data/lib/active_support/vendor/i18n-0.3.3/lib/i18n/backend/base.rb +259 -0
- data/lib/active_support/vendor/i18n-0.3.3/lib/i18n/backend/cache.rb +75 -0
- data/lib/active_support/vendor/i18n-0.3.3/lib/i18n/backend/cascade.rb +44 -0
- data/lib/active_support/vendor/i18n-0.3.3/lib/i18n/backend/chain.rb +74 -0
- data/lib/active_support/vendor/i18n-0.3.3/lib/i18n/backend/fallbacks.rb +52 -0
- data/lib/active_support/vendor/i18n-0.3.3/lib/i18n/backend/fast.rb +68 -0
- data/lib/active_support/vendor/i18n-0.3.3/lib/i18n/backend/gettext.rb +75 -0
- data/lib/active_support/vendor/i18n-0.3.3/lib/i18n/backend/helpers.rb +80 -0
- data/lib/active_support/vendor/i18n-0.3.3/lib/i18n/backend/interpolation_compiler.rb +119 -0
- data/lib/active_support/vendor/i18n-0.3.3/lib/i18n/backend/metadata.rb +73 -0
- data/lib/active_support/vendor/i18n-0.3.3/lib/i18n/backend/pluralization.rb +57 -0
- data/lib/active_support/vendor/i18n-0.3.3/lib/i18n/backend/simple.rb +22 -0
- data/lib/active_support/vendor/i18n-0.3.3/lib/i18n/core_ext/object/meta_class.rb +5 -0
- data/lib/active_support/vendor/i18n-0.3.3/lib/i18n/core_ext/string/interpolate.rb +99 -0
- data/lib/active_support/vendor/{i18n-0.1.3 → i18n-0.3.3}/lib/i18n/exceptions.rb +14 -6
- data/lib/active_support/vendor/i18n-0.3.3/lib/i18n/gettext.rb +25 -0
- data/lib/active_support/vendor/i18n-0.3.3/lib/i18n/helpers.rb +5 -0
- data/lib/active_support/vendor/i18n-0.3.3/lib/i18n/helpers/gettext.rb +64 -0
- data/lib/active_support/vendor/i18n-0.3.3/lib/i18n/locale.rb +6 -0
- data/lib/active_support/vendor/i18n-0.3.3/lib/i18n/locale/fallbacks.rb +98 -0
- data/lib/active_support/vendor/i18n-0.3.3/lib/i18n/locale/tag.rb +28 -0
- data/lib/active_support/vendor/i18n-0.3.3/lib/i18n/locale/tag/parents.rb +24 -0
- data/lib/active_support/vendor/i18n-0.3.3/lib/i18n/locale/tag/rfc4646.rb +76 -0
- data/lib/active_support/vendor/i18n-0.3.3/lib/i18n/locale/tag/simple.rb +41 -0
- data/lib/active_support/vendor/i18n-0.3.3/lib/i18n/version.rb +3 -0
- data/lib/active_support/vendor/i18n-0.3.3/test/all.rb +8 -0
- data/lib/active_support/vendor/i18n-0.3.3/test/api/basics.rb +15 -0
- data/lib/active_support/vendor/i18n-0.3.3/test/api/defaults.rb +40 -0
- data/lib/active_support/vendor/i18n-0.3.3/test/api/interpolation.rb +92 -0
- data/lib/active_support/vendor/i18n-0.3.3/test/api/link.rb +55 -0
- data/lib/active_support/vendor/i18n-0.3.3/test/api/localization/date.rb +91 -0
- data/lib/active_support/vendor/i18n-0.3.3/test/api/localization/date_time.rb +90 -0
- data/lib/active_support/vendor/i18n-0.3.3/test/api/localization/procs.rb +54 -0
- data/lib/active_support/vendor/i18n-0.3.3/test/api/localization/time.rb +84 -0
- data/lib/active_support/vendor/i18n-0.3.3/test/api/lookup.rb +45 -0
- data/lib/active_support/vendor/i18n-0.3.3/test/api/pluralization.rb +35 -0
- data/lib/active_support/vendor/i18n-0.3.3/test/api/procs.rb +40 -0
- data/lib/active_support/vendor/i18n-0.3.3/test/cases/api/active_record_test.rb +29 -0
- data/lib/active_support/vendor/i18n-0.3.3/test/cases/api/all_features_test.rb +40 -0
- data/lib/active_support/vendor/i18n-0.3.3/test/cases/api/cascade_test.rb +31 -0
- data/lib/active_support/vendor/i18n-0.3.3/test/cases/api/chain_test.rb +26 -0
- data/lib/active_support/vendor/i18n-0.3.3/test/cases/api/fallbacks_test.rb +33 -0
- data/lib/active_support/vendor/i18n-0.3.3/test/cases/api/fast_test.rb +31 -0
- data/lib/active_support/vendor/i18n-0.3.3/test/cases/api/pluralization_test.rb +33 -0
- data/lib/active_support/vendor/i18n-0.3.3/test/cases/api/simple_test.rb +21 -0
- data/lib/active_support/vendor/i18n-0.3.3/test/cases/backend/active_record/missing_test.rb +60 -0
- data/lib/active_support/vendor/i18n-0.3.3/test/cases/backend/active_record_test.rb +52 -0
- data/lib/active_support/vendor/i18n-0.3.3/test/cases/backend/cache_test.rb +72 -0
- data/lib/active_support/vendor/i18n-0.3.3/test/cases/backend/cascade_test.rb +66 -0
- data/lib/active_support/vendor/i18n-0.3.3/test/cases/backend/chain_test.rb +64 -0
- data/lib/active_support/vendor/i18n-0.3.3/test/cases/backend/fallbacks_test.rb +57 -0
- data/lib/active_support/vendor/i18n-0.3.3/test/cases/backend/fast_test.rb +50 -0
- data/lib/active_support/vendor/i18n-0.3.3/test/cases/backend/helpers_test.rb +26 -0
- data/lib/active_support/vendor/i18n-0.3.3/test/cases/backend/interpolation_compiler_test.rb +107 -0
- data/lib/active_support/vendor/i18n-0.3.3/test/cases/backend/metadata_test.rb +67 -0
- data/lib/active_support/vendor/i18n-0.3.3/test/cases/backend/pluralization_test.rb +43 -0
- data/lib/active_support/vendor/i18n-0.3.3/test/cases/backend/simple_test.rb +77 -0
- data/lib/active_support/vendor/i18n-0.3.3/test/cases/core_ext/string/interpolate_test.rb +94 -0
- data/lib/active_support/vendor/i18n-0.3.3/test/cases/gettext/api_test.rb +201 -0
- data/lib/active_support/vendor/i18n-0.3.3/test/cases/gettext/backend_test.rb +91 -0
- data/lib/active_support/vendor/{i18n-0.1.3/test → i18n-0.3.3/test/cases}/i18n_exceptions_test.rb +8 -10
- data/lib/active_support/vendor/i18n-0.3.3/test/cases/i18n_load_path_test.rb +23 -0
- data/lib/active_support/vendor/i18n-0.3.3/test/cases/i18n_test.rb +172 -0
- data/lib/active_support/vendor/i18n-0.3.3/test/cases/locale/fallbacks_test.rb +126 -0
- data/lib/active_support/vendor/i18n-0.3.3/test/cases/locale/tag/rfc4646_test.rb +143 -0
- data/lib/active_support/vendor/i18n-0.3.3/test/cases/locale/tag/simple_test.rb +33 -0
- data/lib/active_support/vendor/i18n-0.3.3/test/fixtures/locales/de.po +72 -0
- data/lib/active_support/vendor/i18n-0.3.3/test/fixtures/locales/en.rb +3 -0
- data/lib/active_support/vendor/i18n-0.3.3/test/fixtures/locales/en.yml +3 -0
- data/lib/active_support/vendor/i18n-0.3.3/test/fixtures/locales/plurals.rb +113 -0
- data/lib/active_support/vendor/i18n-0.3.3/test/test_helper.rb +100 -0
- data/lib/active_support/vendor/i18n-0.3.3/vendor/po_parser.rb +329 -0
- data/lib/active_support/version.rb +1 -1
- data/lib/active_support/whiny_nil.rb +1 -1
- data/lib/active_support/xml_mini/libxml.rb +23 -83
- data/lib/active_support/xml_mini/libxmlsax.rb +74 -0
- data/lib/active_support/xml_mini/nokogiri.rb +25 -22
- data/lib/active_support/xml_mini/nokogirisax.rb +73 -0
- metadata +108 -20
- data/lib/active_support/vendor/i18n-0.1.3/README.textile +0 -20
- data/lib/active_support/vendor/i18n-0.1.3/Rakefile +0 -5
- data/lib/active_support/vendor/i18n-0.1.3/i18n.gemspec +0 -27
- data/lib/active_support/vendor/i18n-0.1.3/lib/i18n/backend/simple.rb +0 -214
- data/lib/active_support/vendor/i18n-0.1.3/test/all.rb +0 -5
- data/lib/active_support/vendor/i18n-0.1.3/test/i18n_test.rb +0 -124
- data/lib/active_support/vendor/i18n-0.1.3/test/locale/en.rb +0 -1
- data/lib/active_support/vendor/i18n-0.1.3/test/locale/en.yml +0 -3
- data/lib/active_support/vendor/i18n-0.1.3/test/simple_backend_test.rb +0 -567
@@ -0,0 +1,33 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
require File.expand_path(File.dirname(__FILE__) + '/../../../test_helper')
|
4
|
+
|
5
|
+
class I18nLocaleTagSimpleTest < Test::Unit::TestCase
|
6
|
+
include I18n::Locale
|
7
|
+
|
8
|
+
test "returns 'de' as the language subtag in lowercase" do
|
9
|
+
assert_equal %w(de Latn DE), Tag::Simple.new('de-Latn-DE').subtags
|
10
|
+
end
|
11
|
+
|
12
|
+
test "returns a formatted tag string from #to_s" do
|
13
|
+
assert_equal 'de-Latn-DE', Tag::Simple.new('de-Latn-DE').to_s
|
14
|
+
end
|
15
|
+
|
16
|
+
test "returns an array containing the formatted subtags from #to_a" do
|
17
|
+
assert_equal %w(de Latn DE), Tag::Simple.new('de-Latn-DE').to_a
|
18
|
+
end
|
19
|
+
|
20
|
+
# Tag inheritance
|
21
|
+
|
22
|
+
test "#parent returns 'de-Latn' as the parent of 'de-Latn-DE'" do
|
23
|
+
assert_equal 'de-Latn', Tag::Simple.new('de-Latn-DE').parent.to_s
|
24
|
+
end
|
25
|
+
|
26
|
+
test "#parent returns 'de' as the parent of 'de-Latn'" do
|
27
|
+
assert_equal 'de', Tag::Simple.new('de-Latn').parent.to_s
|
28
|
+
end
|
29
|
+
|
30
|
+
test "#self_and_parents returns an array of 3 tags for 'de-Latn-DE'" do
|
31
|
+
assert_equal %w(de-Latn-DE de-Latn de), Tag::Simple.new('de-Latn-DE').self_and_parents.map { |tag| tag.to_s}
|
32
|
+
end
|
33
|
+
end
|
@@ -0,0 +1,72 @@
|
|
1
|
+
# SOME DESCRIPTIVE TITLE.
|
2
|
+
# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
|
3
|
+
# This file is distributed under the same license as the PACKAGE package.
|
4
|
+
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
|
5
|
+
#
|
6
|
+
#, fuzzy
|
7
|
+
msgid ""
|
8
|
+
msgstr ""
|
9
|
+
"Project-Id-Version: version 0.0.1\n"
|
10
|
+
"POT-Creation-Date: 2009-02-26 19:50+0100\n"
|
11
|
+
"PO-Revision-Date: 2009-02-18 14:53+0100\n"
|
12
|
+
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
13
|
+
"Language-Team: LANGUAGE <LL@li.org>\n"
|
14
|
+
"MIME-Version: 1.0\n"
|
15
|
+
"Content-Type: text/plain; charset=UTF-8\n"
|
16
|
+
"Content-Transfer-Encoding: 8bit\n"
|
17
|
+
"Plural-Forms: nplurals=INTEGER; plural=EXPRESSION;\n"
|
18
|
+
|
19
|
+
# #: app/helpers/translation_helper.rb:3
|
20
|
+
# msgid "%{relative_time} ago"
|
21
|
+
# msgstr "vor %{relative_time}"
|
22
|
+
|
23
|
+
#: app/views/cars/show.html.erb:5
|
24
|
+
msgid "Axis"
|
25
|
+
msgid_plural "Axis"
|
26
|
+
msgstr[0] "Achse"
|
27
|
+
msgstr[1] "Achsen"
|
28
|
+
|
29
|
+
#: app/controllers/cars_controller.rb:47
|
30
|
+
msgid "Car was successfully created."
|
31
|
+
msgstr "Auto wurde erfolgreich gespeichert"
|
32
|
+
|
33
|
+
#: app/controllers/cars_controller.rb:64
|
34
|
+
msgid "Car was successfully updated."
|
35
|
+
msgstr "Auto wurde erfolgreich aktualisiert"
|
36
|
+
|
37
|
+
#: app/views/cars/show.html.erb:1 locale/model_attributes.rb:3
|
38
|
+
msgid "Car|Model"
|
39
|
+
msgstr "Modell"
|
40
|
+
|
41
|
+
#: app/views/cars/show.html.erb:3 locale/model_attributes.rb:4
|
42
|
+
msgid "Car|Wheels count"
|
43
|
+
msgstr "Räderzahl"
|
44
|
+
|
45
|
+
#: app/views/cars/show.html.erb:7
|
46
|
+
msgid "Created"
|
47
|
+
msgstr "Erstellt"
|
48
|
+
|
49
|
+
#: app/views/cars/show.html.erb:9
|
50
|
+
msgid "Month"
|
51
|
+
msgstr "Monat"
|
52
|
+
|
53
|
+
#: locale/model_attributes.rb:2
|
54
|
+
msgid "car"
|
55
|
+
msgstr "Auto"
|
56
|
+
|
57
|
+
#: locale/testlog_phrases.rb:2
|
58
|
+
msgid "this is a dynamic translation which was found thorugh gettext_test_log!"
|
59
|
+
msgstr ""
|
60
|
+
"Dies ist eine dynamische Übersetzung, die durch gettext_test_log "
|
61
|
+
"gefunden wurde!"
|
62
|
+
|
63
|
+
#: app/views/cars/nowhere_really
|
64
|
+
msgid "Car|wheel"
|
65
|
+
msgid_plural "Car|wheels"
|
66
|
+
msgstr[0] "Rad"
|
67
|
+
msgstr[1] "Räder"
|
68
|
+
|
69
|
+
msgid "On %{count} wheel."
|
70
|
+
msgid_plural "On %{count} wheels."
|
71
|
+
msgstr[0] "Auf %{count} Achse."
|
72
|
+
msgstr[1] "Auf %{count} Achsen."
|
@@ -0,0 +1,113 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
{
|
4
|
+
:af => { :i18n => { :plural => { :keys => [:one, :other], :rule => lambda { |n| n == 1 ? :one : :other } } } },
|
5
|
+
:am => { :i18n => { :plural => { :keys => [:one, :other], :rule => lambda { |n| [0, 1].include?(n) ? :one : :other } } } },
|
6
|
+
:ar => { :i18n => { :plural => { :keys => [:zero, :one, :two, :few, :many, :other], :rule => lambda { |n| n == 0 ? :zero : n == 1 ? :one : n == 2 ? :two : [3, 4, 5, 6, 7, 8, 9, 10].include?(n % 100) ? :few : [11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99].include?(n % 100) ? :many : :other } } } },
|
7
|
+
:az => { :i18n => { :plural => { :keys => [:other], :rule => lambda { |n| :other } } } },
|
8
|
+
:be => { :i18n => { :plural => { :keys => [:one, :few, :many, :other], :rule => lambda { |n| n % 10 == 1 && n % 100 != 11 ? :one : [2, 3, 4].include?(n % 10) && ![12, 13, 14].include?(n % 100) ? :few : n % 10 == 0 || [5, 6, 7, 8, 9].include?(n % 10) || [11, 12, 13, 14].include?(n % 100) ? :many : :other } } } },
|
9
|
+
:bg => { :i18n => { :plural => { :keys => [:one, :other], :rule => lambda { |n| n == 1 ? :one : :other } } } },
|
10
|
+
:bh => { :i18n => { :plural => { :keys => [:one, :other], :rule => lambda { |n| [0, 1].include?(n) ? :one : :other } } } },
|
11
|
+
:bn => { :i18n => { :plural => { :keys => [:one, :other], :rule => lambda { |n| n == 1 ? :one : :other } } } },
|
12
|
+
:bo => { :i18n => { :plural => { :keys => [:other], :rule => lambda { |n| :other } } } },
|
13
|
+
:bs => { :i18n => { :plural => { :keys => [:one, :few, :many, :other], :rule => lambda { |n| n % 10 == 1 && n % 100 != 11 ? :one : [2, 3, 4].include?(n % 10) && ![12, 13, 14].include?(n % 100) ? :few : n % 10 == 0 || [5, 6, 7, 8, 9].include?(n % 10) || [11, 12, 13, 14].include?(n % 100) ? :many : :other } } } },
|
14
|
+
:ca => { :i18n => { :plural => { :keys => [:one, :other], :rule => lambda { |n| n == 1 ? :one : :other } } } },
|
15
|
+
:cs => { :i18n => { :plural => { :keys => [:one, :few, :other], :rule => lambda { |n| n == 1 ? :one : [2, 3, 4].include?(n) ? :few : :other } } } },
|
16
|
+
:cy => { :i18n => { :plural => { :keys => [:one, :two, :many, :other], :rule => lambda { |n| n == 1 ? :one : n == 2 ? :two : n == 8 || n == 11 ? :many : :other } } } },
|
17
|
+
:da => { :i18n => { :plural => { :keys => [:one, :other], :rule => lambda { |n| n == 1 ? :one : :other } } } },
|
18
|
+
:de => { :i18n => { :plural => { :keys => [:one, :other], :rule => lambda { |n| n == 1 ? :one : :other } } } },
|
19
|
+
:dz => { :i18n => { :plural => { :keys => [:other], :rule => lambda { |n| :other } } } },
|
20
|
+
:el => { :i18n => { :plural => { :keys => [:one, :other], :rule => lambda { |n| n == 1 ? :one : :other } } } },
|
21
|
+
:en => { :i18n => { :plural => { :keys => [:one, :other], :rule => lambda { |n| n == 1 ? :one : :other } } } },
|
22
|
+
:eo => { :i18n => { :plural => { :keys => [:one, :other], :rule => lambda { |n| n == 1 ? :one : :other } } } },
|
23
|
+
:es => { :i18n => { :plural => { :keys => [:one, :other], :rule => lambda { |n| n == 1 ? :one : :other } } } },
|
24
|
+
:et => { :i18n => { :plural => { :keys => [:one, :other], :rule => lambda { |n| n == 1 ? :one : :other } } } },
|
25
|
+
:eu => { :i18n => { :plural => { :keys => [:one, :other], :rule => lambda { |n| n == 1 ? :one : :other } } } },
|
26
|
+
:fa => { :i18n => { :plural => { :keys => [:other], :rule => lambda { |n| :other } } } },
|
27
|
+
:fi => { :i18n => { :plural => { :keys => [:one, :other], :rule => lambda { |n| n == 1 ? :one : :other } } } },
|
28
|
+
:fil => { :i18n => { :plural => { :keys => [:one, :other], :rule => lambda { |n| [0, 1].include?(n) ? :one : :other } } } },
|
29
|
+
:fo => { :i18n => { :plural => { :keys => [:one, :other], :rule => lambda { |n| n == 1 ? :one : :other } } } },
|
30
|
+
:fr => { :i18n => { :plural => { :keys => [:one, :other], :rule => lambda { |n| n && n != 2 ? :one : :other } } } },
|
31
|
+
:fur => { :i18n => { :plural => { :keys => [:one, :other], :rule => lambda { |n| n == 1 ? :one : :other } } } },
|
32
|
+
:fy => { :i18n => { :plural => { :keys => [:one, :other], :rule => lambda { |n| n == 1 ? :one : :other } } } },
|
33
|
+
:ga => { :i18n => { :plural => { :keys => [:one, :two, :other], :rule => lambda { |n| n == 1 ? :one : n == 2 ? :two : :other } } } },
|
34
|
+
:gl => { :i18n => { :plural => { :keys => [:one, :other], :rule => lambda { |n| n == 1 ? :one : :other } } } },
|
35
|
+
:gu => { :i18n => { :plural => { :keys => [:one, :other], :rule => lambda { |n| n == 1 ? :one : :other } } } },
|
36
|
+
:guw => { :i18n => { :plural => { :keys => [:one, :other], :rule => lambda { |n| [0, 1].include?(n) ? :one : :other } } } },
|
37
|
+
:ha => { :i18n => { :plural => { :keys => [:one, :other], :rule => lambda { |n| n == 1 ? :one : :other } } } },
|
38
|
+
:he => { :i18n => { :plural => { :keys => [:one, :other], :rule => lambda { |n| n == 1 ? :one : :other } } } },
|
39
|
+
:hi => { :i18n => { :plural => { :keys => [:one, :other], :rule => lambda { |n| [0, 1].include?(n) ? :one : :other } } } },
|
40
|
+
:hr => { :i18n => { :plural => { :keys => [:one, :few, :many, :other], :rule => lambda { |n| n % 10 == 1 && n % 100 != 11 ? :one : [2, 3, 4].include?(n % 10) && ![12, 13, 14].include?(n % 100) ? :few : n % 10 == 0 || [5, 6, 7, 8, 9].include?(n % 10) || [11, 12, 13, 14].include?(n % 100) ? :many : :other } } } },
|
41
|
+
:hu => { :i18n => { :plural => { :keys => [:other], :rule => lambda { |n| :other } } } },
|
42
|
+
:id => { :i18n => { :plural => { :keys => [:other], :rule => lambda { |n| :other } } } },
|
43
|
+
:is => { :i18n => { :plural => { :keys => [:one, :other], :rule => lambda { |n| n == 1 ? :one : :other } } } },
|
44
|
+
:it => { :i18n => { :plural => { :keys => [:one, :other], :rule => lambda { |n| n == 1 ? :one : :other } } } },
|
45
|
+
:iw => { :i18n => { :plural => { :keys => [:one, :other], :rule => lambda { |n| n == 1 ? :one : :other } } } },
|
46
|
+
:ja => { :i18n => { :plural => { :keys => [:other], :rule => lambda { |n| :other } } } },
|
47
|
+
:jv => { :i18n => { :plural => { :keys => [:other], :rule => lambda { |n| :other } } } },
|
48
|
+
:ka => { :i18n => { :plural => { :keys => [:other], :rule => lambda { |n| :other } } } },
|
49
|
+
:km => { :i18n => { :plural => { :keys => [:other], :rule => lambda { |n| :other } } } },
|
50
|
+
:kn => { :i18n => { :plural => { :keys => [:other], :rule => lambda { |n| :other } } } },
|
51
|
+
:ko => { :i18n => { :plural => { :keys => [:other], :rule => lambda { |n| :other } } } },
|
52
|
+
:ku => { :i18n => { :plural => { :keys => [:one, :other], :rule => lambda { |n| n == 1 ? :one : :other } } } },
|
53
|
+
:lb => { :i18n => { :plural => { :keys => [:one, :other], :rule => lambda { |n| n == 1 ? :one : :other } } } },
|
54
|
+
:ln => { :i18n => { :plural => { :keys => [:one, :other], :rule => lambda { |n| [0, 1].include?(n) ? :one : :other } } } },
|
55
|
+
:lt => { :i18n => { :plural => { :keys => [:one, :few, :other], :rule => lambda { |n| n % 10 == 1 && ![11, 12, 13, 14, 15, 16, 17, 18, 19].include?(n % 100) ? :one : [2, 3, 4, 5, 6, 7, 8, 9].include?(n % 10) && ![11, 12, 13, 14, 15, 16, 17, 18, 19].include?(n % 100) ? :few : :other } } } },
|
56
|
+
:lv => { :i18n => { :plural => { :keys => [:zero, :one, :other], :rule => lambda { |n| n == 0 ? :zero : n % 10 == 1 && n % 100 != 11 ? :one : :other } } } },
|
57
|
+
:mg => { :i18n => { :plural => { :keys => [:one, :other], :rule => lambda { |n| [0, 1].include?(n) ? :one : :other } } } },
|
58
|
+
:mk => { :i18n => { :plural => { :keys => [:one, :other], :rule => lambda { |n| n % 10 == 1 ? :one : :other } } } },
|
59
|
+
:ml => { :i18n => { :plural => { :keys => [:one, :other], :rule => lambda { |n| n == 1 ? :one : :other } } } },
|
60
|
+
:mn => { :i18n => { :plural => { :keys => [:one, :other], :rule => lambda { |n| n == 1 ? :one : :other } } } },
|
61
|
+
:mo => { :i18n => { :plural => { :keys => [:one, :few, :other], :rule => lambda { |n| n == 1 ? :one : n == 0 ? :few : :other } } } },
|
62
|
+
:mr => { :i18n => { :plural => { :keys => [:one, :other], :rule => lambda { |n| n == 1 ? :one : :other } } } },
|
63
|
+
:ms => { :i18n => { :plural => { :keys => [:other], :rule => lambda { |n| :other } } } },
|
64
|
+
:mt => { :i18n => { :plural => { :keys => [:one, :few, :many, :other], :rule => lambda { |n| n == 1 ? :one : n == 0 || [2, 3, 4, 5, 6, 7, 8, 9, 10].include?(n % 100) ? :few : [11, 12, 13, 14, 15, 16, 17, 18, 19].include?(n % 100) ? :many : :other } } } },
|
65
|
+
:my => { :i18n => { :plural => { :keys => [:other], :rule => lambda { |n| :other } } } },
|
66
|
+
:nah => { :i18n => { :plural => { :keys => [:one, :other], :rule => lambda { |n| n == 1 ? :one : :other } } } },
|
67
|
+
:nb => { :i18n => { :plural => { :keys => [:one, :other], :rule => lambda { |n| n == 1 ? :one : :other } } } },
|
68
|
+
:ne => { :i18n => { :plural => { :keys => [:one, :other], :rule => lambda { |n| n == 1 ? :one : :other } } } },
|
69
|
+
:nl => { :i18n => { :plural => { :keys => [:one, :other], :rule => lambda { |n| n == 1 ? :one : :other } } } },
|
70
|
+
:nn => { :i18n => { :plural => { :keys => [:one, :other], :rule => lambda { |n| n == 1 ? :one : :other } } } },
|
71
|
+
:no => { :i18n => { :plural => { :keys => [:one, :other], :rule => lambda { |n| n == 1 ? :one : :other } } } },
|
72
|
+
:nso => { :i18n => { :plural => { :keys => [:one, :other], :rule => lambda { |n| [0, 1].include?(n) ? :one : :other } } } },
|
73
|
+
:om => { :i18n => { :plural => { :keys => [:one, :other], :rule => lambda { |n| n == 1 ? :one : :other } } } },
|
74
|
+
:or => { :i18n => { :plural => { :keys => [:one, :other], :rule => lambda { |n| n == 1 ? :one : :other } } } },
|
75
|
+
:pa => { :i18n => { :plural => { :keys => [:one, :other], :rule => lambda { |n| n == 1 ? :one : :other } } } },
|
76
|
+
:pap => { :i18n => { :plural => { :keys => [:one, :other], :rule => lambda { |n| n == 1 ? :one : :other } } } },
|
77
|
+
:pl => { :i18n => { :plural => { :keys => [:one, :few, :other], :rule => lambda { |n| n == 1 ? :one : [2, 3, 4].include?(n % 10) && ![12, 13, 14].include?(n % 100) && ![22, 23, 24].include?(n % 100) ? :few : :other } } } },
|
78
|
+
:ps => { :i18n => { :plural => { :keys => [:one, :other], :rule => lambda { |n| n == 1 ? :one : :other } } } },
|
79
|
+
:pt => { :i18n => { :plural => { :keys => [:one, :other], :rule => lambda { |n| [0, 1].include?(n) ? :one : :other } } } },
|
80
|
+
:"pt-PT" => { :i18n => { :plural => { :keys => [:one, :other], :rule => lambda { |n| n == 1 ? :one : :other } } } },
|
81
|
+
:ro => { :i18n => { :plural => { :keys => [:one, :few, :other], :rule => lambda { |n| n == 1 ? :one : n == 0 ? :few : :other } } } },
|
82
|
+
:ru => { :i18n => { :plural => { :keys => [:one, :few, :many, :other], :rule => lambda { |n| n % 10 == 1 && n % 100 != 11 ? :one : [2, 3, 4].include?(n % 10) && ![12, 13, 14].include?(n % 100) ? :few : n % 10 == 0 || [5, 6, 7, 8, 9].include?(n % 10) || [11, 12, 13, 14].include?(n % 100) ? :many : :other } } } },
|
83
|
+
:se => { :i18n => { :plural => { :keys => [:one, :two, :other], :rule => lambda { |n| n == 1 ? :one : n == 2 ? :two : :other } } } },
|
84
|
+
:sh => { :i18n => { :plural => { :keys => [:one, :few, :many, :other], :rule => lambda { |n| n % 10 == 1 && n % 100 != 11 ? :one : [2, 3, 4].include?(n % 10) && ![12, 13, 14].include?(n % 100) ? :few : n % 10 == 0 || [5, 6, 7, 8, 9].include?(n % 10) || [11, 12, 13, 14].include?(n % 100) ? :many : :other } } } },
|
85
|
+
:sk => { :i18n => { :plural => { :keys => [:one, :few, :other], :rule => lambda { |n| n == 1 ? :one : [2, 3, 4].include?(n) ? :few : :other } } } },
|
86
|
+
:sl => { :i18n => { :plural => { :keys => [:one, :two, :few, :other], :rule => lambda { |n| n % 100 == 1 ? :one : n % 100 == 2 ? :two : [3, 4].include?(n % 100) ? :few : :other } } } },
|
87
|
+
:sma => { :i18n => { :plural => { :keys => [:one, :two, :other], :rule => lambda { |n| n == 1 ? :one : n == 2 ? :two : :other } } } },
|
88
|
+
:smi => { :i18n => { :plural => { :keys => [:one, :two, :other], :rule => lambda { |n| n == 1 ? :one : n == 2 ? :two : :other } } } },
|
89
|
+
:smj => { :i18n => { :plural => { :keys => [:one, :two, :other], :rule => lambda { |n| n == 1 ? :one : n == 2 ? :two : :other } } } },
|
90
|
+
:smn => { :i18n => { :plural => { :keys => [:one, :two, :other], :rule => lambda { |n| n == 1 ? :one : n == 2 ? :two : :other } } } },
|
91
|
+
:sms => { :i18n => { :plural => { :keys => [:one, :two, :other], :rule => lambda { |n| n == 1 ? :one : n == 2 ? :two : :other } } } },
|
92
|
+
:so => { :i18n => { :plural => { :keys => [:one, :other], :rule => lambda { |n| n == 1 ? :one : :other } } } },
|
93
|
+
:sq => { :i18n => { :plural => { :keys => [:one, :other], :rule => lambda { |n| n == 1 ? :one : :other } } } },
|
94
|
+
:sr => { :i18n => { :plural => { :keys => [:one, :few, :many, :other], :rule => lambda { |n| n % 10 == 1 && n % 100 != 11 ? :one : [2, 3, 4].include?(n % 10) && ![12, 13, 14].include?(n % 100) ? :few : n % 10 == 0 || [5, 6, 7, 8, 9].include?(n % 10) || [11, 12, 13, 14].include?(n % 100) ? :many : :other } } } },
|
95
|
+
:sv => { :i18n => { :plural => { :keys => [:one, :other], :rule => lambda { |n| n == 1 ? :one : :other } } } },
|
96
|
+
:sw => { :i18n => { :plural => { :keys => [:one, :other], :rule => lambda { |n| n == 1 ? :one : :other } } } },
|
97
|
+
:ta => { :i18n => { :plural => { :keys => [:one, :other], :rule => lambda { |n| n == 1 ? :one : :other } } } },
|
98
|
+
:te => { :i18n => { :plural => { :keys => [:one, :other], :rule => lambda { |n| n == 1 ? :one : :other } } } },
|
99
|
+
:th => { :i18n => { :plural => { :keys => [:other], :rule => lambda { |n| :other } } } },
|
100
|
+
:ti => { :i18n => { :plural => { :keys => [:one, :other], :rule => lambda { |n| [0, 1].include?(n) ? :one : :other } } } },
|
101
|
+
:tk => { :i18n => { :plural => { :keys => [:one, :other], :rule => lambda { |n| n == 1 ? :one : :other } } } },
|
102
|
+
:tl => { :i18n => { :plural => { :keys => [:one, :other], :rule => lambda { |n| [0, 1].include?(n) ? :one : :other } } } },
|
103
|
+
:to => { :i18n => { :plural => { :keys => [:other], :rule => lambda { |n| :other } } } },
|
104
|
+
:tr => { :i18n => { :plural => { :keys => [:other], :rule => lambda { |n| :other } } } },
|
105
|
+
:uk => { :i18n => { :plural => { :keys => [:one, :few, :many, :other], :rule => lambda { |n| n % 10 == 1 && n % 100 != 11 ? :one : [2, 3, 4].include?(n % 10) && ![12, 13, 14].include?(n % 100) ? :few : n % 10 == 0 || [5, 6, 7, 8, 9].include?(n % 10) || [11, 12, 13, 14].include?(n % 100) ? :many : :other } } } },
|
106
|
+
:ur => { :i18n => { :plural => { :keys => [:one, :other], :rule => lambda { |n| n == 1 ? :one : :other } } } },
|
107
|
+
:vi => { :i18n => { :plural => { :keys => [:other], :rule => lambda { |n| :other } } } },
|
108
|
+
:wa => { :i18n => { :plural => { :keys => [:one, :other], :rule => lambda { |n| [0, 1].include?(n) ? :one : :other } } } },
|
109
|
+
:yo => { :i18n => { :plural => { :keys => [:other], :rule => lambda { |n| :other } } } },
|
110
|
+
:zh => { :i18n => { :plural => { :keys => [:other], :rule => lambda { |n| :other } } } },
|
111
|
+
:zu => { :i18n => { :plural => { :keys => [:one, :other], :rule => lambda { |n| n == 1 ? :one : :other } } } }
|
112
|
+
}
|
113
|
+
|
@@ -0,0 +1,100 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
$:.unshift File.expand_path("../lib", File.dirname(__FILE__))
|
4
|
+
$:.unshift File.expand_path(File.dirname(__FILE__))
|
5
|
+
|
6
|
+
require 'i18n'
|
7
|
+
require 'i18n/core_ext/object/meta_class'
|
8
|
+
|
9
|
+
require 'rubygems'
|
10
|
+
require 'test/unit'
|
11
|
+
require 'time'
|
12
|
+
require 'yaml'
|
13
|
+
|
14
|
+
begin
|
15
|
+
require 'mocha'
|
16
|
+
rescue LoadError
|
17
|
+
puts "skipping tests using mocha as mocha can't be found"
|
18
|
+
end
|
19
|
+
|
20
|
+
|
21
|
+
Dir[File.dirname(__FILE__) + '/api/**/*.rb'].each do |filename|
|
22
|
+
require filename
|
23
|
+
end
|
24
|
+
|
25
|
+
$KCODE = 'u' unless RUBY_VERSION >= '1.9'
|
26
|
+
|
27
|
+
# wtf is wrong with this, why's there Kernel#test?
|
28
|
+
# class Module
|
29
|
+
# def self.test(name, &block)
|
30
|
+
# define_method("test: " + name, &block)
|
31
|
+
# end
|
32
|
+
# end
|
33
|
+
|
34
|
+
class Test::Unit::TestCase
|
35
|
+
def self.test(name, &block)
|
36
|
+
define_method("test: " + name, &block)
|
37
|
+
end
|
38
|
+
|
39
|
+
def self.with_mocha
|
40
|
+
yield if Object.respond_to?(:expects)
|
41
|
+
end
|
42
|
+
|
43
|
+
def teardown
|
44
|
+
I18n.locale = nil
|
45
|
+
I18n.default_locale = :en
|
46
|
+
I18n.load_path = []
|
47
|
+
I18n.available_locales = nil
|
48
|
+
I18n.backend = nil
|
49
|
+
end
|
50
|
+
|
51
|
+
def translations
|
52
|
+
I18n.backend.instance_variable_get(:@translations)
|
53
|
+
end
|
54
|
+
|
55
|
+
def store_translations(*args)
|
56
|
+
data = args.pop
|
57
|
+
locale = args.pop || :en
|
58
|
+
I18n.backend.store_translations(locale, data)
|
59
|
+
end
|
60
|
+
|
61
|
+
def locales_dir
|
62
|
+
File.dirname(__FILE__) + '/fixtures/locales'
|
63
|
+
end
|
64
|
+
|
65
|
+
def euc_jp(string)
|
66
|
+
string.encode!(Encoding::EUC_JP)
|
67
|
+
end
|
68
|
+
|
69
|
+
def can_store_procs?
|
70
|
+
I18n::Backend::ActiveRecord === I18n.backend and
|
71
|
+
I18n::Backend::ActiveRecord.included_modules.include?(I18n::Backend::ActiveRecord::StoreProcs)
|
72
|
+
end
|
73
|
+
end
|
74
|
+
|
75
|
+
def setup_active_record
|
76
|
+
begin
|
77
|
+
require 'activerecord'
|
78
|
+
require 'i18n/backend/active_record'
|
79
|
+
require 'i18n/backend/active_record/store_procs'
|
80
|
+
|
81
|
+
if I18n::Backend::Simple.method_defined?(:interpolate_with_deprecated_syntax)
|
82
|
+
I18n::Backend::Simple.send(:remove_method, :interpolate) rescue NameError
|
83
|
+
end
|
84
|
+
|
85
|
+
ActiveRecord::Base.establish_connection(:adapter => "sqlite3", :database => ":memory:")
|
86
|
+
ActiveRecord::Migration.verbose = false
|
87
|
+
ActiveRecord::Schema.define(:version => 1) do
|
88
|
+
create_table :translations do |t|
|
89
|
+
t.string :locale
|
90
|
+
t.string :key
|
91
|
+
t.string :value
|
92
|
+
t.string :interpolations
|
93
|
+
t.boolean :is_proc, :default => false
|
94
|
+
end
|
95
|
+
end
|
96
|
+
|
97
|
+
rescue LoadError
|
98
|
+
puts "skipping tests using activerecord as activerecord can't be found"
|
99
|
+
end
|
100
|
+
end
|
@@ -0,0 +1,329 @@
|
|
1
|
+
=begin
|
2
|
+
poparser.rb - Generate a .mo
|
3
|
+
|
4
|
+
Copyright (C) 2003-2009 Masao Mutoh <mutoh at highway.ne.jp>
|
5
|
+
|
6
|
+
You may redistribute it and/or modify it under the same
|
7
|
+
license terms as Ruby.
|
8
|
+
=end
|
9
|
+
|
10
|
+
#MODIFIED
|
11
|
+
# removed include GetText etc
|
12
|
+
# added stub translation method _(x)
|
13
|
+
require 'racc/parser'
|
14
|
+
|
15
|
+
module GetText
|
16
|
+
|
17
|
+
class PoParser < Racc::Parser
|
18
|
+
|
19
|
+
def _(x)
|
20
|
+
x
|
21
|
+
end
|
22
|
+
|
23
|
+
module_eval <<'..end src/poparser.ry modeval..id7a99570e05', 'src/poparser.ry', 108
|
24
|
+
def unescape(orig)
|
25
|
+
ret = orig.gsub(/\\n/, "\n")
|
26
|
+
ret.gsub!(/\\t/, "\t")
|
27
|
+
ret.gsub!(/\\r/, "\r")
|
28
|
+
ret.gsub!(/\\"/, "\"")
|
29
|
+
ret
|
30
|
+
end
|
31
|
+
|
32
|
+
def parse(str, data, ignore_fuzzy = true)
|
33
|
+
@comments = []
|
34
|
+
@data = data
|
35
|
+
@fuzzy = false
|
36
|
+
@msgctxt = ""
|
37
|
+
$ignore_fuzzy = ignore_fuzzy
|
38
|
+
|
39
|
+
str.strip!
|
40
|
+
@q = []
|
41
|
+
until str.empty? do
|
42
|
+
case str
|
43
|
+
when /\A\s+/
|
44
|
+
str = $'
|
45
|
+
when /\Amsgctxt/
|
46
|
+
@q.push [:MSGCTXT, $&]
|
47
|
+
str = $'
|
48
|
+
when /\Amsgid_plural/
|
49
|
+
@q.push [:MSGID_PLURAL, $&]
|
50
|
+
str = $'
|
51
|
+
when /\Amsgid/
|
52
|
+
@q.push [:MSGID, $&]
|
53
|
+
str = $'
|
54
|
+
when /\Amsgstr/
|
55
|
+
@q.push [:MSGSTR, $&]
|
56
|
+
str = $'
|
57
|
+
when /\A\[(\d+)\]/
|
58
|
+
@q.push [:PLURAL_NUM, $1]
|
59
|
+
str = $'
|
60
|
+
when /\A\#~(.*)/
|
61
|
+
$stderr.print _("Warning: obsolete msgid exists.\n")
|
62
|
+
$stderr.print " #{$&}\n"
|
63
|
+
@q.push [:COMMENT, $&]
|
64
|
+
str = $'
|
65
|
+
when /\A\#(.*)/
|
66
|
+
@q.push [:COMMENT, $&]
|
67
|
+
str = $'
|
68
|
+
when /\A\"(.*)\"/
|
69
|
+
@q.push [:STRING, $1]
|
70
|
+
str = $'
|
71
|
+
else
|
72
|
+
#c = str[0,1]
|
73
|
+
#@q.push [:STRING, c]
|
74
|
+
str = str[1..-1]
|
75
|
+
end
|
76
|
+
end
|
77
|
+
@q.push [false, '$end']
|
78
|
+
if $DEBUG
|
79
|
+
@q.each do |a,b|
|
80
|
+
puts "[#{a}, #{b}]"
|
81
|
+
end
|
82
|
+
end
|
83
|
+
@yydebug = true if $DEBUG
|
84
|
+
do_parse
|
85
|
+
|
86
|
+
if @comments.size > 0
|
87
|
+
@data.set_comment(:last, @comments.join("\n"))
|
88
|
+
end
|
89
|
+
@data
|
90
|
+
end
|
91
|
+
|
92
|
+
def next_token
|
93
|
+
@q.shift
|
94
|
+
end
|
95
|
+
|
96
|
+
def on_message(msgid, msgstr)
|
97
|
+
if msgstr.size > 0
|
98
|
+
@data[msgid] = msgstr
|
99
|
+
@data.set_comment(msgid, @comments.join("\n"))
|
100
|
+
end
|
101
|
+
@comments.clear
|
102
|
+
@msgctxt = ""
|
103
|
+
end
|
104
|
+
|
105
|
+
def on_comment(comment)
|
106
|
+
@fuzzy = true if (/fuzzy/ =~ comment)
|
107
|
+
@comments << comment
|
108
|
+
end
|
109
|
+
|
110
|
+
|
111
|
+
..end src/poparser.ry modeval..id7a99570e05
|
112
|
+
|
113
|
+
##### racc 1.4.5 generates ###
|
114
|
+
|
115
|
+
racc_reduce_table = [
|
116
|
+
0, 0, :racc_error,
|
117
|
+
0, 10, :_reduce_none,
|
118
|
+
2, 10, :_reduce_none,
|
119
|
+
2, 10, :_reduce_none,
|
120
|
+
2, 10, :_reduce_none,
|
121
|
+
2, 12, :_reduce_5,
|
122
|
+
1, 13, :_reduce_none,
|
123
|
+
1, 13, :_reduce_none,
|
124
|
+
4, 15, :_reduce_8,
|
125
|
+
5, 16, :_reduce_9,
|
126
|
+
2, 17, :_reduce_10,
|
127
|
+
1, 17, :_reduce_none,
|
128
|
+
3, 18, :_reduce_12,
|
129
|
+
1, 11, :_reduce_13,
|
130
|
+
2, 14, :_reduce_14,
|
131
|
+
1, 14, :_reduce_15 ]
|
132
|
+
|
133
|
+
racc_reduce_n = 16
|
134
|
+
|
135
|
+
racc_shift_n = 26
|
136
|
+
|
137
|
+
racc_action_table = [
|
138
|
+
3, 13, 5, 7, 9, 15, 16, 17, 20, 17,
|
139
|
+
13, 17, 13, 13, 11, 17, 23, 20, 13, 17 ]
|
140
|
+
|
141
|
+
racc_action_check = [
|
142
|
+
1, 16, 1, 1, 1, 12, 12, 12, 18, 18,
|
143
|
+
7, 14, 15, 9, 3, 19, 20, 21, 23, 25 ]
|
144
|
+
|
145
|
+
racc_action_pointer = [
|
146
|
+
nil, 0, nil, 14, nil, nil, nil, 3, nil, 6,
|
147
|
+
nil, nil, 0, nil, 4, 5, -6, nil, 2, 8,
|
148
|
+
8, 11, nil, 11, nil, 12 ]
|
149
|
+
|
150
|
+
racc_action_default = [
|
151
|
+
-1, -16, -2, -16, -3, -13, -4, -16, -6, -16,
|
152
|
+
-7, 26, -16, -15, -5, -16, -16, -14, -16, -8,
|
153
|
+
-16, -9, -11, -16, -10, -12 ]
|
154
|
+
|
155
|
+
racc_goto_table = [
|
156
|
+
12, 22, 14, 4, 24, 6, 2, 8, 18, 19,
|
157
|
+
10, 21, 1, nil, nil, nil, 25 ]
|
158
|
+
|
159
|
+
racc_goto_check = [
|
160
|
+
5, 9, 5, 3, 9, 4, 2, 6, 5, 5,
|
161
|
+
7, 8, 1, nil, nil, nil, 5 ]
|
162
|
+
|
163
|
+
racc_goto_pointer = [
|
164
|
+
nil, 12, 5, 2, 4, -7, 6, 9, -7, -17 ]
|
165
|
+
|
166
|
+
racc_goto_default = [
|
167
|
+
nil, nil, nil, nil, nil, nil, nil, nil, nil, nil ]
|
168
|
+
|
169
|
+
racc_token_table = {
|
170
|
+
false => 0,
|
171
|
+
Object.new => 1,
|
172
|
+
:COMMENT => 2,
|
173
|
+
:MSGID => 3,
|
174
|
+
:MSGCTXT => 4,
|
175
|
+
:MSGID_PLURAL => 5,
|
176
|
+
:MSGSTR => 6,
|
177
|
+
:STRING => 7,
|
178
|
+
:PLURAL_NUM => 8 }
|
179
|
+
|
180
|
+
racc_use_result_var = true
|
181
|
+
|
182
|
+
racc_nt_base = 9
|
183
|
+
|
184
|
+
Racc_arg = [
|
185
|
+
racc_action_table,
|
186
|
+
racc_action_check,
|
187
|
+
racc_action_default,
|
188
|
+
racc_action_pointer,
|
189
|
+
racc_goto_table,
|
190
|
+
racc_goto_check,
|
191
|
+
racc_goto_default,
|
192
|
+
racc_goto_pointer,
|
193
|
+
racc_nt_base,
|
194
|
+
racc_reduce_table,
|
195
|
+
racc_token_table,
|
196
|
+
racc_shift_n,
|
197
|
+
racc_reduce_n,
|
198
|
+
racc_use_result_var ]
|
199
|
+
|
200
|
+
Racc_token_to_s_table = [
|
201
|
+
'$end',
|
202
|
+
'error',
|
203
|
+
'COMMENT',
|
204
|
+
'MSGID',
|
205
|
+
'MSGCTXT',
|
206
|
+
'MSGID_PLURAL',
|
207
|
+
'MSGSTR',
|
208
|
+
'STRING',
|
209
|
+
'PLURAL_NUM',
|
210
|
+
'$start',
|
211
|
+
'msgfmt',
|
212
|
+
'comment',
|
213
|
+
'msgctxt',
|
214
|
+
'message',
|
215
|
+
'string_list',
|
216
|
+
'single_message',
|
217
|
+
'plural_message',
|
218
|
+
'msgstr_plural',
|
219
|
+
'msgstr_plural_line']
|
220
|
+
|
221
|
+
Racc_debug_parser = true
|
222
|
+
|
223
|
+
##### racc system variables end #####
|
224
|
+
|
225
|
+
# reduce 0 omitted
|
226
|
+
|
227
|
+
# reduce 1 omitted
|
228
|
+
|
229
|
+
# reduce 2 omitted
|
230
|
+
|
231
|
+
# reduce 3 omitted
|
232
|
+
|
233
|
+
# reduce 4 omitted
|
234
|
+
|
235
|
+
module_eval <<'.,.,', 'src/poparser.ry', 25
|
236
|
+
def _reduce_5( val, _values, result )
|
237
|
+
@msgctxt = unescape(val[1]) + "\004"
|
238
|
+
result
|
239
|
+
end
|
240
|
+
.,.,
|
241
|
+
|
242
|
+
# reduce 6 omitted
|
243
|
+
|
244
|
+
# reduce 7 omitted
|
245
|
+
|
246
|
+
module_eval <<'.,.,', 'src/poparser.ry', 48
|
247
|
+
def _reduce_8( val, _values, result )
|
248
|
+
if @fuzzy and $ignore_fuzzy
|
249
|
+
if val[1] != ""
|
250
|
+
$stderr.print _("Warning: fuzzy message was ignored.\n")
|
251
|
+
$stderr.print " msgid '#{val[1]}'\n"
|
252
|
+
else
|
253
|
+
on_message('', unescape(val[3]))
|
254
|
+
end
|
255
|
+
@fuzzy = false
|
256
|
+
else
|
257
|
+
on_message(@msgctxt + unescape(val[1]), unescape(val[3]))
|
258
|
+
end
|
259
|
+
result = ""
|
260
|
+
result
|
261
|
+
end
|
262
|
+
.,.,
|
263
|
+
|
264
|
+
module_eval <<'.,.,', 'src/poparser.ry', 65
|
265
|
+
def _reduce_9( val, _values, result )
|
266
|
+
if @fuzzy and $ignore_fuzzy
|
267
|
+
if val[1] != ""
|
268
|
+
$stderr.print _("Warning: fuzzy message was ignored.\n")
|
269
|
+
$stderr.print "msgid = '#{val[1]}\n"
|
270
|
+
else
|
271
|
+
on_message('', unescape(val[3]))
|
272
|
+
end
|
273
|
+
@fuzzy = false
|
274
|
+
else
|
275
|
+
on_message(@msgctxt + unescape(val[1]) + "\000" + unescape(val[3]), unescape(val[4]))
|
276
|
+
end
|
277
|
+
result = ""
|
278
|
+
result
|
279
|
+
end
|
280
|
+
.,.,
|
281
|
+
|
282
|
+
module_eval <<'.,.,', 'src/poparser.ry', 76
|
283
|
+
def _reduce_10( val, _values, result )
|
284
|
+
if val[0].size > 0
|
285
|
+
result = val[0] + "\000" + val[1]
|
286
|
+
else
|
287
|
+
result = ""
|
288
|
+
end
|
289
|
+
result
|
290
|
+
end
|
291
|
+
.,.,
|
292
|
+
|
293
|
+
# reduce 11 omitted
|
294
|
+
|
295
|
+
module_eval <<'.,.,', 'src/poparser.ry', 84
|
296
|
+
def _reduce_12( val, _values, result )
|
297
|
+
result = val[2]
|
298
|
+
result
|
299
|
+
end
|
300
|
+
.,.,
|
301
|
+
|
302
|
+
module_eval <<'.,.,', 'src/poparser.ry', 91
|
303
|
+
def _reduce_13( val, _values, result )
|
304
|
+
on_comment(val[0])
|
305
|
+
result
|
306
|
+
end
|
307
|
+
.,.,
|
308
|
+
|
309
|
+
module_eval <<'.,.,', 'src/poparser.ry', 99
|
310
|
+
def _reduce_14( val, _values, result )
|
311
|
+
result = val.delete_if{|item| item == ""}.join
|
312
|
+
result
|
313
|
+
end
|
314
|
+
.,.,
|
315
|
+
|
316
|
+
module_eval <<'.,.,', 'src/poparser.ry', 103
|
317
|
+
def _reduce_15( val, _values, result )
|
318
|
+
result = val[0]
|
319
|
+
result
|
320
|
+
end
|
321
|
+
.,.,
|
322
|
+
|
323
|
+
def _reduce_none( val, _values, result )
|
324
|
+
result
|
325
|
+
end
|
326
|
+
|
327
|
+
end # class PoParser
|
328
|
+
|
329
|
+
end # module GetText
|