localeapp 2.4.0 → 2.5.0

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
  SHA1:
3
- metadata.gz: 49934a232ff496462c5acf3466e26a4c7e420fcd
4
- data.tar.gz: 45b94a7e5ae24ef7d2d3bf75dca90f9dd121fd25
3
+ metadata.gz: 43785b36844af9847b8326daab04090d1ab40d49
4
+ data.tar.gz: 7156df0e8530172294d41302b545d34c2b4ed2a3
5
5
  SHA512:
6
- metadata.gz: b852479fc11e37c471f74506fc9a4db112103c4235db72509bf9bdbf503780122d7450bccab5700653295e9abbb18a2f082cd0b6bd5d87f07ea38cee1f06ecf2
7
- data.tar.gz: d0ab7261a4d75727089ac38d3713a6581a6f036f7e9cb11baed510b815f4b37a8191a93a490094822164855518e20ba12c6aa362fa8fab301b11e309db95d455
6
+ metadata.gz: ca9c2892df8e20e6492885c65bfc479ca577af7a83e91e8a512fe87623c24f80168a9d9e1cd344ca3242614403ba326d1ff9ae107a0a6c9b46acb3a6a428d16d
7
+ data.tar.gz: b01a5cd563aafbdfd3e235a0eeb0a7ccb8ca433a79b4019f8d246eb229e3c709b552a1a24fc29b1bb107dd9210f4b43ca860b4474d5a1ec405684cd12e304498
data/.travis.yml CHANGED
@@ -3,11 +3,12 @@ dist: trusty
3
3
  before_install:
4
4
  - gem install bundler
5
5
  rvm:
6
- - 2.4.1
7
- - 2.3.4
8
- - 2.2.7
6
+ - 2.5.0
7
+ - 2.4.3
8
+ - 2.3.6
9
+ - 2.2.9
9
10
  - 2.1.10
10
- - jruby
11
+ - jruby-9.1.15.0
11
12
  gemfile:
12
13
  - Gemfile
13
14
  - gemfiles/i18n_0.4.gemfile
data/CHANGELOG.md CHANGED
@@ -1,5 +1,10 @@
1
1
  # master
2
2
 
3
+ # Version 2.5.0
4
+
5
+ * Show fully-scoped keys in `ExceptionHandler` log messages (thanks to @leonhooijer)
6
+ * Don't force raising an exception for blacklisted keys (thanks to @leonhooijer)
7
+
3
8
  # Version 2.4.0
4
9
 
5
10
  * Support pulling of single locales
@@ -2,16 +2,17 @@ module Localeapp
2
2
  class ExceptionHandler
3
3
  def self.call(exception, locale, key_or_keys, options)
4
4
  keys = Array(key_or_keys).map { |key| ERB::Util.html_escape(key.to_s) }
5
+ scoped_keys = keys.map { |key| [options[:scope], key].compact.join(".") }
5
6
  Localeapp.log(exception.message)
6
7
  # Which exact exception is set up by our i18n shims
7
8
  if exception.is_a? Localeapp::I18nMissingTranslationException
8
- Localeapp.log("Detected missing translation for key(s) #{keys.inspect}")
9
+ Localeapp.log("Detected missing translation for key(s) #{scoped_keys.inspect}")
9
10
 
10
11
  keys.each do |key|
11
12
  Localeapp.missing_translations.add(locale, key, nil, options || {})
12
13
  end
13
14
 
14
- [locale, keys].join(', ')
15
+ [locale, scoped_keys].join(', ')
15
16
  else
16
17
  Localeapp.log('Raising exception')
17
18
  raise
@@ -14,7 +14,11 @@
14
14
  module Localeapp
15
15
  module ForceExceptionHandlerInTranslationHelper
16
16
  def translate(key, options = {})
17
- super(key, {:raise => false}.merge(options))
17
+ if [options[:scope], key].compact.join(".").match?(Localeapp.configuration.blacklisted_keys_pattern)
18
+ super(key, options)
19
+ else
20
+ super(key, {:raise => false}.merge(options))
21
+ end
18
22
  end
19
23
  alias :t :translate
20
24
  end
@@ -1,3 +1,3 @@
1
1
  module Localeapp
2
- VERSION = "2.4.0"
2
+ VERSION = "2.5.0"
3
3
  end
@@ -46,4 +46,9 @@ describe Localeapp::ExceptionHandler, '#call(exception, locale, key, options)' d
46
46
  Localeapp::ExceptionHandler.call(exception, :en, 'foo', {})
47
47
  }.to_not raise_error
48
48
  end
49
+
50
+ it "handles the scope option" do
51
+ expect(I18n.t('foo.bar', scope: 'scoped')).to eq 'en, scoped.foo.bar'
52
+ expect(I18n.t(%w{foo.bar foo.baz}, scope: 'scoped')).to eq 'en, scoped.foo.bar, scoped.foo.baz'
53
+ end
49
54
  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: 2.4.0
4
+ version: 2.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Christopher Dell
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2017-08-29 00:00:00.000000000 Z
13
+ date: 2018-03-09 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: i18n
@@ -302,7 +302,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
302
302
  version: '0'
303
303
  requirements: []
304
304
  rubyforge_project: localeapp
305
- rubygems_version: 2.6.12
305
+ rubygems_version: 2.5.2.1
306
306
  signing_key:
307
307
  specification_version: 4
308
308
  summary: Easy i18n translation management with localeapp.com