tml-rails 5.4.2 → 5.4.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/i18n/backend/tml.rb +10 -2
- data/lib/tml_rails/version.rb +1 -1
- 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: 1e92569acda830248647c0a632260bcc00af8734
|
4
|
+
data.tar.gz: ec8c30058fbdd2eaf40e5b99abb1cff201ad9327
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3437a07b6c8e9aacfb62ee32ef4685e83d865c6873db1ef4c3b6d51573edb3a27121da1e9b492f2e06ac1afef718bbfb11667ddf2c96f6b63d6817fecf47177d
|
7
|
+
data.tar.gz: b09e2edfda10a52141f4c80756990400d520b316794d042e25b6566c49f8f19c374018bd922a17766084c651eacd8c40a9a4712e4ac6710589a72b319514a17b
|
data/lib/i18n/backend/tml.rb
CHANGED
@@ -64,17 +64,25 @@ module I18n
|
|
64
64
|
return super(locale, key, scope, options)
|
65
65
|
end
|
66
66
|
|
67
|
+
# if language is not available, return default value
|
68
|
+
target_language = application.language(locale.to_s)
|
69
|
+
target_language ||= application.language(application.default_locale)
|
70
|
+
|
71
|
+
unless target_language
|
72
|
+
return super(locale, key, scope, options)
|
73
|
+
end
|
74
|
+
|
67
75
|
default_key = super(application.default_locale, key, scope, options)
|
68
76
|
default_key ||= key.to_s.split('.').last.gsub('_', ' ').capitalize
|
69
77
|
|
70
78
|
if default_key.is_a?(String)
|
71
|
-
translated_key =
|
79
|
+
translated_key = target_language.translate(convert_to_tml(default_key), options, options)
|
72
80
|
elsif default_key.is_a?(Hash)
|
73
81
|
translated_key = {}
|
74
82
|
|
75
83
|
default_key.each do |key, value|
|
76
84
|
if value.is_a?(String)
|
77
|
-
value =
|
85
|
+
value = target_language.translate(convert_to_tml(value), options, options)
|
78
86
|
end
|
79
87
|
translated_key[key] = value
|
80
88
|
end
|
data/lib/tml_rails/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: tml-rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 5.4.
|
4
|
+
version: 5.4.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Michael Berkovich
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-05-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|