Fix trait translation

This commit is contained in:
LeRatierBretonnien 2023-09-16 15:27:37 +02:00
parent 959e0e0555
commit 0650e39019
2 changed files with 98 additions and 60 deletions

View File

@ -198,7 +198,7 @@ Hooks.once('init', () => {
return results
}
// Auto patch
if (results[0].text.includes("wfrp4e-core.career-descriptions") ) {
if (results[0].text.includes("wfrp4e-core.career-descriptions")) {
if (game.system.version.match("7.")) {
results[0].text = "wfrp4e-core.journals"
} else {
@ -319,15 +319,20 @@ Hooks.once('init', () => {
}
let trait_fr = game.babele.translate(compendiumName, { name: name_en }, true);
//console.log(">>>>> Trait ?", name_en, nbt, trait_fr, trait_fr.name, special);
if (trait_fr?.name) {
trait_fr.name = trait_fr.name || trait_en.name
trait_en.name = nbt + trait_fr.name + special;
}
if (trait_fr.system?.description?.value) {
trait_en.system.description.value = trait_fr.system.description.value;
} else if (game.modules.get('wfrp4e-eis')) { // No description in the FR compendium -> test other compendium if presenr
trait_fr = game.babele.translate('wfrp4e-eis.items', { name: name_en }, true);
trait_en.name = nbt + trait_fr.name + special;
if (trait_fr.system?.description?.value)
trait_en.system.description.value = trait_fr.system.description.value;
if (trait_fr?.name) {
trait_en.name = nbt + trait_fr.name + special
}
if (trait_fr.system?.description?.value) {
trait_en.system.description.value = trait_fr.system.description.value
}
}
if (trait_en.system?.specification && isNaN(trait_en.system.specification.value)) { // This is a string, so translate it
//console.log("Translating : ", trait_en.system.specification.value);
@ -416,7 +421,7 @@ Hooks.once('init', () => {
let career_fr = game.babele.translate(compendiumCareers, { name: name_en }, true);
trait_en.name = career_fr.name || trait_en.name
//console.log(">>>>> Career ?", career_fr.name );
if ( career_fr?.system) {
if (career_fr?.system) {
trait_en.system = duplicate(career_fr.system);
}

View File

@ -8,7 +8,7 @@
}
],
"url": "https://www.uberwald.me/gitea/public/foundryvtt-wh4-lang-fr-fr",
"version": "7.0.8",
"version": "7.0.9",
"esmodules": [
"babele-register.js",
"addon-register.js",
@ -30,107 +30,140 @@
"label": "Plats d'Auberges",
"type": "RollTable",
"name": "plats-dauberges",
"path": "packs/plats-dauberges.db",
"path": "packs/plats-dauberges",
"system": "wfrp4e",
"private": false,
"flags": {}
"flags": {},
"ownership": {
"PLAYER": "OBSERVER",
"ASSISTANT": "OWNER"
}
},
{
"label": "Dons de Rhya",
"type": "JournalEntry",
"name": "dons-de-rhya",
"path": "packs/dons-de-rhya.db",
"path": "packs/dons-de-rhya",
"system": "wfrp4e",
"private": false,
"flags": {}
"flags": {},
"ownership": {
"PLAYER": "OBSERVER",
"ASSISTANT": "OWNER"
}
},
{
"label": "Sorts FR",
"type": "Item",
"name": "sort-fr",
"path": "packs/sort-fr.db",
"path": "packs/sort-fr",
"system": "wfrp4e",
"private": false,
"flags": {}
"flags": {},
"ownership": {
"PLAYER": "OBSERVER",
"ASSISTANT": "OWNER"
}
},
{
"label": "Aides de Jeu FR",
"type": "JournalEntry",
"name": "aides-de-jeu-fr",
"path": "packs/aides-de-jeu-fr.db",
"path": "packs/aides-de-jeu-fr",
"system": "wfrp4e",
"private": false,
"flags": {}
"flags": {},
"ownership": {
"PLAYER": "OBSERVER",
"ASSISTANT": "OWNER"
}
},
{
"label": "Potions : Drogues et Sédatifs",
"type": "Item",
"name": "drogues-and-sedatifs",
"path": "packs/drogues-and-sedatifs.db",
"path": "packs/drogues-and-sedatifs",
"system": "wfrp4e",
"private": false,
"flags": {}
"flags": {},
"ownership": {
"PLAYER": "OBSERVER",
"ASSISTANT": "OWNER"
}
},
{
"label": "Potions : Pansements et Cataplasmes",
"type": "Item",
"name": "pansements-and-cataplasmes",
"path": "packs/pansements-and-cataplasmes.db",
"path": "packs/pansements-and-cataplasmes",
"system": "wfrp4e",
"private": false,
"flags": {}
"flags": {},
"ownership": {
"PLAYER": "OBSERVER",
"ASSISTANT": "OWNER"
}
},
{
"label": "Potions : Poisons et Toxiques",
"type": "Item",
"name": "poisons-and-toxiques",
"path": "packs/poisons-and-toxiques.db",
"path": "packs/poisons-and-toxiques",
"system": "wfrp4e",
"private": false,
"flags": {}
"flags": {},
"ownership": {
"PLAYER": "OBSERVER",
"ASSISTANT": "OWNER"
}
},
{
"label": "Potions : Potions et Décoctions",
"type": "Item",
"name": "potions-and-decoctions",
"path": "packs/potions-and-decoctions.db",
"path": "packs/potions-and-decoctions",
"system": "wfrp4e",
"private": false,
"flags": {}
"flags": {},
"ownership": {
"PLAYER": "OBSERVER",
"ASSISTANT": "OWNER"
}
},
{
"label": "Potions : Antidotes et Remèdes",
"type": "Item",
"name": "antidotes-and-remedes",
"path": "packs/antidotes-and-remedes.db",
"path": "packs/antidotes-and-remedes",
"system": "wfrp4e",
"private": false,
"flags": {}
"flags": {},
"ownership": {
"PLAYER": "OBSERVER",
"ASSISTANT": "OWNER"
}
},
{
"label": "Tables des Traductions",
"type": "JournalEntry",
"name": "tables-des-traductions",
"path": "packs/tables-des-traductions.db",
"path": "packs/tables-des-traductions",
"system": "wfrp4e",
"private": false,
"flags": {}
"flags": {},
"ownership": {
"PLAYER": "OBSERVER",
"ASSISTANT": "OWNER"
}
},
{
"label": "Apothicarium",
"type": "JournalEntry",
"name": "apothicarium",
"path": "packs/apothicarium.db",
"path": "packs/apothicarium",
"system": "wfrp4e",
"private": false,
"flags": {}
"flags": {},
"ownership": {
"PLAYER": "OBSERVER",
"ASSISTANT": "OWNER"
}
}
],
"manifest": "https://www.uberwald.me/gitea/public/foundryvtt-wh4-lang-fr-fr/raw/v10/module.json",
"download": "https://www.uberwald.me/gitea/public/foundryvtt-wh4-lang-fr-fr/archive/foundryvtt-wh4-lang-fr-7.0.8.zip",
"download": "https://www.uberwald.me/gitea/public/foundryvtt-wh4-lang-fr-fr/archive/foundryvtt-wh4-lang-fr-7.0.9.zip",
"id": "wh4-fr-translation",
"compatibility": {
"minimum": "11",
"minimum": "10",
"verified": "11"
},
"relationships": {