air18n 0.1.12 → 0.1.13
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/air18n/backend.rb +1 -1
- data/lib/air18n/phrase.rb +4 -3
- data/lib/air18n/phrase_revision.rb +2 -1
- data/lib/air18n/version.rb +1 -1
- metadata +1 -1
data/lib/air18n/backend.rb
CHANGED
@@ -160,7 +160,7 @@ module Air18n
|
|
160
160
|
|
161
161
|
# If there was a default-language translation, check if it matches the default.
|
162
162
|
# If the phrase is not in the phrases table, it will be created.
|
163
|
-
if locale == I18n.default_locale && default && result != default
|
163
|
+
if locale == I18n.default_locale && default != nil && default != "" && result != default
|
164
164
|
# If it doesn't, we need to update the 'phrases' table so that
|
165
165
|
# the 'value' column reflects the latest English default text.
|
166
166
|
store_default = true
|
data/lib/air18n/phrase.rb
CHANGED
@@ -22,12 +22,13 @@ module Air18n
|
|
22
22
|
|
23
23
|
def record_phrase_revision
|
24
24
|
value_hash = compute_value_hash
|
25
|
-
|
26
|
-
|
25
|
+
if value_hash.present?
|
26
|
+
PhraseRevision.find_or_create_by_key_and_value_hash_and_value(key, value_hash, value)
|
27
|
+
end
|
27
28
|
end
|
28
29
|
|
29
30
|
def compute_value_hash
|
30
|
-
Digest::MD5.new.update(value).to_s
|
31
|
+
value.present? ? Digest::MD5.new.update(value).to_s : ""
|
31
32
|
end
|
32
33
|
|
33
34
|
# TODO(jkb) retire this method, it is very old and ugly.
|
data/lib/air18n/version.rb
CHANGED