Add career descriptions translation

merge-requests/7/head
sladecraven 1 year ago
parent ebfcfbf70f
commit ffb74768fd

File diff suppressed because one or more lines are too long

@ -2,7 +2,7 @@
"name": "WH4-fr-translation",
"title": "WFRP4e - Core Module en français.",
"description": "Traduction Française pour Warhammer v4.",
"version": "5.0.2",
"version": "5.0.3",
"minimumCoreVersion" : "0.8.0",
"compatibleCoreVersion": "9",
"author": "LeRatierBretonnien",

@ -0,0 +1,29 @@
package.path = package.path .. ";luajson/?.lua"
local JSON = require"json"
local beastref_f = "../compendium/wfrp4e.bestiary.json"
local beastdescr_f = "compendium_wfrp4e.bestiary.json"
local f1 = io.open(beastref_f)
local strjson = f1:read("*a")
local beastref = JSON.decode(strjson)
local f2 = io.open(beastdescr_f)
strjson = f2:read("*a")
f2:close()
local beastdescr = JSON.decode(strjson)
for _, beasttext in pairs(beastdescr.entries) do
for _, beastgood in pairs(beastref.entries) do
if beasttext.id == beastgood.id then
beastgood.description = beasttext.description
end
end
end
local jsonout = JSON.encode( beastref )
local fout = io.open("beasts.json", "w+")
fout:write( jsonout )
fout:close()

@ -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()

Loading…
Cancel
Save