lost_in_translation 0.2.15 → 0.2.16

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: 8400bb4007bbe3b64842be7db2b060671ff5785b
4
- data.tar.gz: df902891617cad5ce52a0b54676177a83bd914e2
3
+ metadata.gz: a4ba919cf48560a895ba229150cd565d9ed86f4a
4
+ data.tar.gz: 4db873b88c4054da7b151eae7b711dcc82ad4699
5
5
  SHA512:
6
- metadata.gz: 76d057594c8963e6396a805e13fdfb3ba33de48aca14ad7008749cc2bae1ef235fcf68d5b8c18aa209604adb62ce301741f41f22f1f3bce439d71379ff14a638
7
- data.tar.gz: 245a56d1c664e247f448bfd5ebcc8a76afce1fd2065de1008e1e8484b241bbce19b7d5b5412b9d3f917b3e6f306bb37ee0f156adc51d044dc4872fc17a6e4513
6
+ metadata.gz: 8b410239ce6e0db841534a124675100bb3bd8b9f69b10eb8677f1c5f97bce9ed73a14bd136b3a56b154e6923e51030e5a6324e8d9d3e390cd5624eceb5e0ed33
7
+ data.tar.gz: c92f37a7044887056229394e826a29dfc294f0770a79bc6c2cb447a7cf562ab22fd257524b66a033892a750daa78acb936246988be7536982ff5679994a9ffc5
@@ -12,12 +12,14 @@ module LostInTranslation
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
- @diff_counter += 1
16
- if @mode == 'replace' && value_missing(@slave_file, new_structure)
17
- new_val = ask_for_translation(value, new_structure, lang1, lang2, @diff_count, @diff_counter)
18
- new_array << new_val unless new_val.blank?
19
- elsif @mode == 'clean'
20
- new_array << "#{new_structure.join('---')}---#{value}"
15
+ if value_missing(@slave_file, new_structure)
16
+ @diff_counter += 1
17
+ if @mode == 'replace'
18
+ new_val = ask_for_translation(value, new_structure, lang1, lang2, @diff_count, @diff_counter)
19
+ new_array << new_val unless new_val.blank?
20
+ elsif @mode == 'clean'
21
+ new_array << "#{new_structure.join('---')}---#{value}"
22
+ end
21
23
  end
22
24
  end
23
25
  if next_root.is_a? Hash
@@ -30,11 +32,7 @@ module LostInTranslation
30
32
 
31
33
  def self.value_missing(slave_file, structure)
32
34
  return true if slave_file.blank?
33
- # puts structure
34
- # en
35
- # storage_backlog
36
- # backlog_qstl
37
- true
35
+ slave_file.dig(*structure).blank?
38
36
  end
39
37
 
40
38
  def self.get_locale(path)
@@ -33,8 +33,8 @@ module LostInTranslation
33
33
  log "Application: #{app_name}"
34
34
  log "Do you want the #{lang}.yml to be sorted?"
35
35
  log 'Alphabetically & Recursive (ASC)'
36
- a = [(print "# [Y/n]: "), Readline.readline()][1]
37
- a == 'y' || a == 'Y' || a == ''
36
+ a = [(print "# [y/N]: "), Readline.readline()][1]
37
+ a == 'y' || a == 'Y'
38
38
  end
39
39
 
40
40
  def self.ask_for_translation(value, new_structure, lang1, lang2, diff_count, diff_counter)
@@ -56,7 +56,7 @@ module LostInTranslation
56
56
  end
57
57
 
58
58
  def self.log(text = '')
59
- max_length = 70
59
+ max_length = 80
60
60
  outside = 4
61
61
  puts '#' * max_length if text.blank?
62
62
  arr = text.scan(/.{1,#{max_length - outside}}/)
@@ -2,5 +2,5 @@
2
2
 
3
3
  #
4
4
  module LostInTranslation
5
- VERSION = '0.2.15'
5
+ VERSION = '0.2.16'
6
6
  end
@@ -24,7 +24,7 @@ module LostInTranslation
24
24
  slave_file = YAML.load_file(paths[:slave])
25
25
 
26
26
  count = diff(master_copy_file[@master[:lang]], master_file[@master[:lang]], @master[:lang],
27
- @slave[:lang], [@slave[:lang]], [], mode: 'count')
27
+ @slave[:lang], [@slave[:lang]], [], mode: 'count', slave_file: slave_file)
28
28
 
29
29
  abort('Well, in that case, forget it!') unless ask_for_permission(@master[:lang], @slave[:lang], @master[:app_name], count)
30
30
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lost_in_translation
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.15
4
+ version: 0.2.16
5
5
  platform: ruby
6
6
  authors:
7
7
  - Datyv
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2017-10-25 00:00:00.000000000 Z
11
+ date: 2017-10-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler