para-i18n 0.3.2 → 0.3.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: 7debf4be928d56fb8b0e9bf814ee6fd09422b036
4
- data.tar.gz: b7b0c7bf833da338a617d40b7ed49e87a3ff995f
3
+ metadata.gz: 44cf27378535862d1697fb584e5f6b7d3956ca48
4
+ data.tar.gz: 10f6ca9a330dbc47a8501090cf94233c360db243
5
5
  SHA512:
6
- metadata.gz: e40bacf82951a1c80f5f3079fd4d244007a9cf6dbfc9d1dfcc96770011a34564871e687176b31c2704b74c0305dbd52c536210e3d8ba5e81f7db00bef87f04fd
7
- data.tar.gz: 90b24e6e7a78d8622c232796bc93acc6e4a32a1773462ce6dd7023d7173b38241c39721bd42a163b06975351ae37f85588fd30af5f681c3da57b986cbcb7e426
6
+ metadata.gz: 51ed0eab8beb33f6caae6e48b03e83c41b13537f3006abd543ff6c3d42fcc827fdce3c39eee4f425b118968305417183d7f3645379b246d57a7dfde3acfed452
7
+ data.tar.gz: 435e13e852a2f9628a8bb2297d1d46a6d0258c01921bc140164c2a68ff9751fdf56e6761cbf9b07de2ca8f413075755fa6fee99958f460a659ec248d9daebf38
@@ -43,7 +43,10 @@ module Para
43
43
  end
44
44
 
45
45
  def translation_for(locale)
46
- model_translations[locale.to_s] || {}
46
+ case locale
47
+ when I18n.default_locale then default_locale_translations
48
+ else model_translations[locale.to_s] || {}
49
+ end.with_indifferent_access
47
50
  end
48
51
 
49
52
  private
@@ -80,6 +83,12 @@ module Para
80
83
  store.first if store
81
84
  end
82
85
 
86
+ def default_locale_translations
87
+ translated_attribute_names.each_with_object({}) do |attribute_name, hash|
88
+ hash[attribute_name] = read_plain_or_store_attribute(attribute_name)
89
+ end
90
+ end
91
+
83
92
  module ClassMethods
84
93
  def translates(*fields)
85
94
  self.translated_attribute_names = fields.map(&:to_sym)
@@ -1,5 +1,5 @@
1
1
  module Para
2
2
  module I18n
3
- VERSION = "0.3.2"
3
+ VERSION = "0.3.3"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: para-i18n
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.2
4
+ version: 0.3.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Valentin Ballestrino
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2019-04-16 00:00:00.000000000 Z
11
+ date: 2019-05-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: para