Sync with new Compendium structure

This commit is contained in:
LeRatierBretonnien 2020-05-11 10:01:50 +02:00
parent 382ec09b1c
commit f75a8a0789
3 changed files with 18 additions and 15 deletions

View File

@ -52,9 +52,11 @@ Hooks.on("chatMessage", (html, content, msg) => {
Hooks.once('ready', () => {
const lang = game.settings.get('core', 'language');
if ( lang == "fr" ) {
game.packs.forEach((pack, idx) => {
if(!pack.translated && pack.entity === 'Actor') {
if ( lang == "fr" ) {
let pack_array = [];
game.packs.forEach((pack, name) => {
let newpack = pack;
if(!pack.translated && pack.entity === 'Actor') {
let translations = {
"label": pack.metadata.name,
"mapping": {
@ -71,11 +73,12 @@ Hooks.once('ready', () => {
},
"entries": [
]
};
};
console.log("Actor compendium has been replaced !!!!");
game.packs[idx] = new TranslatedCompendium(pack, translations);
newpack = new TranslatedCompendium(pack, translations);
}
pack_array.push( [name, newpack ] );
} );
game.packs = new Collection( pack_array );
}
} );

View File

@ -388,7 +388,7 @@ Hooks.once('init', () => {
special = " (" + game.i18n.localize( res[2].trim() ) + ")"; // And the special keyword
}
var trait_fr = fulltraits.translate( { name: name_en } );
console.log(">>>>> Trait ?", name_en, nbt, trait_fr.name, special);
//console.log(">>>>> Trait ?", name_en, nbt, trait_fr.name, special);
trait_en.name = nbt + trait_fr.name + special;
if ( trait_fr.data && trait_fr.data.description && trait_fr.data.description.value ) {
trait_en.data.description.value = trait_fr.data.description.value;
@ -410,7 +410,7 @@ Hooks.once('init', () => {
special = " (" + game.i18n.localize( res[2].trim() ) + ")"; // And the special keyword
}
var trait_fr = fullskills.translate( { name: name_en } );
console.log(">>>>> Skill ?", name_en, special, trait_fr.name);
//console.log(">>>>> Skill ?", name_en, special, trait_fr.name);
trait_en.name = trait_fr.name + special;
trait_en.data.description.value = trait_fr.data.description.value;
@ -419,7 +419,7 @@ Hooks.once('init', () => {
if ( (!trait_fr.data || !trait_fr.data.description || !trait_fr.data.description.value) && eisspells) { // If no translation, test eisspells
trait_fr = eisspells.translate( { name: name_en } );
}
console.log(">>>>> Spell ?", name_en, special, trait_fr.name );
//console.log(">>>>> Spell ?", name_en, special, trait_fr.name );
trait_en.name = trait_fr.name + special;
if ( trait_fr.data && trait_fr.data.description && trait_fr.data.description.value )
trait_en.data.description.value = trait_fr.data.description.value;
@ -431,16 +431,16 @@ Hooks.once('init', () => {
special = " (" + game.i18n.localize( res[2].trim() ) + ")"; // And the special keyword
}
var trait_fr = fulltalents.translate( { name: name_en } );
console.log(">>>>> Talent ?", name_en, special, trait_fr.name);
//console.log(">>>>> Talent ?", name_en, special, trait_fr.name);
trait_en.name = trait_fr.name + special;
trait_en.data.description.value = trait_fr.data.description.value;
} else if ( trait_en.type == "career") {
var career_fr = fullcareers.translate( trait_en );
console.log(">>>>> Career ?", name_en, career_fr.name);
//console.log(">>>>> Career ?", name_en, career_fr.name);
trait_en = career_fr;
} else if ( trait_en.type == "trapping" || trait_en.type == "weapon" || trait_en.type == "armour" || trait_en.type == "container" || trait_en.type == "money") {
var trapping_fr = fulltrappings.translate( trait_en );
console.log(">>>>> Trapping ?", name_en, trapping_fr.name);
//console.log(">>>>> Trapping ?", name_en, trapping_fr.name);
trait_en.name = trapping_fr.name;
trait_en.data.description = trapping_fr.data.description;
}

View File

@ -2,9 +2,9 @@
"name": "WH4-fr-translation",
"title": "Traduction du module WH4 en Français.",
"description": "La traduction du module WH4.",
"version": "0.69",
"minimumCoreVersion" : "0.5.1",
"compatibleCoreVersion": "0.5.5",
"version": "0.70",
"minimumCoreVersion" : "0.5.5",
"compatibleCoreVersion": "0.5.6",
"author": "LeRatierBretonnien",
"esmodules": [
"babele-register.js",