air18n 0.1.12 → 0.1.13

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -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
- LoggingHelper.info "record phrase revision"
26
- PhraseRevision.find_or_create_by_key_and_value_hash_and_value(key, value_hash, value)
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.
@@ -3,7 +3,8 @@ module Air18n
3
3
  belongs_to :phrase
4
4
 
5
5
  def self.value_from_hash(phrase_key, hash)
6
- find_by_key_and_value_hash(phrase_key, hash).value
6
+ pr = find_by_key_and_value_hash(phrase_key, hash)
7
+ pr.value if pr
7
8
  end
8
9
  end
9
10
  end
@@ -1,3 +1,3 @@
1
1
  module Air18n
2
- VERSION = "0.1.12"
2
+ VERSION = "0.1.13"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: air18n
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.12
4
+ version: 0.1.13
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: