localeapp 2.4.0 → 2.5.0
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,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 43785b36844af9847b8326daab04090d1ab40d49
|
4
|
+
data.tar.gz: 7156df0e8530172294d41302b545d34c2b4ed2a3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ca9c2892df8e20e6492885c65bfc479ca577af7a83e91e8a512fe87623c24f80168a9d9e1cd344ca3242614403ba326d1ff9ae107a0a6c9b46acb3a6a428d16d
|
7
|
+
data.tar.gz: b01a5cd563aafbdfd3e235a0eeb0a7ccb8ca433a79b4019f8d246eb229e3c709b552a1a24fc29b1bb107dd9210f4b43ca860b4474d5a1ec405684cd12e304498
|
data/.travis.yml
CHANGED
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) #{
|
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,
|
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
|
-
|
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
|
data/lib/localeapp/version.rb
CHANGED
@@ -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
|
+
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:
|
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.
|
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
|