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: 0d646844321b8093342808d2236c5bdeb7cab8acfd6dadfc5805cd86171e06e9
4
- data.tar.gz: 0451ea713d51379dfc533270df3a4a3592f4b515e2c9f17423b59483850112e0
3
+ metadata.gz: 2348183814afaccf956b0fca212618a45c0316219912e3ac0f081fda05d401b9
4
+ data.tar.gz: 17f5677585fbf70e5254f0efa6886c7a32cfb209bb807468f3458959adc9279d
5
5
  SHA512:
6
- metadata.gz: cd930f58a5ab2a8292f271184c660cc3cfd371ac3f4f3f332433484c6738f5ee6dba839401b5d315c3839a54e27eb3011ebdf0bfd39d34bf4a49f54671dda0c5
7
- data.tar.gz: 289d8702cb7d60ca1d34d047a4015fb2cb0e2e5ca3fb06d0e1df71e39b9ac6558c7a00ad416740be79b41ea279f4c62d6144cc06e7191ffe532562d10c7b5751
6
+ metadata.gz: 2e25cdc6a5e6579e47b2f839be9ccca59545204e5ca0babeba71da769704a8646445670930c4f33a251edcd9c1818dff4dc95a59924201af38245b45498893b0
7
+ data.tar.gz: 9391658536ef011c92674280587f308c479b2377b49707e5d25f2dd26a90e48bbc9cbb9c15ece1076f32ed715c7f5be565ec812f19fc4bb0dc93e4b702328a79
@@ -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)
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module I18n
4
- VERSION = "1.5.2"
4
+ VERSION = "1.5.3"
5
5
  end
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.2
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-14 00:00:00.000000000 Z
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