foundryvtt-swade-fr/tools/detect_missing_strings.lua

37 lines
745 B
Lua

package.path = package.path .. ";luajson/?.lua"
local JSON = require"json"
local enjsonf = "en.json"
local frjsonf = "../fr.json"
local fp = io.open(enjsonf, "r")
local entags = JSON.decode( fp:read("*a") )
fp:close()
entags = entags.SWADE
fp = io.open(frjsonf, "r")
local frtags = JSON.decode( fp:read("*a") )
fp:close()
frtags = frtags.SWADE
local todisplay = {}
for tag, value in pairs(entags) do
if not frtags[tag] then
if type(value) == "table" then
value = JSON.encode(value)
end
todisplay[#todisplay+1] = { tag=tag, value = value }
end
end
table.sort(todisplay, function (a, b)
return a.tag < b.tag
end
)
for _, tagDef in pairs(todisplay) do
print("\"" .. tagDef.tag .."\":" .. tagDef.value)
end