r18n-core 2.1.5 → 2.1.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/ChangeLog.md +4 -0
- data/lib/r18n-core/translated_string.rb +3 -5
- data/lib/r18n-core/translation.rb +1 -1
- data/lib/r18n-core/version.rb +1 -1
- data/spec/translation_spec.rb +15 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d01ca11bf73f68b371d98508755f5fcbd8360290
|
4
|
+
data.tar.gz: 32074b227246a93c6ff71f5748ab4914c8f50285
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ecba6af5cf4a56c6c1b42895c66e258f1f03bea79dc2aa9545289c43fe76d2cc87c8e7d49dff796529fb9f1ff70fb86d74d62279caef66dee32ee1bc2232c72f
|
7
|
+
data.tar.gz: 7592e2e32e74a06d8a6db4383c97ddaa83813c52ac53dec5190f6cc8f715d47ad72e99a2b1aac70b6a52500eb31331d5e242589bfc9256e02ad96b6d6a72ccd9
|
data/ChangeLog.md
CHANGED
@@ -29,11 +29,9 @@ module R18n
|
|
29
29
|
# Returns a new string object containing a copy of +str+, which translated
|
30
30
|
# for +path+ to +locale+
|
31
31
|
def initialize(value, locale, path, filters = nil)
|
32
|
-
value
|
33
|
-
super(value)
|
32
|
+
super(value.to_s)
|
34
33
|
@filters = filters
|
35
34
|
@locale = locale
|
36
|
-
@value = value
|
37
35
|
@path = path
|
38
36
|
end
|
39
37
|
|
@@ -55,9 +53,9 @@ module R18n
|
|
55
53
|
# Override to_s to make string html safe if `html_safe` method is defined.
|
56
54
|
def to_s
|
57
55
|
if respond_to? :html_safe
|
58
|
-
|
56
|
+
super.html_safe
|
59
57
|
else
|
60
|
-
|
58
|
+
String.new(super)
|
61
59
|
end
|
62
60
|
end
|
63
61
|
|
@@ -93,7 +93,7 @@ module R18n
|
|
93
93
|
when String
|
94
94
|
c = { locale: locale, path: path }
|
95
95
|
v = @filters.process_string(:passive, value, c, [])
|
96
|
-
value = TranslatedString.new(v, locale, path, @
|
96
|
+
value = TranslatedString.new(v, locale, path, @filters)
|
97
97
|
when Typed
|
98
98
|
value.locale = locale
|
99
99
|
value.path = path
|
data/lib/r18n-core/version.rb
CHANGED
data/spec/translation_spec.rb
CHANGED
@@ -18,6 +18,21 @@ describe R18n::Translation do
|
|
18
18
|
expect(i18n.one | 'default').to eq('One')
|
19
19
|
end
|
20
20
|
|
21
|
+
it "returns strings which can be used as normal strings" do
|
22
|
+
i18n = R18n::I18n.new('en', DIR)
|
23
|
+
expect(i18n.not.exists).not_to be_translated
|
24
|
+
expect(i18n.not.exists.to_s).to be_kind_of(String)
|
25
|
+
expect(i18n.not.exists.to_s.split.first).to be_kind_of(String)
|
26
|
+
expect(i18n.not.exists.to_s.split.first.to_s).to be_kind_of(String)
|
27
|
+
|
28
|
+
expect(i18n.one).to be_translated
|
29
|
+
expect(i18n.one.to_s).to be_kind_of(String)
|
30
|
+
expect(i18n.one.to_s.split.first).to be_kind_of(String)
|
31
|
+
expect(i18n.one.to_s.split.first.to_s).to be_kind_of(String)
|
32
|
+
expect(i18n.one.split.first).to be_kind_of(String)
|
33
|
+
expect(i18n.one.split.first.to_s).to be_kind_of(String)
|
34
|
+
end
|
35
|
+
|
21
36
|
it "returns html escaped string" do
|
22
37
|
klass = Class.new(R18n::TranslatedString) do
|
23
38
|
def html_safe
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: r18n-core
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.1.
|
4
|
+
version: 2.1.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Andrey Sitnik
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-
|
11
|
+
date: 2017-05-20 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: |2
|
14
14
|
R18n is a i18n tool to translate your Ruby application.
|