i18n 1.5.2 → 1.5.3
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2348183814afaccf956b0fca212618a45c0316219912e3ac0f081fda05d401b9
|
4
|
+
data.tar.gz: 17f5677585fbf70e5254f0efa6886c7a32cfb209bb807468f3458959adc9279d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2e25cdc6a5e6579e47b2f839be9ccca59545204e5ca0babeba71da769704a8646445670930c4f33a251edcd9c1818dff4dc95a59924201af38245b45498893b0
|
7
|
+
data.tar.gz: 9391658536ef011c92674280587f308c479b2377b49707e5d25f2dd26a90e48bbc9cbb9c15ece1076f32ed715c7f5be565ec812f19fc4bb0dc93e4b702328a79
|
data/lib/i18n/backend/base.rb
CHANGED
@@ -250,14 +250,16 @@ module I18n
|
|
250
250
|
def translate_localization_format(locale, object, format, options)
|
251
251
|
format.to_s.gsub(/%[aAbBpP]/) do |match|
|
252
252
|
case match
|
253
|
-
when '%a' then I18n.t(:"date.abbr_day_names", :locale => locale, :format => format)[object.wday]
|
254
|
-
when '%A' then I18n.t(:"date.day_names", :locale => locale, :format => format)[object.wday]
|
255
|
-
when '%b' then I18n.t(:"date.abbr_month_names", :locale => locale, :format => format)[object.mon]
|
256
|
-
when '%B' then I18n.t(:"date.month_names", :locale => locale, :format => format)[object.mon]
|
257
|
-
when '%p' then I18n.t(:"time.#{object.hour < 12 ? :am : :pm}", :locale => locale, :format => format).upcase if object.respond_to? :hour
|
258
|
-
when '%P' then I18n.t(:"time.#{object.hour < 12 ? :am : :pm}", :locale => locale, :format => format).downcase if object.respond_to? :hour
|
253
|
+
when '%a' then I18n.t!(:"date.abbr_day_names", :locale => locale, :format => format)[object.wday]
|
254
|
+
when '%A' then I18n.t!(:"date.day_names", :locale => locale, :format => format)[object.wday]
|
255
|
+
when '%b' then I18n.t!(:"date.abbr_month_names", :locale => locale, :format => format)[object.mon]
|
256
|
+
when '%B' then I18n.t!(:"date.month_names", :locale => locale, :format => format)[object.mon]
|
257
|
+
when '%p' then I18n.t!(:"time.#{object.hour < 12 ? :am : :pm}", :locale => locale, :format => format).upcase if object.respond_to? :hour
|
258
|
+
when '%P' then I18n.t!(:"time.#{object.hour < 12 ? :am : :pm}", :locale => locale, :format => format).downcase if object.respond_to? :hour
|
259
259
|
end
|
260
260
|
end
|
261
|
+
rescue MissingTranslationData => e
|
262
|
+
e.message
|
261
263
|
end
|
262
264
|
|
263
265
|
def pluralization_key(entry, count)
|
@@ -40,6 +40,10 @@ module I18n
|
|
40
40
|
assert_equal 'Mar', I18n.l(@date, :format => '%b', :locale => :de)
|
41
41
|
end
|
42
42
|
|
43
|
+
test "localize Date: given missing translations it returns the correct error message" do
|
44
|
+
assert_equal 'translation missing: fr.date.abbr_month_names', I18n.l(@date, :format => '%b', :locale => :fr)
|
45
|
+
end
|
46
|
+
|
43
47
|
test "localize Date: given an unknown format it does not fail" do
|
44
48
|
assert_nothing_raised { I18n.l(@date, :format => '%x') }
|
45
49
|
end
|
@@ -42,6 +42,10 @@ module I18n
|
|
42
42
|
assert_equal 'Mar', I18n.l(@datetime, :format => '%b', :locale => :de)
|
43
43
|
end
|
44
44
|
|
45
|
+
test "localize DateTime: given missing translations it returns the correct error message" do
|
46
|
+
assert_equal 'translation missing: fr.date.abbr_month_names', I18n.l(@datetime, :format => '%b', :locale => :fr)
|
47
|
+
end
|
48
|
+
|
45
49
|
test "localize DateTime: given a meridian indicator format it returns the correct meridian indicator" do
|
46
50
|
assert_equal 'AM', I18n.l(@datetime, :format => '%p', :locale => :de)
|
47
51
|
assert_equal 'PM', I18n.l(@other_datetime, :format => '%p', :locale => :de)
|
@@ -42,6 +42,10 @@ module I18n
|
|
42
42
|
assert_equal 'Mar', I18n.l(@time, :format => '%b', :locale => :de)
|
43
43
|
end
|
44
44
|
|
45
|
+
test "localize Time: given missing translations it returns the correct error message" do
|
46
|
+
assert_equal 'translation missing: fr.date.abbr_month_names', I18n.l(@time, :format => '%b', :locale => :fr)
|
47
|
+
end
|
48
|
+
|
45
49
|
test "localize Time: given a meridian indicator format it returns the correct meridian indicator" do
|
46
50
|
assert_equal 'AM', I18n.l(@time, :format => '%p', :locale => :de)
|
47
51
|
assert_equal 'PM', I18n.l(@other_time, :format => '%p', :locale => :de)
|
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.5.
|
4
|
+
version: 1.5.3
|
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: 2019-01-
|
16
|
+
date: 2019-01-21 00:00:00.000000000 Z
|
17
17
|
dependencies:
|
18
18
|
- !ruby/object:Gem::Dependency
|
19
19
|
requirement: !ruby/object:Gem::Requirement
|