Translate creatures traitsé

This commit is contained in:
LeRatierBretonnien 2020-04-22 20:22:34 +02:00
parent 6aab412c1c
commit 6750d70615
6 changed files with 168 additions and 24030 deletions

View File

@ -233,8 +233,34 @@ Hooks.once('init', () => {
} }
return talents_list; return talents_list;
}, },
"bestiary_traits": (value) => { "bestiary_traits": (beast_traits, translations) => {
console.log("Traits converter is calle d!!!!"); var compendium = game.packs.find(p => p.collection === 'wfrp4e.traits');
for (let trait_en of beast_traits)
{
var nbt = "";
var special = "";
var name_en = trait_en.name.trim(); // strip \r in some traits name
if ( name_en.includes("Tentacles") ) { // Process specific Tentacles case
var re = /(.d*)x Tentacles/i;
var res = re.exec( name_en );
nbt = res[1] + "x ";
name_en = "Tentacles";
} else if ( name_en.includes("(") && name_en.includes(")") ) { // Then process specific traits name with (xxxx) inside
var re = /(.*) \((.*)\)/i;
var res = re.exec( name_en );
name_en = res[1]; // Get the root traits name
special = " (" + res[2] + ")"; // And the special keyword
}
var trait_fr = compendium.translate( { name: name_en } );
//console.log(">>>>> Trait ?", name_en, nbt, trait_fr.name);
trait_en.name = nbt + trait_fr.name + special;
trait_en.data.description.value = trait_fr.data.description.value;
if ( isNaN(trait_en.data.specification.value) ) { // This is a string, so translate it
//console.log("Translating : ", trait_en.data.specification.value);
trait_en.data.specification.value = game.i18n.localize(trait_en.data.specification.value);
}
}
return beast_traits;
}, },
// To avoid duplicateing class for all careers // To avoid duplicateing class for all careers
"generic_localization": (value) => { "generic_localization": (value) => {

File diff suppressed because one or more lines are too long

22
fr.json
View File

@ -705,6 +705,14 @@
"Very Hard (-30)": "Difficile (-30)", "Very Hard (-30)": "Difficile (-30)",
"Difficulty": "Difficulté", "Difficulty": "Difficulté",
"Very Easy" : "Très facile",
"Easy": "Facile",
"Average": "Accessible",
"Challenging": "Intermédiaire",
"Difficult": "Complexe",
"Hard": "Dur",
"Very Hard": "Difficile",
"Weapon Skill": "Capacité de Combat", "Weapon Skill": "Capacité de Combat",
"Ballistic Skill": "Capacité de Tir", "Ballistic Skill": "Capacité de Tir",
"Strength": "Force", "Strength": "Force",
@ -764,6 +772,20 @@
"SPEC.Enormous" : "Enorme", "SPEC.Enormous" : "Enorme",
"SPEC.Monstrous" : "Monstrueuse", "SPEC.Monstrous" : "Monstrueuse",
"Tiny" : "Minuscule",
"Little" : "Très petite",
"Small" : "Petit",
"Average" : "Moyenne",
"Large" : "Grande",
"Enormous" : "Enorme",
"Monstrous" : "Monstrueuse",
"Major": "Majeur",
"Minor": "Mineur",
"Living": "Vivant",
"Everything" : "Tout",
"Drunken Vomit": "Vomi Alcoolisé",
"Thin People": "Gens maigres",
"NAME.BP" : "Sous de Cuivre", "NAME.BP" : "Sous de Cuivre",
"NAME.SS" : "Pistole d'Argent", "NAME.SS" : "Pistole d'Argent",
"NAME.GC" : "Couronne d'Or", "NAME.GC" : "Couronne d'Or",

View File

@ -2,7 +2,7 @@
"name": "WH4-fr-translation", "name": "WH4-fr-translation",
"title": "Traduction du module WH4 en Français.", "title": "Traduction du module WH4 en Français.",
"description": "La traduction du module WH4.", "description": "La traduction du module WH4.",
"version": "0.56", "version": "0.57",
"minimumCoreVersion" : "0.5.1", "minimumCoreVersion" : "0.5.1",
"compatibleCoreVersion": "0.5.5", "compatibleCoreVersion": "0.5.5",
"author": "LeRatierBretonnien", "author": "LeRatierBretonnien",

1
tools/beasts.json Normal file

File diff suppressed because one or more lines are too long

View File

@ -55,9 +55,9 @@ while line do
end end
if not sel_beastfr then print(">>>>>>>>>>>>>>> NO BEAST !!!", beast.name) end if not sel_beastfr then print(">>>>>>>>>>>>>>> NO BEAST !!!", beast.name) end
local uniq = io.open(beast.name .. ".json", "w+") --local uniq = io.open(beast.name .. ".json", "w+")
uniq:write(line) --uniq:write(line)
uniq:close() --uniq:close()
--print(beast.name, beast.items) --print(beast.name, beast.items)
if beast.items then if beast.items then
@ -73,10 +73,11 @@ while line do
if traitdata.id == trim1(name) then if traitdata.id == trim1(name) then
found = true found = true
--local newtrait = { } --local newtrait = { }
traitbeast.id = trim1(traitbeast.name) --traitbeast.id = trim1(traitbeast.name)
traitbeast._id = nil
traitbeast.name = trim1(traitdata.name) traitbeast.name = trim1(traitdata.name)
if traitbeast.data.biography then if traitbeast.data.description then
traitbeast.data.biography.value = traitdata.description traitbeast.data.description.value = traitdata.description
end end
if SIZE2FR[traitbeast.data.specification.value] then if SIZE2FR[traitbeast.data.specification.value] then
traitbeast.data.specification.value = SIZE2FR[traitbeast.data.specification.value] traitbeast.data.specification.value = SIZE2FR[traitbeast.data.specification.value]
@ -92,9 +93,9 @@ while line do
end end
end end
end end
sel_beastfr.items = beast.items --sel_beastfr.items = beast.items
--sel_beastfr.items = myitems --sel_beastfr.items = myitems
--sel_beastfr.items = nil sel_beastfr.items = nil
end end
line = f1:read() line = f1:read()
end end