forked from public/foundryvtt-wh4-lang-fr-fr
Allow auto-translate of EIS actors + bestiary
This commit is contained in:
@ -21,6 +21,25 @@ local function trim1(s)
|
||||
return (s:gsub("^%s*(.-)%s*$", "%1"))
|
||||
end
|
||||
|
||||
local SIZE2FR = { Size = "Taille",
|
||||
Tiny = "Minuscule",
|
||||
Little = "Très petite",
|
||||
Small = "Petit",
|
||||
Average = "Moyenne",
|
||||
Large = "Grande",
|
||||
Enormous = "Enorme",
|
||||
Monstrous = "Monstrueuse",
|
||||
Difficulty = "Difficulté",
|
||||
Everything = "Tout",
|
||||
Moderate= "Modéré",
|
||||
Major= "Majeur",
|
||||
Minor= "Mineur",
|
||||
Greenskins= "Peaux vertes",
|
||||
Challenging= "Intermédiaire",
|
||||
Elves = "Elfes",
|
||||
}
|
||||
|
||||
local table
|
||||
local line = f1:read()
|
||||
while line do
|
||||
--print(line)
|
||||
@ -28,6 +47,7 @@ while line do
|
||||
-- Get the french beast translation
|
||||
local sel_beastfr
|
||||
for _, beastfr in pairs(beast_french.entries) do
|
||||
print("Testing", beastfr.name)
|
||||
if beast.name:lower() == beastfr.id:lower() then
|
||||
sel_beastfr = beastfr
|
||||
break
|
||||
@ -35,8 +55,13 @@ while line do
|
||||
end
|
||||
if not sel_beastfr then print(">>>>>>>>>>>>>>> NO BEAST !!!", beast.name) end
|
||||
|
||||
local uniq = io.open(beast.name .. ".json", "w+")
|
||||
uniq:write(line)
|
||||
uniq:close()
|
||||
|
||||
--print(beast.name, beast.items)
|
||||
if beast.items then
|
||||
local myitems = {}
|
||||
for _, traitbeast in pairs( beast.items) do
|
||||
if traitbeast.name then
|
||||
print(beast.name, traitbeast.name)
|
||||
@ -47,11 +72,18 @@ while line do
|
||||
for _, traitdata in pairs(traits.entries) do
|
||||
if traitdata.id == trim1(name) then
|
||||
found = true
|
||||
--traitbeast._id = nil
|
||||
--traitbeast.id = traitbeast.name --Swap !
|
||||
traitbeast.name = traitdata.name
|
||||
traitbeast.data.description.value = traitdata.description
|
||||
--local newtrait = { }
|
||||
traitbeast.id = trim1(traitbeast.name)
|
||||
traitbeast.name = trim1(traitdata.name)
|
||||
if traitbeast.data.biography then
|
||||
traitbeast.data.biography.value = traitdata.description
|
||||
end
|
||||
if SIZE2FR[traitbeast.data.specification.value] then
|
||||
traitbeast.data.specification.value = SIZE2FR[traitbeast.data.specification.value]
|
||||
end
|
||||
print(" Found trait " .. traitdata.name)
|
||||
--newtrait.specification = traitbeast.data.specification.value
|
||||
--myitems[#myitems+1] = newtrait
|
||||
break
|
||||
end
|
||||
end
|
||||
@ -59,8 +91,10 @@ while line do
|
||||
print(" > NOT FOUND !!!", beast.name, name, traitbeast.name)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
sel_beastfr.items = beast.items
|
||||
--sel_beastfr.items = myitems
|
||||
--sel_beastfr.items = nil
|
||||
end
|
||||
line = f1:read()
|
||||
end
|
||||
@ -70,3 +104,5 @@ local jsonout = JSON.encode( beast_french )
|
||||
local fout = io.open("beasts.json", "w+")
|
||||
fout:write( jsonout )
|
||||
fout:close()
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user