translation_engine 0.0.3 → 0.0.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/models/translation_engine/backend.rb +17 -7
- data/lib/translation_engine/version.rb +1 -1
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 498b874a47bd3849b2b910180113ddbce2bdecaf
|
4
|
+
data.tar.gz: fc2622bab03ff94006fa2c3a970a05a58834ff68
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b52e523013ea5d167280451c3b0d4b86a27b4a7ddff708ce00f8f9631448b6a3b9614e66ad4849ba70e3aa6eacec69bae7767dddb66677326c724c879f6c623d
|
7
|
+
data.tar.gz: 5d178901b241444101fd1d705e74a431a9a99db90e2113e2b9e21fe98a6b4a078fbb202e9f629c795140d88d6e00be1c17c99fb2fdc24ce6181e28b3037e7291
|
@@ -50,14 +50,24 @@ class TranslationEngine::Backend < I18n::Backend::Simple
|
|
50
50
|
end
|
51
51
|
end
|
52
52
|
|
53
|
-
def
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
53
|
+
def resolve(locale, object, subject, options = {})
|
54
|
+
return subject if options[:resolve] == false
|
55
|
+
|
56
|
+
result = catch(:exception) do
|
57
|
+
case subject
|
58
|
+
when Symbol
|
59
|
+
I18n.translate(subject, options.merge(:locale => locale, :throw => true))
|
60
|
+
when Proc
|
61
|
+
date_or_time = options.delete(:object) || object
|
62
|
+
resolve(locale, object, subject.call(date_or_time, options))
|
63
|
+
when nil
|
64
|
+
nil
|
65
|
+
else
|
66
|
+
keys = I18n.normalize_keys(locale, object, options[:scope], options[:separator])
|
67
|
+
enhance_translation(subject, keys)
|
68
|
+
end
|
60
69
|
end
|
70
|
+
result unless result.is_a?(I18n::MissingTranslation)
|
61
71
|
end
|
62
72
|
|
63
73
|
def enhance_translation(value, main_keys, catch_translation = true)
|
metadata
CHANGED
@@ -1,27 +1,27 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: translation_engine
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ondrej Bartas
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2017-01-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- - "
|
17
|
+
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
19
|
version: 4.2.0
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- - "
|
24
|
+
- - ">="
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: 4.2.0
|
27
27
|
- !ruby/object:Gem::Dependency
|