i18n 1.0.0 → 1.14.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (97) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +75 -32
  3. data/lib/i18n/backend/base.rb +93 -34
  4. data/lib/i18n/backend/cache.rb +10 -11
  5. data/lib/i18n/backend/cache_file.rb +36 -0
  6. data/lib/i18n/backend/cascade.rb +3 -1
  7. data/lib/i18n/backend/chain.rb +39 -6
  8. data/lib/i18n/backend/fallbacks.rb +48 -15
  9. data/lib/i18n/backend/flatten.rb +10 -5
  10. data/lib/i18n/backend/gettext.rb +4 -2
  11. data/lib/i18n/backend/interpolation_compiler.rb +8 -8
  12. data/lib/i18n/backend/key_value.rb +31 -4
  13. data/lib/i18n/backend/lazy_loadable.rb +184 -0
  14. data/lib/i18n/backend/memoize.rb +10 -2
  15. data/lib/i18n/backend/metadata.rb +5 -3
  16. data/lib/i18n/backend/pluralization.rb +61 -18
  17. data/lib/i18n/backend/simple.rb +44 -24
  18. data/lib/i18n/backend/transliterator.rb +26 -24
  19. data/lib/i18n/backend.rb +5 -1
  20. data/lib/i18n/config.rb +22 -4
  21. data/lib/i18n/exceptions.rb +71 -18
  22. data/lib/i18n/gettext/helpers.rb +4 -2
  23. data/lib/i18n/gettext/po_parser.rb +7 -7
  24. data/lib/i18n/gettext.rb +2 -0
  25. data/lib/i18n/interpolate/ruby.rb +22 -6
  26. data/lib/i18n/locale/fallbacks.rb +33 -22
  27. data/lib/i18n/locale/tag/parents.rb +8 -6
  28. data/lib/i18n/locale/tag/simple.rb +2 -2
  29. data/lib/i18n/locale.rb +2 -0
  30. data/lib/i18n/middleware.rb +2 -0
  31. data/lib/i18n/tests/basics.rb +5 -7
  32. data/lib/i18n/tests/defaults.rb +8 -1
  33. data/lib/i18n/tests/interpolation.rb +34 -7
  34. data/lib/i18n/tests/link.rb +11 -1
  35. data/lib/i18n/tests/localization/date.rb +37 -10
  36. data/lib/i18n/tests/localization/date_time.rb +28 -7
  37. data/lib/i18n/tests/localization/procs.rb +9 -7
  38. data/lib/i18n/tests/localization/time.rb +27 -5
  39. data/lib/i18n/tests/lookup.rb +11 -5
  40. data/lib/i18n/tests/pluralization.rb +1 -1
  41. data/lib/i18n/tests/procs.rb +23 -7
  42. data/lib/i18n/tests.rb +2 -0
  43. data/lib/i18n/utils.rb +55 -0
  44. data/lib/i18n/version.rb +3 -1
  45. data/lib/i18n.rb +179 -58
  46. metadata +16 -61
  47. data/gemfiles/Gemfile.rails-3.2.x +0 -10
  48. data/gemfiles/Gemfile.rails-4.0.x +0 -10
  49. data/gemfiles/Gemfile.rails-4.1.x +0 -10
  50. data/gemfiles/Gemfile.rails-4.2.x +0 -10
  51. data/gemfiles/Gemfile.rails-5.0.x +0 -10
  52. data/gemfiles/Gemfile.rails-5.1.x +0 -10
  53. data/gemfiles/Gemfile.rails-master +0 -10
  54. data/lib/i18n/core_ext/hash.rb +0 -29
  55. data/lib/i18n/core_ext/kernel/suppress_warnings.rb +0 -8
  56. data/lib/i18n/core_ext/string/interpolate.rb +0 -9
  57. data/test/api/all_features_test.rb +0 -58
  58. data/test/api/cascade_test.rb +0 -28
  59. data/test/api/chain_test.rb +0 -24
  60. data/test/api/fallbacks_test.rb +0 -30
  61. data/test/api/key_value_test.rb +0 -24
  62. data/test/api/memoize_test.rb +0 -56
  63. data/test/api/override_test.rb +0 -42
  64. data/test/api/pluralization_test.rb +0 -30
  65. data/test/api/simple_test.rb +0 -28
  66. data/test/backend/cache_test.rb +0 -109
  67. data/test/backend/cascade_test.rb +0 -86
  68. data/test/backend/chain_test.rb +0 -122
  69. data/test/backend/exceptions_test.rb +0 -36
  70. data/test/backend/fallbacks_test.rb +0 -219
  71. data/test/backend/interpolation_compiler_test.rb +0 -118
  72. data/test/backend/key_value_test.rb +0 -61
  73. data/test/backend/memoize_test.rb +0 -79
  74. data/test/backend/metadata_test.rb +0 -48
  75. data/test/backend/pluralization_test.rb +0 -45
  76. data/test/backend/simple_test.rb +0 -103
  77. data/test/backend/transliterator_test.rb +0 -84
  78. data/test/core_ext/hash_test.rb +0 -36
  79. data/test/gettext/api_test.rb +0 -214
  80. data/test/gettext/backend_test.rb +0 -92
  81. data/test/i18n/exceptions_test.rb +0 -117
  82. data/test/i18n/gettext_plural_keys_test.rb +0 -20
  83. data/test/i18n/interpolate_test.rb +0 -91
  84. data/test/i18n/load_path_test.rb +0 -34
  85. data/test/i18n/middleware_test.rb +0 -24
  86. data/test/i18n_test.rb +0 -462
  87. data/test/locale/fallbacks_test.rb +0 -133
  88. data/test/locale/tag/rfc4646_test.rb +0 -143
  89. data/test/locale/tag/simple_test.rb +0 -32
  90. data/test/run_all.rb +0 -20
  91. data/test/test_data/locales/de.po +0 -82
  92. data/test/test_data/locales/en.rb +0 -3
  93. data/test/test_data/locales/en.yml +0 -3
  94. data/test/test_data/locales/invalid/empty.yml +0 -0
  95. data/test/test_data/locales/invalid/syntax.yml +0 -4
  96. data/test/test_data/locales/plurals.rb +0 -113
  97. data/test/test_helper.rb +0 -61
@@ -1,133 +0,0 @@
1
- require 'test_helper'
2
-
3
- include I18n::Locale
4
-
5
- class I18nFallbacksDefaultsTest < I18n::TestCase
6
- test "defaults reflect the I18n.default_locale if no default has been set manually" do
7
- I18n.default_locale = :'en-US'
8
- fallbacks = Fallbacks.new
9
- assert_equal [:'en-US', :en], fallbacks.defaults
10
- end
11
-
12
- test "defaults reflect a manually passed default locale if any" do
13
- fallbacks = Fallbacks.new(:'fi-FI')
14
- assert_equal [:'fi-FI', :fi], fallbacks.defaults
15
- I18n.default_locale = :'de-DE'
16
- assert_equal [:'fi-FI', :fi], fallbacks.defaults
17
- end
18
-
19
- test "defaults allows to set multiple defaults" do
20
- fallbacks = Fallbacks.new(:'fi-FI', :'se-FI')
21
- assert_equal [:'fi-FI', :fi, :'se-FI', :se], fallbacks.defaults
22
- end
23
- end
24
-
25
- class I18nFallbacksComputationTest < I18n::TestCase
26
- def setup
27
- super
28
- @fallbacks = Fallbacks.new(:'en-US')
29
- end
30
-
31
- test "with no mappings defined it returns [:es, :en-US] for :es" do
32
- assert_equal [:es, :"en-US", :en], @fallbacks[:es]
33
- end
34
-
35
- test "with no mappings defined it returns [:es-ES, :es, :en-US] for :es-ES" do
36
- assert_equal [:"es-ES", :es, :"en-US", :en], @fallbacks[:"es-ES"]
37
- end
38
-
39
- test "with no mappings defined it returns [:es-MX, :es, :en-US] for :es-MX" do
40
- assert_equal [:"es-MX", :es, :"en-US", :en], @fallbacks[:"es-MX"]
41
- end
42
-
43
- test "with no mappings defined it returns [:es-Latn-ES, :es-Latn, :es, :en-US] for :es-Latn-ES" do
44
- assert_equal [:"es-Latn-ES", :"es-Latn", :es, :"en-US", :en], @fallbacks[:'es-Latn-ES']
45
- end
46
-
47
- test "with no mappings defined it returns [:en, :en-US] for :en" do
48
- assert_equal [:en, :"en-US"], @fallbacks[:en]
49
- end
50
-
51
- test "with no mappings defined it returns [:en-US, :en] for :en-US (special case: locale == default)" do
52
- assert_equal [:"en-US", :en], @fallbacks[:"en-US"]
53
- end
54
-
55
- # Most people who speak Catalan also live in Spain, so it is safe to assume
56
- # that they also speak Spanish as spoken in Spain.
57
- test "with a Catalan mapping defined it returns [:ca, :es-ES, :es, :en-US] for :ca" do
58
- @fallbacks.map(:ca => :"es-ES")
59
- assert_equal [:ca, :"es-ES", :es, :"en-US", :en], @fallbacks[:ca]
60
- end
61
-
62
- test "with a Catalan mapping defined it returns [:ca-ES, :ca, :es-ES, :es, :en-US] for :ca-ES" do
63
- @fallbacks.map(:ca => :"es-ES")
64
- assert_equal [:"ca-ES", :ca, :"es-ES", :es, :"en-US", :en], @fallbacks[:"ca-ES"]
65
- end
66
-
67
- # People who speak Arabic as spoken in Palestine often times also speak
68
- # Hebrew as spoken in Israel. However it is in no way safe to assume that
69
- # everybody who speaks Arabic also speaks Hebrew.
70
-
71
- test "with a Hebrew mapping defined it returns [:ar, :en-US] for :ar" do
72
- @fallbacks.map(:"ar-PS" => :"he-IL")
73
- assert_equal [:ar, :"en-US", :en], @fallbacks[:ar]
74
- end
75
-
76
- test "with a Hebrew mapping defined it returns [:ar-EG, :ar, :en-US] for :ar-EG" do
77
- @fallbacks.map(:"ar-PS" => :"he-IL")
78
- assert_equal [:"ar-EG", :ar, :"en-US", :en], @fallbacks[:"ar-EG"]
79
- end
80
-
81
- test "with a Hebrew mapping defined it returns [:ar-PS, :ar, :he-IL, :he, :en-US] for :ar-PS" do
82
- @fallbacks.map(:"ar-PS" => :"he-IL")
83
- assert_equal [:"ar-PS", :ar, :"he-IL", :he, :"en-US", :en], @fallbacks[:"ar-PS"]
84
- end
85
-
86
- # Sami people live in several scandinavian countries. In Finnland many people
87
- # know Swedish and Finnish. Thus, it can be assumed that Sami living in
88
- # Finnland also speak Swedish and Finnish.
89
-
90
- test "with a Sami mapping defined it returns [:sms-FI, :sms, :se-FI, :se, :fi-FI, :fi, :en-US] for :sms-FI" do
91
- @fallbacks.map(:sms => [:"se-FI", :"fi-FI"])
92
- assert_equal [:"sms-FI", :sms, :"se-FI", :se, :"fi-FI", :fi, :"en-US", :en], @fallbacks[:"sms-FI"]
93
- end
94
-
95
- # Austrian people understand German as spoken in Germany
96
-
97
- test "with a German mapping defined it returns [:de, :en-US] for de" do
98
- @fallbacks.map(:"de-AT" => :"de-DE")
99
- assert_equal [:de, :"en-US", :en], @fallbacks[:"de"]
100
- end
101
-
102
- test "with a German mapping defined it returns [:de-DE, :de, :en-US] for de-DE" do
103
- @fallbacks.map(:"de-AT" => :"de-DE")
104
- assert_equal [:"de-DE", :de, :"en-US", :en], @fallbacks[:"de-DE"]
105
- end
106
-
107
- test "with a German mapping defined it returns [:de-AT, :de, :de-DE, :en-US] for de-AT" do
108
- @fallbacks.map(:"de-AT" => :"de-DE")
109
- assert_equal [:"de-AT", :de, :"de-DE", :"en-US", :en], @fallbacks[:"de-AT"]
110
- end
111
-
112
- # Mapping :de => :en, :he => :en
113
-
114
- test "with a mapping :de => :en, :he => :en defined it returns [:de, :en] for :de" do
115
- assert_equal [:de, :"en-US", :en], @fallbacks[:de]
116
- end
117
-
118
- test "with a mapping :de => :en, :he => :en defined it [:he, :en] for :de" do
119
- assert_equal [:he, :"en-US", :en], @fallbacks[:he]
120
- end
121
-
122
- # Test allowing mappings that fallback to each other
123
-
124
- test "with :no => :nb, :nb => :no defined :no returns [:no, :nb, :en-US, :en]" do
125
- @fallbacks.map(:no => :nb, :nb => :no)
126
- assert_equal [:no, :nb, :"en-US", :en], @fallbacks[:no]
127
- end
128
-
129
- test "with :no => :nb, :nb => :no defined :nb returns [:nb, :no, :en-US, :en]" do
130
- @fallbacks.map(:no => :nb, :nb => :no)
131
- assert_equal [:nb, :no, :"en-US", :en], @fallbacks[:nb]
132
- end
133
- end
@@ -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."
@@ -1,3 +0,0 @@
1
- # encoding: utf-8
2
-
3
- { :en => { :fuh => { :bah => "bas" } } }
@@ -1,3 +0,0 @@
1
- en:
2
- foo:
3
- bar: baz
File without changes
@@ -1,4 +0,0 @@
1
- en:
2
- foo: foo
3
- bar:
4
- baz:
@@ -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