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 +4 -4
- data/lib/para/i18n/model.rb +10 -1
- data/lib/para/i18n/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: 44cf27378535862d1697fb584e5f6b7d3956ca48
|
4
|
+
data.tar.gz: 10f6ca9a330dbc47a8501090cf94233c360db243
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 51ed0eab8beb33f6caae6e48b03e83c41b13537f3006abd543ff6c3d42fcc827fdce3c39eee4f425b118968305417183d7f3645379b246d57a7dfde3acfed452
|
7
|
+
data.tar.gz: 435e13e852a2f9628a8bb2297d1d46a6d0258c01921bc140164c2a68ff9751fdf56e6761cbf9b07de2ca8f413075755fa6fee99958f460a659ec248d9daebf38
|
data/lib/para/i18n/model.rb
CHANGED
@@ -43,7 +43,10 @@ module Para
|
|
43
43
|
end
|
44
44
|
|
45
45
|
def translation_for(locale)
|
46
|
-
|
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)
|
data/lib/para/i18n/version.rb
CHANGED
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.
|
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-
|
11
|
+
date: 2019-05-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: para
|