lost_in_translations 1.4.1 → 1.4.2

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: defec7298964d582430d90ead38dc56afd1c193b
4
- data.tar.gz: 2b1dfb3fd71ef0a6392b9b9b75fe9094950880c6
3
+ metadata.gz: 32e8b3114257ea7a04833848621b662ac170db3e
4
+ data.tar.gz: 70d1fd6bb408f437056bfaaf90c05453e0b2bf78
5
5
  SHA512:
6
- metadata.gz: ff1681c131c0e496a3c835b863c4199ac485ea5920f475ee5e072b95f03ddaa953ec7393377266969561f9f184c5bab47d2c1cb31aceff0137e4e74523281def
7
- data.tar.gz: 4ba37ed6e568ed3b5d314c5bd2aea1dc291847c1a6d19ee6d4fc08058cb865d0e713ef22cf00db855f8dff490358a1e1579e7a0e41fef170f5567bf881a1ba3e
6
+ metadata.gz: 8cadaef4095afee2cafa73aebd6500b2d160e2dd318bea23c2025b60f0c396764b1b9026d826d4ca6fc2c202733acdd13019c1d08270b1f126bbeb06e5c36858
7
+ data.tar.gz: 2b252e278302c01e130e3eb753bdeb9bc3d836e7e396922d940640a073ab7c6b00b12a5cfa1e6f41bf3c0e85de2e64b3205b2acb94e6d5d14d9ae690a7bccce3
@@ -9,7 +9,7 @@ module LostInTranslations
9
9
  def translate(field, locale = I18n.locale)
10
10
  translation = LostInTranslations.translate(self, field, locale)
11
11
 
12
- if translation.nil? && locale.to_sym == I18n.default_locale.to_sym
12
+ if translation.nil? && fallback_to_default_locale(locale)
13
13
  translation = call_original_field(self, field)
14
14
  end
15
15
 
@@ -20,6 +20,11 @@ module LostInTranslations
20
20
  LostInTranslations.assign_translation(self, field, value, locale)
21
21
  end
22
22
 
23
+ def fallback_to_default_locale(locale)
24
+ LostInTranslations.config.fallback_to_default_locale ||
25
+ locale.to_sym == I18n.default_locale.to_sym
26
+ end
27
+
23
28
  module ClassMethods
24
29
  attr_writer :translation_data_field
25
30
 
@@ -1,3 +1,4 @@
1
1
  module LostInTranslations
2
- Config = Struct.new(:translation_data_field, :translator)
2
+ Config = Struct.new \
3
+ :translation_data_field, :translator, :fallback_to_default_locale
3
4
  end
@@ -1,3 +1,3 @@
1
1
  module LostInTranslations
2
- VERSION = '1.4.1'.freeze
2
+ VERSION = '1.4.2'.freeze
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lost_in_translations
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.4.1
4
+ version: 1.4.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - StreetBees Dev Team
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-09-05 00:00:00.000000000 Z
11
+ date: 2016-10-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: pry