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;
},
"bestiary_traits": (value) => {
console.log("Traits converter is calle d!!!!");
"bestiary_traits": (beast_traits, translations) => {
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
"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)",
"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",
"Ballistic Skill": "Capacité de Tir",
"Strength": "Force",
@ -764,6 +772,20 @@
"SPEC.Enormous" : "Enorme",
"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.SS" : "Pistole d'Argent",
"NAME.GC" : "Couronne d'Or",

View File

@ -2,7 +2,7 @@
"name": "WH4-fr-translation",
"title": "Traduction du module WH4 en Français.",
"description": "La traduction du module WH4.",
"version": "0.56",
"version": "0.57",
"minimumCoreVersion" : "0.5.1",
"compatibleCoreVersion": "0.5.5",
"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
if not sel_beastfr then print(">>>>>>>>>>>>>>> NO BEAST !!!", beast.name) end
local uniq = io.open(beast.name .. ".json", "w+")
uniq:write(line)
uniq:close()
--local uniq = io.open(beast.name .. ".json", "w+")
--uniq:write(line)
--uniq:close()
--print(beast.name, beast.items)
if beast.items then
@ -73,10 +73,11 @@ while line do
if traitdata.id == trim1(name) then
found = true
--local newtrait = { }
traitbeast.id = trim1(traitbeast.name)
--traitbeast.id = trim1(traitbeast.name)
traitbeast._id = nil
traitbeast.name = trim1(traitdata.name)
if traitbeast.data.biography then
traitbeast.data.biography.value = traitdata.description
if traitbeast.data.description then
traitbeast.data.description.value = traitdata.description
end
if SIZE2FR[traitbeast.data.specification.value] then
traitbeast.data.specification.value = SIZE2FR[traitbeast.data.specification.value]
@ -92,9 +93,9 @@ while line do
end
end
end
sel_beastfr.items = beast.items
--sel_beastfr.items = beast.items
--sel_beastfr.items = myitems
--sel_beastfr.items = nil
sel_beastfr.items = nil
end
line = f1:read()
end