i18n 1.0.1 → 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.rb +53 -27
- data/lib/i18n/backend.rb +1 -0
- data/lib/i18n/backend/base.rb +36 -9
- data/lib/i18n/backend/cache.rb +2 -5
- data/lib/i18n/backend/cache_file.rb +36 -0
- data/lib/i18n/backend/chain.rb +28 -0
- data/lib/i18n/backend/gettext.rb +2 -0
- data/lib/i18n/backend/key_value.rb +27 -0
- data/lib/i18n/backend/memoize.rb +6 -0
- data/lib/i18n/backend/simple.rb +22 -6
- data/lib/i18n/config.rb +17 -1
- data/lib/i18n/core_ext/hash.rb +42 -24
- data/lib/i18n/exceptions.rb +20 -15
- data/lib/i18n/interpolate/ruby.rb +5 -3
- data/lib/i18n/locale/fallbacks.rb +1 -1
- data/lib/i18n/tests/interpolation.rb +1 -1
- 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/version.rb +1 -1
- 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
@@ -12,8 +12,7 @@ module I18n
|
|
12
12
|
end
|
13
13
|
|
14
14
|
test "localize Time: given the short format it uses it" do
|
15
|
-
|
16
|
-
assert_equal '01. Mar 06:00', I18n.l(@time, :format => :short, :locale => :de)
|
15
|
+
assert_equal '01. Mär 06:00', I18n.l(@time, :format => :short, :locale => :de)
|
17
16
|
end
|
18
17
|
|
19
18
|
test "localize Time: given the long format it uses it" do
|
@@ -29,17 +28,40 @@ module I18n
|
|
29
28
|
assert_equal 'Samstag', I18n.l(@time, :format => '%A', :locale => :de)
|
30
29
|
end
|
31
30
|
|
31
|
+
test "localize Time: given a uppercased day name format it returns the correct day name in upcase" do
|
32
|
+
assert_equal 'samstag'.upcase, I18n.l(@time, :format => '%^A', :locale => :de)
|
33
|
+
end
|
34
|
+
|
32
35
|
test "localize Time: given an abbreviated day name format it returns the correct abbreviated day name" do
|
33
36
|
assert_equal 'Sa', I18n.l(@time, :format => '%a', :locale => :de)
|
34
37
|
end
|
35
38
|
|
39
|
+
test "localize Time: given an abbreviated and uppercased day name format it returns the correct abbreviated day name in upcase" do
|
40
|
+
assert_equal 'sa'.upcase, I18n.l(@time, :format => '%^a', :locale => :de)
|
41
|
+
end
|
42
|
+
|
36
43
|
test "localize Time: given a month name format it returns the correct month name" do
|
37
44
|
assert_equal 'März', I18n.l(@time, :format => '%B', :locale => :de)
|
38
45
|
end
|
39
46
|
|
47
|
+
test "localize Time: given a uppercased month name format it returns the correct month name in upcase" do
|
48
|
+
assert_equal 'märz'.upcase, I18n.l(@time, :format => '%^B', :locale => :de)
|
49
|
+
end
|
50
|
+
|
40
51
|
test "localize Time: given an abbreviated month name format it returns the correct abbreviated month name" do
|
41
|
-
|
42
|
-
|
52
|
+
assert_equal 'Mär', I18n.l(@time, :format => '%b', :locale => :de)
|
53
|
+
end
|
54
|
+
|
55
|
+
test "localize Time: given an abbreviated and uppercased month name format it returns the correct abbreviated month name in upcase" do
|
56
|
+
assert_equal 'mär'.upcase, I18n.l(@time, :format => '%^b', :locale => :de)
|
57
|
+
end
|
58
|
+
|
59
|
+
test "localize Time: given a date format with the month name upcased it returns the correct value" do
|
60
|
+
assert_equal '1. FEBRUAR 2008', I18n.l(::Time.utc(2008, 2, 1, 6, 0), :format => "%-d. %^B %Y", :locale => :de)
|
61
|
+
end
|
62
|
+
|
63
|
+
test "localize Time: given missing translations it returns the correct error message" do
|
64
|
+
assert_equal 'translation missing: fr.date.abbr_month_names', I18n.l(@time, :format => '%b', :locale => :fr)
|
43
65
|
end
|
44
66
|
|
45
67
|
test "localize Time: given a meridian indicator format it returns the correct meridian indicator" do
|
data/lib/i18n/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: i18n
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0
|
4
|
+
version: 1.6.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sven Fuchs
|
@@ -13,7 +13,7 @@ authors:
|
|
13
13
|
autorequire:
|
14
14
|
bindir: bin
|
15
15
|
cert_chain: []
|
16
|
-
date:
|
16
|
+
date: 2019-03-03 00:00:00.000000000 Z
|
17
17
|
dependencies:
|
18
18
|
- !ruby/object:Gem::Dependency
|
19
19
|
name: concurrent-ruby
|
@@ -37,17 +37,11 @@ extra_rdoc_files: []
|
|
37
37
|
files:
|
38
38
|
- MIT-LICENSE
|
39
39
|
- README.md
|
40
|
-
- gemfiles/Gemfile.rails-3.2.x
|
41
|
-
- gemfiles/Gemfile.rails-4.0.x
|
42
|
-
- gemfiles/Gemfile.rails-4.1.x
|
43
|
-
- gemfiles/Gemfile.rails-4.2.x
|
44
|
-
- gemfiles/Gemfile.rails-5.0.x
|
45
|
-
- gemfiles/Gemfile.rails-5.1.x
|
46
|
-
- gemfiles/Gemfile.rails-master
|
47
40
|
- lib/i18n.rb
|
48
41
|
- lib/i18n/backend.rb
|
49
42
|
- lib/i18n/backend/base.rb
|
50
43
|
- lib/i18n/backend/cache.rb
|
44
|
+
- lib/i18n/backend/cache_file.rb
|
51
45
|
- lib/i18n/backend/cascade.rb
|
52
46
|
- lib/i18n/backend/chain.rb
|
53
47
|
- lib/i18n/backend/fallbacks.rb
|
@@ -62,8 +56,6 @@ files:
|
|
62
56
|
- lib/i18n/backend/transliterator.rb
|
63
57
|
- lib/i18n/config.rb
|
64
58
|
- lib/i18n/core_ext/hash.rb
|
65
|
-
- lib/i18n/core_ext/kernel/suppress_warnings.rb
|
66
|
-
- lib/i18n/core_ext/string/interpolate.rb
|
67
59
|
- lib/i18n/exceptions.rb
|
68
60
|
- lib/i18n/gettext.rb
|
69
61
|
- lib/i18n/gettext/helpers.rb
|
@@ -90,52 +82,27 @@ files:
|
|
90
82
|
- lib/i18n/tests/pluralization.rb
|
91
83
|
- lib/i18n/tests/procs.rb
|
92
84
|
- lib/i18n/version.rb
|
93
|
-
|
94
|
-
- test/api/cascade_test.rb
|
95
|
-
- test/api/chain_test.rb
|
96
|
-
- test/api/fallbacks_test.rb
|
97
|
-
- test/api/key_value_test.rb
|
98
|
-
- test/api/memoize_test.rb
|
99
|
-
- test/api/override_test.rb
|
100
|
-
- test/api/pluralization_test.rb
|
101
|
-
- test/api/simple_test.rb
|
102
|
-
- test/backend/cache_test.rb
|
103
|
-
- test/backend/cascade_test.rb
|
104
|
-
- test/backend/chain_test.rb
|
105
|
-
- test/backend/exceptions_test.rb
|
106
|
-
- test/backend/fallbacks_test.rb
|
107
|
-
- test/backend/interpolation_compiler_test.rb
|
108
|
-
- test/backend/key_value_test.rb
|
109
|
-
- test/backend/memoize_test.rb
|
110
|
-
- test/backend/metadata_test.rb
|
111
|
-
- test/backend/pluralization_test.rb
|
112
|
-
- test/backend/simple_test.rb
|
113
|
-
- test/backend/transliterator_test.rb
|
114
|
-
- test/core_ext/hash_test.rb
|
115
|
-
- test/gettext/api_test.rb
|
116
|
-
- test/gettext/backend_test.rb
|
117
|
-
- test/i18n/exceptions_test.rb
|
118
|
-
- test/i18n/gettext_plural_keys_test.rb
|
119
|
-
- test/i18n/interpolate_test.rb
|
120
|
-
- test/i18n/load_path_test.rb
|
121
|
-
- test/i18n/middleware_test.rb
|
122
|
-
- test/i18n_test.rb
|
123
|
-
- test/locale/fallbacks_test.rb
|
124
|
-
- test/locale/tag/rfc4646_test.rb
|
125
|
-
- test/locale/tag/simple_test.rb
|
126
|
-
- test/run_all.rb
|
127
|
-
- test/test_data/locales/de.po
|
128
|
-
- test/test_data/locales/en.rb
|
129
|
-
- test/test_data/locales/en.yml
|
130
|
-
- test/test_data/locales/invalid/empty.yml
|
131
|
-
- test/test_data/locales/invalid/syntax.yml
|
132
|
-
- test/test_data/locales/plurals.rb
|
133
|
-
- test/test_helper.rb
|
134
|
-
homepage: http://github.com/svenfuchs/i18n
|
85
|
+
homepage: http://github.com/ruby-i18n/i18n
|
135
86
|
licenses:
|
136
87
|
- MIT
|
137
|
-
metadata:
|
138
|
-
|
88
|
+
metadata:
|
89
|
+
bug_tracker_uri: https://github.com/svenfuchs/i18n/issues
|
90
|
+
changelog_uri: https://github.com/svenfuchs/i18n/releases
|
91
|
+
documentation_uri: https://guides.rubyonrails.org/i18n.html
|
92
|
+
source_code_uri: https://github.com/svenfuchs/i18n
|
93
|
+
post_install_message: |2+
|
94
|
+
|
95
|
+
HEADS UP! i18n 1.1 changed fallbacks to exclude default locale.
|
96
|
+
But that may break your application.
|
97
|
+
|
98
|
+
Please check your Rails app for 'config.i18n.fallbacks = true'.
|
99
|
+
If you're using I18n (>= 1.1.0) and Rails (< 5.2.2), this should be
|
100
|
+
'config.i18n.fallbacks = [I18n.default_locale]'.
|
101
|
+
If not, fallbacks will be broken in your app by I18n 1.1.x.
|
102
|
+
|
103
|
+
For more info see:
|
104
|
+
https://github.com/svenfuchs/i18n/releases/tag/v1.1.0
|
105
|
+
|
139
106
|
rdoc_options: []
|
140
107
|
require_paths:
|
141
108
|
- lib
|
@@ -143,15 +110,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
143
110
|
requirements:
|
144
111
|
- - ">="
|
145
112
|
- !ruby/object:Gem::Version
|
146
|
-
version: 2.
|
113
|
+
version: 2.3.0
|
147
114
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
148
115
|
requirements:
|
149
116
|
- - ">="
|
150
117
|
- !ruby/object:Gem::Version
|
151
118
|
version: 1.3.5
|
152
119
|
requirements: []
|
153
|
-
|
154
|
-
rubygems_version: 2.7.4
|
120
|
+
rubygems_version: 3.0.2
|
155
121
|
signing_key:
|
156
122
|
specification_version: 4
|
157
123
|
summary: New wave Internationalization support for Ruby
|
@@ -1,9 +0,0 @@
|
|
1
|
-
# This file used to backport the Ruby 1.9 String interpolation syntax to Ruby 1.8.
|
2
|
-
#
|
3
|
-
# Since I18n has dropped support to Ruby 1.8, this file is not required anymore,
|
4
|
-
# however, Rails 3.2 still requires it directly:
|
5
|
-
#
|
6
|
-
# https://github.com/rails/rails/blob/3-2-stable/activesupport/lib/active_support/core_ext/string/interpolation.rb#L2
|
7
|
-
#
|
8
|
-
# So we can't just drop the file entirely, which would then break Rails users
|
9
|
-
# under Ruby 1.9. This file can be removed once Rails 3.2 support is dropped.
|
@@ -1,58 +0,0 @@
|
|
1
|
-
require 'test_helper'
|
2
|
-
|
3
|
-
begin
|
4
|
-
require 'rubygems'
|
5
|
-
require 'active_support'
|
6
|
-
rescue LoadError
|
7
|
-
puts "not testing with Cache enabled because active_support can not be found"
|
8
|
-
end
|
9
|
-
|
10
|
-
class I18nAllFeaturesApiTest < I18n::TestCase
|
11
|
-
class Backend < I18n::Backend::Simple
|
12
|
-
include I18n::Backend::Metadata
|
13
|
-
include I18n::Backend::Cache
|
14
|
-
include I18n::Backend::Cascade
|
15
|
-
include I18n::Backend::Fallbacks
|
16
|
-
include I18n::Backend::Pluralization
|
17
|
-
include I18n::Backend::Memoize
|
18
|
-
end
|
19
|
-
|
20
|
-
def setup
|
21
|
-
I18n.backend = I18n::Backend::Chain.new(Backend.new, I18n::Backend::Simple.new)
|
22
|
-
I18n.cache_store = cache_store
|
23
|
-
super
|
24
|
-
end
|
25
|
-
|
26
|
-
def teardown
|
27
|
-
I18n.cache_store.clear if I18n.cache_store
|
28
|
-
I18n.cache_store = nil
|
29
|
-
super
|
30
|
-
end
|
31
|
-
|
32
|
-
def cache_store
|
33
|
-
ActiveSupport::Cache.lookup_store(:memory_store) if cache_available?
|
34
|
-
end
|
35
|
-
|
36
|
-
def cache_available?
|
37
|
-
defined?(ActiveSupport) && defined?(ActiveSupport::Cache)
|
38
|
-
end
|
39
|
-
|
40
|
-
include I18n::Tests::Basics
|
41
|
-
include I18n::Tests::Defaults
|
42
|
-
include I18n::Tests::Interpolation
|
43
|
-
include I18n::Tests::Link
|
44
|
-
include I18n::Tests::Lookup
|
45
|
-
include I18n::Tests::Pluralization
|
46
|
-
include I18n::Tests::Procs
|
47
|
-
include I18n::Tests::Localization::Date
|
48
|
-
include I18n::Tests::Localization::DateTime
|
49
|
-
include I18n::Tests::Localization::Time
|
50
|
-
include I18n::Tests::Localization::Procs
|
51
|
-
|
52
|
-
test "make sure we use a Chain backend with an all features backend" do
|
53
|
-
assert_equal I18n::Backend::Chain, I18n.backend.class
|
54
|
-
assert_equal Backend, I18n.backend.backends.first.class
|
55
|
-
end
|
56
|
-
|
57
|
-
# links: test that keys stored on one backend can link to keys stored on another backend
|
58
|
-
end
|
data/test/api/cascade_test.rb
DELETED
@@ -1,28 +0,0 @@
|
|
1
|
-
require 'test_helper'
|
2
|
-
|
3
|
-
class I18nCascadeApiTest < I18n::TestCase
|
4
|
-
class Backend < I18n::Backend::Simple
|
5
|
-
include I18n::Backend::Cascade
|
6
|
-
end
|
7
|
-
|
8
|
-
def setup
|
9
|
-
I18n.backend = Backend.new
|
10
|
-
super
|
11
|
-
end
|
12
|
-
|
13
|
-
include I18n::Tests::Basics
|
14
|
-
include I18n::Tests::Defaults
|
15
|
-
include I18n::Tests::Interpolation
|
16
|
-
include I18n::Tests::Link
|
17
|
-
include I18n::Tests::Lookup
|
18
|
-
include I18n::Tests::Pluralization
|
19
|
-
include I18n::Tests::Procs
|
20
|
-
include I18n::Tests::Localization::Date
|
21
|
-
include I18n::Tests::Localization::DateTime
|
22
|
-
include I18n::Tests::Localization::Time
|
23
|
-
include I18n::Tests::Localization::Procs
|
24
|
-
|
25
|
-
test "make sure we use a backend with Cascade included" do
|
26
|
-
assert_equal Backend, I18n.backend.class
|
27
|
-
end
|
28
|
-
end
|
data/test/api/chain_test.rb
DELETED
@@ -1,24 +0,0 @@
|
|
1
|
-
require 'test_helper'
|
2
|
-
|
3
|
-
class I18nApiChainTest < I18n::TestCase
|
4
|
-
def setup
|
5
|
-
super
|
6
|
-
I18n.backend = I18n::Backend::Chain.new(I18n::Backend::Simple.new, I18n.backend)
|
7
|
-
end
|
8
|
-
|
9
|
-
include I18n::Tests::Basics
|
10
|
-
include I18n::Tests::Defaults
|
11
|
-
include I18n::Tests::Interpolation
|
12
|
-
include I18n::Tests::Link
|
13
|
-
include I18n::Tests::Lookup
|
14
|
-
include I18n::Tests::Pluralization
|
15
|
-
include I18n::Tests::Procs
|
16
|
-
include I18n::Tests::Localization::Date
|
17
|
-
include I18n::Tests::Localization::DateTime
|
18
|
-
include I18n::Tests::Localization::Time
|
19
|
-
include I18n::Tests::Localization::Procs
|
20
|
-
|
21
|
-
test "make sure we use the Chain backend" do
|
22
|
-
assert_equal I18n::Backend::Chain, I18n.backend.class
|
23
|
-
end
|
24
|
-
end
|
data/test/api/fallbacks_test.rb
DELETED
@@ -1,30 +0,0 @@
|
|
1
|
-
require 'test_helper'
|
2
|
-
|
3
|
-
class I18nFallbacksApiTest < I18n::TestCase
|
4
|
-
class Backend < I18n::Backend::Simple
|
5
|
-
include I18n::Backend::Fallbacks
|
6
|
-
end
|
7
|
-
|
8
|
-
def setup
|
9
|
-
I18n.backend = Backend.new
|
10
|
-
super
|
11
|
-
end
|
12
|
-
|
13
|
-
include I18n::Tests::Basics
|
14
|
-
include I18n::Tests::Defaults
|
15
|
-
include I18n::Tests::Interpolation
|
16
|
-
include I18n::Tests::Link
|
17
|
-
include I18n::Tests::Lookup
|
18
|
-
include I18n::Tests::Pluralization
|
19
|
-
include I18n::Tests::Procs
|
20
|
-
include I18n::Tests::Localization::Date
|
21
|
-
include I18n::Tests::Localization::DateTime
|
22
|
-
include I18n::Tests::Localization::Time
|
23
|
-
include I18n::Tests::Localization::Procs
|
24
|
-
|
25
|
-
test "make sure we use a backend with Fallbacks included" do
|
26
|
-
assert_equal Backend, I18n.backend.class
|
27
|
-
end
|
28
|
-
|
29
|
-
# links: test that keys stored on one backend can link to keys stored on another backend
|
30
|
-
end
|
data/test/api/key_value_test.rb
DELETED
@@ -1,24 +0,0 @@
|
|
1
|
-
require 'test_helper'
|
2
|
-
|
3
|
-
class I18nKeyValueApiTest < I18n::TestCase
|
4
|
-
include I18n::Tests::Basics
|
5
|
-
include I18n::Tests::Defaults
|
6
|
-
include I18n::Tests::Interpolation
|
7
|
-
include I18n::Tests::Link
|
8
|
-
include I18n::Tests::Lookup
|
9
|
-
include I18n::Tests::Pluralization
|
10
|
-
# include Tests::Api::Procs
|
11
|
-
include I18n::Tests::Localization::Date
|
12
|
-
include I18n::Tests::Localization::DateTime
|
13
|
-
include I18n::Tests::Localization::Time
|
14
|
-
# include Tests::Api::Localization::Procs
|
15
|
-
|
16
|
-
def setup
|
17
|
-
I18n.backend = I18n::Backend::KeyValue.new({})
|
18
|
-
super
|
19
|
-
end
|
20
|
-
|
21
|
-
test "make sure we use the KeyValue backend" do
|
22
|
-
assert_equal I18n::Backend::KeyValue, I18n.backend.class
|
23
|
-
end
|
24
|
-
end if I18n::TestCase.key_value?
|