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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: ffdece5f603640ee9d91afeb285083b5d6c069a5
4
- data.tar.gz: 0cf0d219ccc84e0b0f78694fac2280b8f1527f70
3
+ metadata.gz: 1e92569acda830248647c0a632260bcc00af8734
4
+ data.tar.gz: ec8c30058fbdd2eaf40e5b99abb1cff201ad9327
5
5
  SHA512:
6
- metadata.gz: bf289e23781bd7d4e6a218fc7c103852f52b11404d0d645bb26d029303476b9c8cd61fe658ae0da6fde04e73e12bc5c16b225863e40995345dbb819595b66431
7
- data.tar.gz: 3e005b6e0e72eefe6be2b71fa8a429de4adf9668dba56273939835822127116aa8932ab31f4050761ebfaca64da4a14ffa36690d0e17e7a43ed437ef3c8918d9
6
+ metadata.gz: 3437a07b6c8e9aacfb62ee32ef4685e83d865c6873db1ef4c3b6d51573edb3a27121da1e9b492f2e06ac1afef718bbfb11667ddf2c96f6b63d6817fecf47177d
7
+ data.tar.gz: b09e2edfda10a52141f4c80756990400d520b316794d042e25b6566c49f8f19c374018bd922a17766084c651eacd8c40a9a4712e4ac6710589a72b319514a17b
@@ -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 = application.language(locale.to_s).translate(convert_to_tml(default_key), options, options)
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 = application.language(locale.to_s).translate(convert_to_tml(value), options, options)
85
+ value = target_language.translate(convert_to_tml(value), options, options)
78
86
  end
79
87
  translated_key[key] = value
80
88
  end
@@ -30,5 +30,5 @@
30
30
  #++
31
31
 
32
32
  module TmlRails
33
- VERSION = '5.4.2'
33
+ VERSION = '5.4.3'
34
34
  end
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.2
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-03-31 00:00:00.000000000 Z
11
+ date: 2016-05-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails