i18nliner 0.2.1 → 0.2.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/i18nliner/extensions/controller.rb +1 -1
- data/lib/i18nliner/extensions/core.rb +5 -4
- data/lib/i18nliner/extensions/model.rb +1 -1
- data/lib/i18nliner/extensions/view.rb +1 -1
- data/spec/extensions/controller_spec.rb +1 -1
- data/spec/extensions/core_spec.rb +12 -4
- data/spec/extensions/view_spec.rb +2 -2
- metadata +16 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bbb90fe50e15cd800c8fe6266435e6ad65da7f403939cbf619c866b843b6792e
|
4
|
+
data.tar.gz: cf1778863ed5faf6346c491162c90acd52c0e51e4efda4a114bbd13e99f04ed7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 74400054da78cccfd58e5a54eb452bf46b79464ea2d398536acb62ff37cbba84b044c757cbf45c0950ab22f493dd3d0ac018613a6bcc66e2d40bcca34b36e507
|
7
|
+
data.tar.gz: 05fddfa85858798700910737ba60e57e0e8da23605792fa6e822ce6ef524f5a98e41fb22face1ad9aed57f4ef9da7d1f0db797898273ffdf4ac71ac33de03dd5
|
@@ -13,7 +13,7 @@ module I18nliner
|
|
13
13
|
key, options = CallHelpers.infer_arguments(args)
|
14
14
|
options = inferpolate(options) if I18nliner.infer_interpolation_values
|
15
15
|
options[:i18nliner_scope] = i18nliner_scope
|
16
|
-
super(key, options)
|
16
|
+
super(key, **options)
|
17
17
|
end
|
18
18
|
alias :t :translate
|
19
19
|
alias :t! :translate
|
@@ -17,14 +17,15 @@ module I18nliner
|
|
17
17
|
end
|
18
18
|
|
19
19
|
wrappers = options.delete(:wrappers) || options.delete(:wrapper)
|
20
|
-
result = super(key, options)
|
20
|
+
result = super(key, **options)
|
21
21
|
|
22
|
-
#
|
23
|
-
|
24
|
-
return result if result.nil? || result.instance_of?(Object)
|
22
|
+
# Exit now unless we have a string or a thing that delegates to a string
|
23
|
+
return result unless result.respond_to?(:gsub)
|
25
24
|
|
25
|
+
was_html_safe = result.html_safe?
|
26
26
|
# If you are actually using nonprintable characters in your source string, you should feel ashamed
|
27
27
|
result = result.gsub("\\\\", "\uE124").gsub("\\*", "\uE123")
|
28
|
+
result = result.html_safe if was_html_safe
|
28
29
|
if wrappers
|
29
30
|
result = apply_wrappers(result, wrappers)
|
30
31
|
end
|
@@ -13,7 +13,7 @@ module I18nliner
|
|
13
13
|
key, options = CallHelpers.infer_arguments(args)
|
14
14
|
options = inferpolate(options) if I18nliner.infer_interpolation_values
|
15
15
|
options[:i18nliner_scope] = i18nliner_scope
|
16
|
-
I18n.translate(key, options)
|
16
|
+
I18n.translate(key, **options)
|
17
17
|
end
|
18
18
|
alias :t :translate
|
19
19
|
alias :t! :translate
|
@@ -17,7 +17,7 @@ module I18nliner
|
|
17
17
|
key, options = CallHelpers.infer_arguments(args)
|
18
18
|
options = inferpolate(options) if I18nliner.infer_interpolation_values
|
19
19
|
options[:i18nliner_scope] = i18nliner_scope
|
20
|
-
super(key, options)
|
20
|
+
super(key, **options)
|
21
21
|
rescue ArgumentError
|
22
22
|
raise
|
23
23
|
end
|
@@ -5,11 +5,15 @@ describe I18nliner::Extensions::Core do
|
|
5
5
|
let(:i18n) do
|
6
6
|
Module.new do
|
7
7
|
extend(Module.new do
|
8
|
-
def translate(
|
9
|
-
|
8
|
+
def translate(key, **options)
|
9
|
+
if RUBY_VERSION >= '3.0'
|
10
|
+
simple_translate(key, **options)
|
11
|
+
else
|
12
|
+
simple_translate(key, options)
|
13
|
+
end
|
10
14
|
end
|
11
15
|
|
12
|
-
def simple_translate(key, options)
|
16
|
+
def simple_translate(key, **options)
|
13
17
|
string = options.delete(:default)
|
14
18
|
interpolate_hash(string, options)
|
15
19
|
end
|
@@ -48,7 +52,11 @@ describe I18nliner::Extensions::Core do
|
|
48
52
|
end
|
49
53
|
|
50
54
|
it "should stringify array keys, but not the array itself" do
|
51
|
-
|
55
|
+
if RUBY_VERSION >= '3.0'
|
56
|
+
expect(i18n).to receive(:simple_translate).with(["bar", "baz"])
|
57
|
+
else
|
58
|
+
expect(i18n).to receive(:simple_translate).with(["bar", "baz"], {})
|
59
|
+
end
|
52
60
|
i18n.translate([:bar, :baz])
|
53
61
|
end
|
54
62
|
|
@@ -6,9 +6,9 @@ describe I18nliner::Extensions::View do
|
|
6
6
|
let(:i18n) do
|
7
7
|
Module.new do
|
8
8
|
extend(Module.new do
|
9
|
-
def translate(key, options)
|
9
|
+
def translate(key, **options)
|
10
10
|
options.delete(:i18nliner_inferred_key)
|
11
|
-
I18n.translate(key, options)
|
11
|
+
I18n.translate(key, **options)
|
12
12
|
end
|
13
13
|
end)
|
14
14
|
extend I18nliner::Extensions::View
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: i18nliner
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jon Jensen
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2023-03-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -24,6 +24,20 @@ dependencies:
|
|
24
24
|
- - ">="
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '6.0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: i18n
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: 1.8.6
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: 1.8.6
|
27
41
|
- !ruby/object:Gem::Dependency
|
28
42
|
name: ruby_parser
|
29
43
|
requirement: !ruby/object:Gem::Requirement
|