lost_in_translation 0.2.9 → 0.2.10
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/lost_in_translation/difference.rb +5 -5
- data/lib/lost_in_translation/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1075e789fd4de6e65635ff9a8133487f72570884
|
4
|
+
data.tar.gz: f83ed48c0f6217e5a861644bc63bc959ac6b40a7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c36f01b401213ed13fac46795dc6aa55bfe715ed1b6c61af51c8cc17c8fc58be8503fd1830a975716924f63fe54fe1e62b0a8b1c782622417ab81bc43fd6b0cd
|
7
|
+
data.tar.gz: 3897f58e79dee4c55782e58b11e5bcd1c81a890ab7da9b29bfc593bcfee10faa3105559b6d06b4fdcacd28cc5be2ae8a45491986fbed98e89b02ccdcf9691bfc
|
@@ -3,17 +3,17 @@
|
|
3
3
|
#
|
4
4
|
module LostInTranslation
|
5
5
|
def self.diff(root, compared, lang1, lang2, structure = [], new_array = [], options = {})
|
6
|
-
@slave_file = options[:slave_file]
|
7
|
-
@mode = options[:mode] # replace, clean, count
|
8
|
-
@diff_count = options[:diff_count]
|
9
|
-
@diff_counter = options[:diff_counter]
|
6
|
+
@slave_file = options[:slave_file] || ''
|
7
|
+
@mode = options[:mode] || 'count' # replace, clean, count
|
8
|
+
@diff_count = options[:diff_count] || 0
|
9
|
+
@diff_counter = options[:diff_counter] || 0
|
10
10
|
root.each_pair do |key, value|
|
11
11
|
next_root = root[key]
|
12
12
|
next_compared = compared.nil? ? nil : compared[key]
|
13
13
|
new_structure = structure.dup << key
|
14
14
|
if value.is_a?(String) && (compared.nil? || compared[key].nil?)
|
15
15
|
@diff_counter += 1
|
16
|
-
if @mode == 'replace' && value_missing(
|
16
|
+
if @mode == 'replace' && value_missing(@slave_file, new_structure)
|
17
17
|
new_val = ask_for_translation(value, new_structure, lang1, lang2, @diff_count, @diff_counter)
|
18
18
|
return new_array if new_val.present? && new_val.end_with?('exit')
|
19
19
|
new_array << new_val unless new_val.nil?
|