-
Notifications
You must be signed in to change notification settings - Fork 76
/
detect_locale_changes.lua
67 lines (51 loc) · 1.38 KB
/
detect_locale_changes.lua
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
-- stuff already localized
locale = "en" -- change to suit you
dofile (locale .. ".lua")
-- make copy
original = {
messages = messages,
formatted = formatted,
times = times,
headings = headings
}
messages, formatted, times, headings = nil
-- from distribution
dofile ("Localize_template.lua")
-- make copy
distribution = {
messages = messages,
formatted = formatted,
times = times,
headings = headings
}
messages, formatted, times, headings = nil
function compare_table (name)
local count = 0
local old = original [name]
local new = distribution [name]
print ("Processing table", name)
print ""
-- new message is in distribution, but not in already localized file
for k, v in pairs (new) do
if not old [k] then
count = count + 1
print (string.format (" New message: %q", k))
end -- if not there
end -- for
print ("Found ", count, " new messages")
print ""
count = 0
-- old message is in already localized file, but not in distribution
for k, v in pairs (old) do
if not new [k] then
count = count + 1
print (string.format (" Deleted message: %q", k))
end -- if not there
end -- for
print ("Found ", count, " deleted messages")
print ""
end -- compare_table
compare_table ("messages")
compare_table ("formatted")
compare_table ("times")
compare_table ("headings")