foundryvtt-swade-fr/tools/detect_missing_strings.lua

37 lines
745 B
Lua
Raw Normal View History

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