i18n-processes 0.1.3 → 0.1.4
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.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/lib/i18n/processes/command/commands/missing.rb +0 -1
- data/lib/i18n/processes/path.rb +11 -9
- data/lib/i18n/processes/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: cb81a78309d5556c743ad0f8f526f6a3760bb6be
|
4
|
+
data.tar.gz: 3773c58a0c8d23b1b48090c0e5a16c8989f3d82e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2f1a07749479db3625a639dd5fce97e27db0447cb612bb25cd6a00ff7678eebb1efde54e607b058b5af1882ae0e4d0f4e8cdd76036c4b149874c8ce08282c440
|
7
|
+
data.tar.gz: 24329779ad753f76ce16c96e181f857809da8e9719e1a364c4d33695c0a877d439e74a4634b4f9e54e55a8520568a23b6462eb7ec00b64ef29b4e58a1b5a22e1
|
data/Gemfile.lock
CHANGED
@@ -31,7 +31,6 @@ module I18n::Processes
|
|
31
31
|
translated_locales = opt[:locales].reject{|x| x == base_locale}
|
32
32
|
translated_locales.each do |locale|
|
33
33
|
$stderr.puts Rainbow("#{base_locale} to #{locale}\n").green
|
34
|
-
# 创建en,对比上一期,如果两者的差异一样或者en中不存在这些keys,没问题,不一样,则raise error
|
35
34
|
preprocessing({:locales => [locale] })
|
36
35
|
changed_keys(locale)
|
37
36
|
missing_keys = spreadsheet_report.find_missing(locale)
|
data/lib/i18n/processes/path.rb
CHANGED
@@ -34,14 +34,16 @@ module I18n::Processes:: Path
|
|
34
34
|
|
35
35
|
def changed_keys(locale)
|
36
36
|
previous = "#{compare_path.first}previous/pre_#{base_locale}"
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
37
|
+
if File.exist?(previous)
|
38
|
+
current = compare_path.first + base_locale
|
39
|
+
locale_file = compare_path.first + locale
|
40
|
+
previous_dic = get_dic(previous)
|
41
|
+
current_dic = get_dic(current)
|
42
|
+
locale_dic = get_dic(locale_file)
|
43
|
+
diff = current_dic.merge(previous_dic){|k, v1, v2| {:current => v1, :previous => v2 } unless v1 == v2 }
|
44
|
+
diff.select!{ |k, v| v.is_a?(Hash)}
|
45
|
+
check_changed_keys(diff,locale_dic)
|
46
|
+
end
|
45
47
|
end
|
46
48
|
|
47
49
|
def check_changed_keys(diff, locale_dic)
|
@@ -68,7 +70,7 @@ module I18n::Processes:: Path
|
|
68
70
|
end
|
69
71
|
|
70
72
|
def get_dic(path)
|
71
|
-
fail "#{path} not exist" unless
|
73
|
+
fail "#{path} not exist" unless File.exist?(path)
|
72
74
|
{}.tap do |dic|
|
73
75
|
File.open(path).each_line do |line|
|
74
76
|
key = line.split('=').first
|