i18n 0.9.5 → 1.6.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +54 -13
- data/lib/i18n/backend/base.rb +46 -17
- data/lib/i18n/backend/cache.rb +8 -9
- data/lib/i18n/backend/cache_file.rb +36 -0
- data/lib/i18n/backend/cascade.rb +3 -1
- data/lib/i18n/backend/chain.rb +33 -3
- data/lib/i18n/backend/fallbacks.rb +11 -13
- data/lib/i18n/backend/flatten.rb +2 -0
- data/lib/i18n/backend/gettext.rb +4 -0
- data/lib/i18n/backend/interpolation_compiler.rb +3 -1
- data/lib/i18n/backend/key_value.rb +31 -2
- data/lib/i18n/backend/memoize.rb +10 -2
- data/lib/i18n/backend/metadata.rb +5 -3
- data/lib/i18n/backend/pluralization.rb +2 -0
- data/lib/i18n/backend/simple.rb +26 -8
- data/lib/i18n/backend/transliterator.rb +2 -0
- data/lib/i18n/backend.rb +3 -0
- data/lib/i18n/config.rb +20 -2
- data/lib/i18n/core_ext/hash.rb +42 -24
- data/lib/i18n/exceptions.rb +23 -16
- data/lib/i18n/gettext/helpers.rb +3 -1
- data/lib/i18n/gettext/po_parser.rb +7 -7
- data/lib/i18n/gettext.rb +2 -0
- data/lib/i18n/interpolate/ruby.rb +5 -3
- data/lib/i18n/locale/fallbacks.rb +1 -1
- data/lib/i18n/locale.rb +2 -0
- data/lib/i18n/middleware.rb +2 -0
- data/lib/i18n/tests/interpolation.rb +5 -4
- data/lib/i18n/tests/localization/date.rb +28 -6
- data/lib/i18n/tests/localization/date_time.rb +27 -6
- data/lib/i18n/tests/localization/time.rb +26 -4
- data/lib/i18n/tests.rb +2 -0
- data/lib/i18n/version.rb +3 -1
- data/lib/i18n.rb +72 -30
- metadata +24 -58
- data/gemfiles/Gemfile.rails-3.2.x +0 -10
- data/gemfiles/Gemfile.rails-4.0.x +0 -10
- data/gemfiles/Gemfile.rails-4.1.x +0 -10
- data/gemfiles/Gemfile.rails-4.2.x +0 -10
- data/gemfiles/Gemfile.rails-5.0.x +0 -10
- data/gemfiles/Gemfile.rails-5.1.x +0 -10
- data/gemfiles/Gemfile.rails-master +0 -10
- data/lib/i18n/core_ext/kernel/suppress_warnings.rb +0 -8
- data/lib/i18n/core_ext/string/interpolate.rb +0 -9
- data/test/api/all_features_test.rb +0 -58
- data/test/api/cascade_test.rb +0 -28
- data/test/api/chain_test.rb +0 -24
- data/test/api/fallbacks_test.rb +0 -30
- data/test/api/key_value_test.rb +0 -24
- data/test/api/memoize_test.rb +0 -56
- data/test/api/override_test.rb +0 -42
- data/test/api/pluralization_test.rb +0 -30
- data/test/api/simple_test.rb +0 -28
- data/test/backend/cache_test.rb +0 -109
- data/test/backend/cascade_test.rb +0 -86
- data/test/backend/chain_test.rb +0 -122
- data/test/backend/exceptions_test.rb +0 -36
- data/test/backend/fallbacks_test.rb +0 -219
- data/test/backend/interpolation_compiler_test.rb +0 -118
- data/test/backend/key_value_test.rb +0 -61
- data/test/backend/memoize_test.rb +0 -79
- data/test/backend/metadata_test.rb +0 -48
- data/test/backend/pluralization_test.rb +0 -45
- data/test/backend/simple_test.rb +0 -103
- data/test/backend/transliterator_test.rb +0 -84
- data/test/core_ext/hash_test.rb +0 -36
- data/test/gettext/api_test.rb +0 -214
- data/test/gettext/backend_test.rb +0 -92
- data/test/i18n/exceptions_test.rb +0 -117
- data/test/i18n/gettext_plural_keys_test.rb +0 -20
- data/test/i18n/interpolate_test.rb +0 -91
- data/test/i18n/load_path_test.rb +0 -34
- data/test/i18n/middleware_test.rb +0 -24
- data/test/i18n_test.rb +0 -462
- data/test/locale/fallbacks_test.rb +0 -133
- data/test/locale/tag/rfc4646_test.rb +0 -143
- data/test/locale/tag/simple_test.rb +0 -32
- data/test/run_all.rb +0 -20
- data/test/test_data/locales/de.po +0 -82
- data/test/test_data/locales/en.rb +0 -3
- data/test/test_data/locales/en.yml +0 -3
- data/test/test_data/locales/invalid/empty.yml +0 -0
- data/test/test_data/locales/invalid/syntax.yml +0 -4
- data/test/test_data/locales/plurals.rb +0 -113
- data/test/test_helper.rb +0 -61
@@ -1,143 +0,0 @@
|
|
1
|
-
# encoding: utf-8
|
2
|
-
require 'test_helper'
|
3
|
-
|
4
|
-
class I18nLocaleTagRfc4646ParserTest < I18n::TestCase
|
5
|
-
include I18n::Locale
|
6
|
-
|
7
|
-
test "Rfc4646::Parser given a valid tag 'de' returns an array of subtags" do
|
8
|
-
assert_equal ['de', nil, nil, nil, nil, nil, nil], Tag::Rfc4646::Parser.match('de')
|
9
|
-
end
|
10
|
-
|
11
|
-
test "Rfc4646::Parser given a valid tag 'de-DE' returns an array of subtags" do
|
12
|
-
assert_equal ['de', nil, 'DE', nil, nil, nil, nil], Tag::Rfc4646::Parser.match('de-DE')
|
13
|
-
end
|
14
|
-
|
15
|
-
test "Rfc4646::Parser given a valid lowercase tag 'de-latn-de-variant-x-phonebk' returns an array of subtags" do
|
16
|
-
assert_equal ['de', 'latn', 'de', 'variant', nil, 'x-phonebk', nil], Tag::Rfc4646::Parser.match('de-latn-de-variant-x-phonebk')
|
17
|
-
end
|
18
|
-
|
19
|
-
test "Rfc4646::Parser given a valid uppercase tag 'DE-LATN-DE-VARIANT-X-PHONEBK' returns an array of subtags" do
|
20
|
-
assert_equal ['DE', 'LATN', 'DE', 'VARIANT', nil, 'X-PHONEBK', nil], Tag::Rfc4646::Parser.match('DE-LATN-DE-VARIANT-X-PHONEBK')
|
21
|
-
end
|
22
|
-
|
23
|
-
test "Rfc4646::Parser given an invalid tag 'a-DE' it returns false" do
|
24
|
-
assert_equal false, Tag::Rfc4646::Parser.match('a-DE')
|
25
|
-
end
|
26
|
-
|
27
|
-
test "Rfc4646::Parser given an invalid tag 'de-419-DE' it returns false" do
|
28
|
-
assert_equal false, Tag::Rfc4646::Parser.match('de-419-DE')
|
29
|
-
end
|
30
|
-
end
|
31
|
-
|
32
|
-
# Tag for the locale 'de-Latn-DE-Variant-a-ext-x-phonebk-i-klingon'
|
33
|
-
|
34
|
-
class I18nLocaleTagSubtagsTest < I18n::TestCase
|
35
|
-
include I18n::Locale
|
36
|
-
|
37
|
-
def setup
|
38
|
-
super
|
39
|
-
subtags = %w(de Latn DE variant a-ext x-phonebk i-klingon)
|
40
|
-
@tag = Tag::Rfc4646.new(*subtags)
|
41
|
-
end
|
42
|
-
|
43
|
-
test "returns 'de' as the language subtag in lowercase" do
|
44
|
-
assert_equal 'de', @tag.language
|
45
|
-
end
|
46
|
-
|
47
|
-
test "returns 'Latn' as the script subtag in titlecase" do
|
48
|
-
assert_equal 'Latn', @tag.script
|
49
|
-
end
|
50
|
-
|
51
|
-
test "returns 'DE' as the region subtag in uppercase" do
|
52
|
-
assert_equal 'DE', @tag.region
|
53
|
-
end
|
54
|
-
|
55
|
-
test "returns 'variant' as the variant subtag in lowercase" do
|
56
|
-
assert_equal 'variant', @tag.variant
|
57
|
-
end
|
58
|
-
|
59
|
-
test "returns 'a-ext' as the extension subtag" do
|
60
|
-
assert_equal 'a-ext', @tag.extension
|
61
|
-
end
|
62
|
-
|
63
|
-
test "returns 'x-phonebk' as the privateuse subtag" do
|
64
|
-
assert_equal 'x-phonebk', @tag.privateuse
|
65
|
-
end
|
66
|
-
|
67
|
-
test "returns 'i-klingon' as the grandfathered subtag" do
|
68
|
-
assert_equal 'i-klingon', @tag.grandfathered
|
69
|
-
end
|
70
|
-
|
71
|
-
test "returns a formatted tag string from #to_s" do
|
72
|
-
assert_equal 'de-Latn-DE-variant-a-ext-x-phonebk-i-klingon', @tag.to_s
|
73
|
-
end
|
74
|
-
|
75
|
-
test "returns an array containing the formatted subtags from #to_a" do
|
76
|
-
assert_equal %w(de Latn DE variant a-ext x-phonebk i-klingon), @tag.to_a
|
77
|
-
end
|
78
|
-
end
|
79
|
-
|
80
|
-
# Tag inheritance
|
81
|
-
|
82
|
-
class I18nLocaleTagSubtagsTest < I18n::TestCase
|
83
|
-
test "#parent returns 'de-Latn-DE-variant-a-ext-x-phonebk' as the parent of 'de-Latn-DE-variant-a-ext-x-phonebk-i-klingon'" do
|
84
|
-
tag = Tag::Rfc4646.new(*%w(de Latn DE variant a-ext x-phonebk i-klingon))
|
85
|
-
assert_equal 'de-Latn-DE-variant-a-ext-x-phonebk', tag.parent.to_s
|
86
|
-
end
|
87
|
-
|
88
|
-
test "#parent returns 'de-Latn-DE-variant-a-ext' as the parent of 'de-Latn-DE-variant-a-ext-x-phonebk'" do
|
89
|
-
tag = Tag::Rfc4646.new(*%w(de Latn DE variant a-ext x-phonebk))
|
90
|
-
assert_equal 'de-Latn-DE-variant-a-ext', tag.parent.to_s
|
91
|
-
end
|
92
|
-
|
93
|
-
test "#parent returns 'de-Latn-DE-variant' as the parent of 'de-Latn-DE-variant-a-ext'" do
|
94
|
-
tag = Tag::Rfc4646.new(*%w(de Latn DE variant a-ext))
|
95
|
-
assert_equal 'de-Latn-DE-variant', tag.parent.to_s
|
96
|
-
end
|
97
|
-
|
98
|
-
test "#parent returns 'de-Latn-DE' as the parent of 'de-Latn-DE-variant'" do
|
99
|
-
tag = Tag::Rfc4646.new(*%w(de Latn DE variant))
|
100
|
-
assert_equal 'de-Latn-DE', tag.parent.to_s
|
101
|
-
end
|
102
|
-
|
103
|
-
test "#parent returns 'de-Latn' as the parent of 'de-Latn-DE'" do
|
104
|
-
tag = Tag::Rfc4646.new(*%w(de Latn DE))
|
105
|
-
assert_equal 'de-Latn', tag.parent.to_s
|
106
|
-
end
|
107
|
-
|
108
|
-
test "#parent returns 'de' as the parent of 'de-Latn'" do
|
109
|
-
tag = Tag::Rfc4646.new(*%w(de Latn))
|
110
|
-
assert_equal 'de', tag.parent.to_s
|
111
|
-
end
|
112
|
-
|
113
|
-
# TODO RFC4647 says: "If no language tag matches the request, the "default" value is returned."
|
114
|
-
# where should we set the default language?
|
115
|
-
# test "#parent returns '' as the parent of 'de'" do
|
116
|
-
# tag = Tag::Rfc4646.new *%w(de)
|
117
|
-
# assert_equal '', tag.parent.to_s
|
118
|
-
# end
|
119
|
-
|
120
|
-
test "#parent returns an array of 5 parents for 'de-Latn-DE-variant-a-ext-x-phonebk-i-klingon'" do
|
121
|
-
parents = %w(de-Latn-DE-variant-a-ext-x-phonebk-i-klingon
|
122
|
-
de-Latn-DE-variant-a-ext-x-phonebk
|
123
|
-
de-Latn-DE-variant-a-ext
|
124
|
-
de-Latn-DE-variant
|
125
|
-
de-Latn-DE
|
126
|
-
de-Latn
|
127
|
-
de)
|
128
|
-
tag = Tag::Rfc4646.new(*%w(de Latn DE variant a-ext x-phonebk i-klingon))
|
129
|
-
assert_equal parents, tag.self_and_parents.map(&:to_s)
|
130
|
-
end
|
131
|
-
|
132
|
-
test "returns an array of 5 parents for 'de-Latn-DE-variant-a-ext-x-phonebk-i-klingon'" do
|
133
|
-
parents = %w(de-Latn-DE-variant-a-ext-x-phonebk-i-klingon
|
134
|
-
de-Latn-DE-variant-a-ext-x-phonebk
|
135
|
-
de-Latn-DE-variant-a-ext
|
136
|
-
de-Latn-DE-variant
|
137
|
-
de-Latn-DE
|
138
|
-
de-Latn
|
139
|
-
de)
|
140
|
-
tag = Tag::Rfc4646.new(*%w(de Latn DE variant a-ext x-phonebk i-klingon))
|
141
|
-
assert_equal parents, tag.self_and_parents.map(&:to_s)
|
142
|
-
end
|
143
|
-
end
|
@@ -1,32 +0,0 @@
|
|
1
|
-
# encoding: utf-8
|
2
|
-
require 'test_helper'
|
3
|
-
|
4
|
-
class I18nLocaleTagSimpleTest < I18n::TestCase
|
5
|
-
include I18n::Locale
|
6
|
-
|
7
|
-
test "returns 'de' as the language subtag in lowercase" do
|
8
|
-
assert_equal %w(de Latn DE), Tag::Simple.new('de-Latn-DE').subtags
|
9
|
-
end
|
10
|
-
|
11
|
-
test "returns a formatted tag string from #to_s" do
|
12
|
-
assert_equal 'de-Latn-DE', Tag::Simple.new('de-Latn-DE').to_s
|
13
|
-
end
|
14
|
-
|
15
|
-
test "returns an array containing the formatted subtags from #to_a" do
|
16
|
-
assert_equal %w(de Latn DE), Tag::Simple.new('de-Latn-DE').to_a
|
17
|
-
end
|
18
|
-
|
19
|
-
# Tag inheritance
|
20
|
-
|
21
|
-
test "#parent returns 'de-Latn' as the parent of 'de-Latn-DE'" do
|
22
|
-
assert_equal 'de-Latn', Tag::Simple.new('de-Latn-DE').parent.to_s
|
23
|
-
end
|
24
|
-
|
25
|
-
test "#parent returns 'de' as the parent of 'de-Latn'" do
|
26
|
-
assert_equal 'de', Tag::Simple.new('de-Latn').parent.to_s
|
27
|
-
end
|
28
|
-
|
29
|
-
test "#self_and_parents returns an array of 3 tags for 'de-Latn-DE'" do
|
30
|
-
assert_equal %w(de-Latn-DE de-Latn de), Tag::Simple.new('de-Latn-DE').self_and_parents.map { |tag| tag.to_s}
|
31
|
-
end
|
32
|
-
end
|
data/test/run_all.rb
DELETED
@@ -1,20 +0,0 @@
|
|
1
|
-
def bundle_check
|
2
|
-
`bundle check` == "Resolving dependencies...\nThe Gemfile's dependencies are satisfied\n"
|
3
|
-
end
|
4
|
-
|
5
|
-
def execute(command)
|
6
|
-
puts command
|
7
|
-
system command
|
8
|
-
end
|
9
|
-
|
10
|
-
gemfiles = %w(Gemfile) + Dir['gemfiles/Gemfile*'].reject { |f| f.end_with?('.lock') }
|
11
|
-
|
12
|
-
results = gemfiles.map do |gemfile|
|
13
|
-
puts "\nBUNDLE_GEMFILE=#{gemfile}"
|
14
|
-
ENV['BUNDLE_GEMFILE'] = File.expand_path("../../#{gemfile}", __FILE__)
|
15
|
-
|
16
|
-
execute 'bundle install' unless bundle_check
|
17
|
-
execute 'bundle exec rake test'
|
18
|
-
end
|
19
|
-
|
20
|
-
exit results.all?
|
@@ -1,82 +0,0 @@
|
|
1
|
-
# SOME DESCRIPTIVE TITLE.
|
2
|
-
# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
|
3
|
-
# This file is distributed under the same license as the 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
|
-
msgctxt "New car"
|
46
|
-
msgid "Wheels count"
|
47
|
-
msgstr "Räderzahl!"
|
48
|
-
|
49
|
-
#: app/views/cars/show.html.erb:7
|
50
|
-
msgid "Created"
|
51
|
-
msgstr "Erstellt"
|
52
|
-
|
53
|
-
#: app/views/cars/show.html.erb:9
|
54
|
-
msgid "Month"
|
55
|
-
msgstr "Monat"
|
56
|
-
|
57
|
-
#: locale/model_attributes.rb:2
|
58
|
-
msgid "car"
|
59
|
-
msgstr "Auto"
|
60
|
-
|
61
|
-
#: locale/testlog_phrases.rb:2
|
62
|
-
msgid "this is a dynamic translation which was found thorugh gettext_test_log!"
|
63
|
-
msgstr ""
|
64
|
-
"Dies ist eine dynamische Übersetzung, die durch gettext_test_log "
|
65
|
-
"gefunden wurde!"
|
66
|
-
|
67
|
-
#: app/views/cars/nowhere_really
|
68
|
-
msgid "Car|wheel"
|
69
|
-
msgid_plural "Car|wheels"
|
70
|
-
msgstr[0] "Rad"
|
71
|
-
msgstr[1] "Räder"
|
72
|
-
|
73
|
-
msgctxt "New car"
|
74
|
-
msgid "wheel"
|
75
|
-
msgid_plural "wheels"
|
76
|
-
msgstr[0] "Rad!"
|
77
|
-
msgstr[1] "Räder!"
|
78
|
-
|
79
|
-
msgid "On %{count} wheel."
|
80
|
-
msgid_plural "On %{count} wheels."
|
81
|
-
msgstr[0] "Auf %{count} Achse."
|
82
|
-
msgstr[1] "Auf %{count} Achsen."
|
File without changes
|
@@ -1,113 +0,0 @@
|
|
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.between?(0, 2) && 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, :many, :other], :rule => lambda { |n| n == 1 ? :one : [2, 3, 4].include?(n % 10) && ![12, 13, 14].include?(n % 100) ? :few : (n != 1 && [0, 1].include?(n % 10)) || [5, 6, 7, 8, 9].include?(n % 10) || [12, 13, 14].include?(n % 100) ? :many : :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
|
-
|
data/test/test_helper.rb
DELETED
@@ -1,61 +0,0 @@
|
|
1
|
-
$KCODE = 'u' if RUBY_VERSION <= '1.9'
|
2
|
-
|
3
|
-
require 'minitest/autorun'
|
4
|
-
TEST_CASE = defined?(Minitest::Test) ? Minitest::Test : MiniTest::Unit::TestCase
|
5
|
-
|
6
|
-
# TODO: Remove these aliases and update tests accordingly.
|
7
|
-
class TEST_CASE
|
8
|
-
alias :assert_raise :assert_raises
|
9
|
-
alias :assert_not_equal :refute_equal
|
10
|
-
|
11
|
-
def assert_nothing_raised(*args)
|
12
|
-
yield
|
13
|
-
end
|
14
|
-
end
|
15
|
-
|
16
|
-
require 'bundler/setup'
|
17
|
-
require 'i18n'
|
18
|
-
require 'mocha/setup'
|
19
|
-
require 'test_declarative'
|
20
|
-
|
21
|
-
class I18n::TestCase < TEST_CASE
|
22
|
-
def self.key_value?
|
23
|
-
defined?(ActiveSupport)
|
24
|
-
end
|
25
|
-
|
26
|
-
def setup
|
27
|
-
super
|
28
|
-
I18n.enforce_available_locales = false
|
29
|
-
end
|
30
|
-
|
31
|
-
def teardown
|
32
|
-
I18n.locale = nil
|
33
|
-
I18n.default_locale = nil
|
34
|
-
I18n.load_path = nil
|
35
|
-
I18n.available_locales = nil
|
36
|
-
I18n.backend = nil
|
37
|
-
I18n.default_separator = nil
|
38
|
-
I18n.enforce_available_locales = true
|
39
|
-
super
|
40
|
-
end
|
41
|
-
|
42
|
-
protected
|
43
|
-
|
44
|
-
def translations
|
45
|
-
I18n.backend.instance_variable_get(:@translations)
|
46
|
-
end
|
47
|
-
|
48
|
-
def store_translations(locale, data)
|
49
|
-
I18n.backend.store_translations(locale, data)
|
50
|
-
end
|
51
|
-
|
52
|
-
def locales_dir
|
53
|
-
File.dirname(__FILE__) + '/test_data/locales'
|
54
|
-
end
|
55
|
-
end
|
56
|
-
|
57
|
-
class DummyRackApp
|
58
|
-
def call(env)
|
59
|
-
I18n.locale = :es
|
60
|
-
end
|
61
|
-
end
|