From 7256dc14c2c480879418db2bb48fd7134b8c4d7f Mon Sep 17 00:00:00 2001 From: LeRatierBretonnien Date: Thu, 30 Apr 2020 21:56:09 +0200 Subject: [PATCH] Auto-translate spells + parse eis items --- addon-register.js | 47 +++++++++++++++++++++++++---------------------- module.json | 2 +- 2 files changed, 26 insertions(+), 23 deletions(-) diff --git a/addon-register.js b/addon-register.js index 9a6264d..460a49b 100644 --- a/addon-register.js +++ b/addon-register.js @@ -51,28 +51,31 @@ Hooks.on("chatMessage", (html, content, msg) => { /* Additionnal hooks ready */ Hooks.once('ready', () => { - game.packs.forEach((pack, idx) => { - if(!pack.translated && pack.entity === 'Actor') { - let translations = { - "label": pack.metadata.name, - "mapping": { - "name": "name", - "description": "details.biography.value", - "items": { - "path": "items", - "converter": "bestiary_traits" + const lang = game.settings.get('core', 'language'); + if ( lang == "fr" ) { + game.packs.forEach((pack, idx) => { + if(!pack.translated && pack.entity === 'Actor') { + let translations = { + "label": pack.metadata.name, + "mapping": { + "name": "name", + "description": "details.biography.value", + "items": { + "path": "items", + "converter": "bestiary_traits" + }, + "characteristics": { + "path": "data.characteristics", + "converter": "npc_characteristics" + } }, - "characteristics": { - "path": "data.characteristics", - "converter": "npc_characteristics" - } - }, - "entries": [ - ] - }; - console.log("Actor compendium has been replaced !!!!"); - game.packs[idx] = new TranslatedCompendium(pack, translations); - } - }); + "entries": [ + ] + }; + console.log("Actor compendium has been replaced !!!!"); + game.packs[idx] = new TranslatedCompendium(pack, translations); + } + } ); + } } ); diff --git a/module.json b/module.json index c3e7003..bcba9d3 100644 --- a/module.json +++ b/module.json @@ -2,7 +2,7 @@ "name": "WH4-fr-translation", "title": "Traduction du module WH4 en Français.", "description": "La traduction du module WH4.", - "version": "0.64", + "version": "0.65", "minimumCoreVersion" : "0.5.1", "compatibleCoreVersion": "0.5.5", "author": "LeRatierBretonnien",