Add career descriptions translation
This commit is contained in:
@ -2,28 +2,28 @@
|
||||
package.path = package.path .. ";luajson/?.lua"
|
||||
local JSON = require"json"
|
||||
|
||||
local oldf = "../compendium/wfrp4e-core.criticals.json.SAVED"
|
||||
local newf = "../compendium/wfrp4e-core.criticals.json"
|
||||
local oldf = "../compendium/wfrp4e-core.careers.json"
|
||||
local newf = "../compendium/wfrp4e-core.career-descriptions.json"
|
||||
|
||||
local origin = io.open(oldf, "r")
|
||||
local strjson = origin:read("*a")
|
||||
origin:close()
|
||||
local oldjson = JSON.decode(strjson)
|
||||
local cf = io.open(oldf, "r")
|
||||
local strjson = cf:read("*a")
|
||||
cf:close()
|
||||
local careers = JSON.decode(strjson)
|
||||
|
||||
local new = io.open(newf, "r")
|
||||
strjson = new:read("*a")
|
||||
new:close()
|
||||
local newjson = JSON.decode(strjson)
|
||||
local cdf = io.open(newf, "r")
|
||||
strjson = cdf:read("*a")
|
||||
cdf:close()
|
||||
local careerDescr = JSON.decode(strjson)
|
||||
|
||||
for _, newItem in pairs(newjson.entries) do
|
||||
for _, oldItem in pairs(oldjson.entries) do
|
||||
if newItem.name == oldItem.name then
|
||||
newItem.id = oldItem.id
|
||||
for _, careerD in pairs(careerDescr.entries) do
|
||||
for _, career in pairs(careers.entries) do
|
||||
if careerD.id == career.id then
|
||||
careerD.name = career.name
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
local jsonout = JSON.encode( newjson )
|
||||
local jsonout = JSON.encode( careerDescr )
|
||||
local fout = io.open("output.json", "w+")
|
||||
fout:write( jsonout )
|
||||
fout:close()
|
||||
|
Reference in New Issue
Block a user