localeapp 0.9.1 → 0.9.2

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.
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- ZGIyOGI1YTRjMGJmMWE1ODRiMDgwNGNlZThkZWQ0MmE0ZjQ3Njk1Yw==
4
+ YmRiNmFlOWYwMjMxZTNlMzExOTBhYTNhZTE5NzUzOTU1ZGRhNTBhYQ==
5
5
  data.tar.gz: !binary |-
6
- MmRjMTRkMzI5MGFiMDA1NDBkY2I2ODk1MjRlZTc5MjBkNWRkMzE4OA==
6
+ MjM5YmZmYjdkMjIzOGQ1NDZhYjFjNTQ5NGI5OTk4YWZkNTI5NzYwOQ==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- Nzg5ODJhNjUzYTFkOTU0ZGNiMTA1Mjk1YzI3MzBkYjUzZGVmZDM1YWVlZTBi
10
- NmFhNjNkYjc1ZGQ1YzliNDQxZGU2YjVjZTBiNzc3YTNiMTAwNjVkMDQ4YjZl
11
- MWYyOWJmYzVhYjBkYzVhZmUxODY0NjVjYmM1OTBlNmI0OTNiNjU=
9
+ YmZmMTZiYmE4YTZhODgxOGIzNjkxZjAxNjU5ZDgwOGY0ZTdjMTE1ODg1NmIw
10
+ MGZhMjQ4M2VlYjIwZjM3YmFhMDQ5OGM5MzM0OTZlODI5NTcwZTNiNjg2Y2I4
11
+ NDkzMTFkODUwZTg3MTU4NTBjMGE5NmU0YjJhYmJiODJjMTVmYjc=
12
12
  data.tar.gz: !binary |-
13
- N2NlMDQzZjhmMDVhNjc0YzJiNDhkY2Q4MjJlYWU0ZDIwMWE4ZTA0NWMzM2Rk
14
- ZjcxMTVmNjhjNTUyODFiNGY3MTUxMTU3MGE3MzljZDYyYTBhYTBhY2ZkNjcz
15
- YTY2MWJjNzllMWVlMzBkZTQ1YjBlMjQ5MmM0MTg2NWNlNzMxZmU=
13
+ ZmJmYTkxYTEwZGRkNDQyYjUzZmViYTg3YjIyYzdkMDg5OGNiOTBlNTAwM2Qx
14
+ NGYzODljYzE0ODY3Yzc2MWJjMjQ1ZTM3MzkzYTViMWU3MTlkOGFhYjk1MDcw
15
+ NDRkNzczZmRkNDNhODFjYTVhMTVlZDNkZTE4NGNkMjExMmI3Yjg=
data/CHANGELOG.md CHANGED
@@ -1,5 +1,10 @@
1
1
  # master
2
2
 
3
+ # Version 0.9.2
4
+
5
+ * Refactor which monkeypatch/backported-bugfix is loaded for which Rails version
6
+ * Hotfix a regression where calling `I18n.t(nil)` would end up in a an error in MimicRailsMissingTranslationDisplay
7
+
3
8
  # Version 0.9.1
4
9
 
5
10
  * Fix Rails 4.1 TranslationHelper regression
@@ -1,6 +1,6 @@
1
1
  # We're replacing the original method with one that doesn't always override the :raise option.
2
- # This bug was introduced in Rails here (4.1.0.rc1): https://github.com/rails/rails/pull/13832
3
- # and fixed here: https://github.com/rails/rails/pull/17676
2
+ # This bug was introduced in Rails here (4.0.10.rc1, 4.1.0.rc1 and 4.2.0.beta1): https://github.com/rails/rails/pull/13832
3
+ # and fixed here (4.1.10.rc1 and 4.2.1.rc1): https://github.com/rails/rails/pull/17676 (thus, this is simply a backport of the bugfix)
4
4
 
5
5
  module Localeapp::TranslationHelperRails41MonkeyPatch
6
6
  # Delegates to <tt>I18n#translate</tt> but also performs three additional functions.
@@ -12,7 +12,8 @@ module Localeapp
12
12
  alias :old_rails_call :call
13
13
  def call(exception, locale, key, options)
14
14
  locale, key = old_rails_call(exception, locale, key, options).split(', ')
15
- "<span class=\"translation_missing\" title=\"translation missing: #{locale}.#{key}\">#{key.titleize}</span>".html_safe
15
+ keys = I18n.normalize_keys(locale, key, options[:scope])
16
+ "<span class=\"translation_missing localeapp\" title=\"translation missing: #{keys.join('.')}\">#{keys.last.to_s.titleize}</span>".html_safe
16
17
  end
17
18
 
18
19
  end
@@ -10,11 +10,15 @@ module Localeapp
10
10
  require 'localeapp/rails/2_3_translation_helper_monkeypatch'
11
11
  end
12
12
 
13
- if rails_version_matches_any? '~> 4.1.0.rc1', '~> 4.2.0.beta1' # i.e. between https://github.com/rails/rails/commit/d57ce232a885b21e1d6d1f9fbf60bc5908ad880d and https://github.com/rails/rails/commit/4dbce79e95e3f56a9b48992dea4531493a5008cc
14
- require 'localeapp/rails/4_1_translation_helper_monkeypatch'
13
+ # match all versions between https://github.com/rails/rails/commit/d57ce232a885b21e1d6d1f9fbf60bc5908ad880d and https://github.com/rails/rails/commit/4dbce79e95e3f56a9b48992dea4531493a5008cc on all branches
14
+ if rails_version_matches_all?('~> 4.0.10.rc1') |
15
+ rails_version_matches_all?('~> 4.1.0.rc1', '< 4.1.10.rc1') |
16
+ rails_version_matches_all?('~> 4.2.0.beta1', '< 4.2.1.rc1')
17
+ require 'localeapp/rails/backport_translation_helper_fix_to_honor_raise_option'
15
18
  end
16
19
 
17
- if rails_version_matches_any? '~> 3.2.16', '>= 4.0.2' # ie: after CVE-2013-4491 patch (https://github.com/rails/rails/commit/78790e4bceedc632cb40f9597792d7e27234138a)
20
+ # match all versions after CVE-2013-4491 patch (https://github.com/rails/rails/commit/78790e4bceedc632cb40f9597792d7e27234138a)
21
+ if rails_version_matches_any? '~> 3.2.16', '>= 4.0.2'
18
22
  require 'localeapp/rails/mimic_rails_missing_translation_display'
19
23
  require 'localeapp/rails/force_exception_handler_in_translation_helper'
20
24
  end
@@ -72,6 +76,10 @@ module Localeapp
72
76
  requirements.map{ |r| rails_version_matches?(r) }.reduce(:|)
73
77
  end
74
78
 
79
+ def self.rails_version_matches_all?(*requirements)
80
+ requirements.map{ |r| rails_version_matches?(r) }.reduce(:&)
81
+ end
82
+
75
83
  end
76
84
  end
77
85
 
@@ -1,3 +1,3 @@
1
1
  module Localeapp
2
- VERSION = '0.9.1'
2
+ VERSION = '0.9.2'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: localeapp
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.1
4
+ version: 0.9.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Christopher Dell
@@ -253,7 +253,7 @@ files:
253
253
  - lib/localeapp/poller.rb
254
254
  - lib/localeapp/rails.rb
255
255
  - lib/localeapp/rails/2_3_translation_helper_monkeypatch.rb
256
- - lib/localeapp/rails/4_1_translation_helper_monkeypatch.rb
256
+ - lib/localeapp/rails/backport_translation_helper_fix_to_honor_raise_option.rb
257
257
  - lib/localeapp/rails/controller.rb
258
258
  - lib/localeapp/rails/flatten.rb
259
259
  - lib/localeapp/rails/force_exception_handler_in_translation_helper.rb