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 return results
} }
// Auto patch // 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.")) { if (game.system.version.match("7.")) {
results[0].text = "wfrp4e-core.journals" results[0].text = "wfrp4e-core.journals"
} else { } else {
@ -319,15 +319,20 @@ Hooks.once('init', () => {
} }
let trait_fr = game.babele.translate(compendiumName, { name: name_en }, true); let trait_fr = game.babele.translate(compendiumName, { name: name_en }, true);
//console.log(">>>>> Trait ?", name_en, nbt, trait_fr, trait_fr.name, special); //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_fr.name = trait_fr.name || trait_en.name
trait_en.name = nbt + trait_fr.name + special; trait_en.name = nbt + trait_fr.name + special;
}
if (trait_fr.system?.description?.value) { if (trait_fr.system?.description?.value) {
trait_en.system.description.value = 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 } 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_fr = game.babele.translate('wfrp4e-eis.items', { name: name_en }, true);
trait_en.name = nbt + trait_fr.name + special; if (trait_fr?.name) {
if (trait_fr.system?.description?.value) trait_en.name = nbt + trait_fr.name + special
trait_en.system.description.value = trait_fr.system.description.value; }
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 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); //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); let career_fr = game.babele.translate(compendiumCareers, { name: name_en }, true);
trait_en.name = career_fr.name || trait_en.name trait_en.name = career_fr.name || trait_en.name
//console.log(">>>>> Career ?", career_fr.name ); //console.log(">>>>> Career ?", career_fr.name );
if ( career_fr?.system) { if (career_fr?.system) {
trait_en.system = duplicate(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", "url": "https://www.uberwald.me/gitea/public/foundryvtt-wh4-lang-fr-fr",
"version": "7.0.8", "version": "7.0.9",
"esmodules": [ "esmodules": [
"babele-register.js", "babele-register.js",
"addon-register.js", "addon-register.js",
@ -30,107 +30,140 @@
"label": "Plats d'Auberges", "label": "Plats d'Auberges",
"type": "RollTable", "type": "RollTable",
"name": "plats-dauberges", "name": "plats-dauberges",
"path": "packs/plats-dauberges.db", "path": "packs/plats-dauberges",
"system": "wfrp4e", "system": "wfrp4e",
"private": false, "flags": {},
"flags": {} "ownership": {
"PLAYER": "OBSERVER",
"ASSISTANT": "OWNER"
}
}, },
{ {
"label": "Dons de Rhya", "label": "Dons de Rhya",
"type": "JournalEntry", "type": "JournalEntry",
"name": "dons-de-rhya", "name": "dons-de-rhya",
"path": "packs/dons-de-rhya.db", "path": "packs/dons-de-rhya",
"system": "wfrp4e", "system": "wfrp4e",
"private": false, "flags": {},
"flags": {} "ownership": {
"PLAYER": "OBSERVER",
"ASSISTANT": "OWNER"
}
}, },
{ {
"label": "Sorts FR", "label": "Sorts FR",
"type": "Item", "type": "Item",
"name": "sort-fr", "name": "sort-fr",
"path": "packs/sort-fr.db", "path": "packs/sort-fr",
"system": "wfrp4e", "system": "wfrp4e",
"private": false, "flags": {},
"flags": {} "ownership": {
"PLAYER": "OBSERVER",
"ASSISTANT": "OWNER"
}
}, },
{ {
"label": "Aides de Jeu FR", "label": "Aides de Jeu FR",
"type": "JournalEntry", "type": "JournalEntry",
"name": "aides-de-jeu-fr", "name": "aides-de-jeu-fr",
"path": "packs/aides-de-jeu-fr.db", "path": "packs/aides-de-jeu-fr",
"system": "wfrp4e", "system": "wfrp4e",
"private": false, "flags": {},
"flags": {} "ownership": {
"PLAYER": "OBSERVER",
"ASSISTANT": "OWNER"
}
}, },
{ {
"label": "Potions : Drogues et Sédatifs", "label": "Potions : Drogues et Sédatifs",
"type": "Item", "type": "Item",
"name": "drogues-and-sedatifs", "name": "drogues-and-sedatifs",
"path": "packs/drogues-and-sedatifs.db", "path": "packs/drogues-and-sedatifs",
"system": "wfrp4e", "system": "wfrp4e",
"private": false, "flags": {},
"flags": {} "ownership": {
"PLAYER": "OBSERVER",
"ASSISTANT": "OWNER"
}
}, },
{ {
"label": "Potions : Pansements et Cataplasmes", "label": "Potions : Pansements et Cataplasmes",
"type": "Item", "type": "Item",
"name": "pansements-and-cataplasmes", "name": "pansements-and-cataplasmes",
"path": "packs/pansements-and-cataplasmes.db", "path": "packs/pansements-and-cataplasmes",
"system": "wfrp4e", "system": "wfrp4e",
"private": false, "flags": {},
"flags": {} "ownership": {
"PLAYER": "OBSERVER",
"ASSISTANT": "OWNER"
}
}, },
{ {
"label": "Potions : Poisons et Toxiques", "label": "Potions : Poisons et Toxiques",
"type": "Item", "type": "Item",
"name": "poisons-and-toxiques", "name": "poisons-and-toxiques",
"path": "packs/poisons-and-toxiques.db", "path": "packs/poisons-and-toxiques",
"system": "wfrp4e", "system": "wfrp4e",
"private": false, "flags": {},
"flags": {} "ownership": {
"PLAYER": "OBSERVER",
"ASSISTANT": "OWNER"
}
}, },
{ {
"label": "Potions : Potions et Décoctions", "label": "Potions : Potions et Décoctions",
"type": "Item", "type": "Item",
"name": "potions-and-decoctions", "name": "potions-and-decoctions",
"path": "packs/potions-and-decoctions.db", "path": "packs/potions-and-decoctions",
"system": "wfrp4e", "system": "wfrp4e",
"private": false, "flags": {},
"flags": {} "ownership": {
"PLAYER": "OBSERVER",
"ASSISTANT": "OWNER"
}
}, },
{ {
"label": "Potions : Antidotes et Remèdes", "label": "Potions : Antidotes et Remèdes",
"type": "Item", "type": "Item",
"name": "antidotes-and-remedes", "name": "antidotes-and-remedes",
"path": "packs/antidotes-and-remedes.db", "path": "packs/antidotes-and-remedes",
"system": "wfrp4e", "system": "wfrp4e",
"private": false, "flags": {},
"flags": {} "ownership": {
"PLAYER": "OBSERVER",
"ASSISTANT": "OWNER"
}
}, },
{ {
"label": "Tables des Traductions", "label": "Tables des Traductions",
"type": "JournalEntry", "type": "JournalEntry",
"name": "tables-des-traductions", "name": "tables-des-traductions",
"path": "packs/tables-des-traductions.db", "path": "packs/tables-des-traductions",
"system": "wfrp4e", "system": "wfrp4e",
"private": false, "flags": {},
"flags": {} "ownership": {
"PLAYER": "OBSERVER",
"ASSISTANT": "OWNER"
}
}, },
{ {
"label": "Apothicarium", "label": "Apothicarium",
"type": "JournalEntry", "type": "JournalEntry",
"name": "apothicarium", "name": "apothicarium",
"path": "packs/apothicarium.db", "path": "packs/apothicarium",
"system": "wfrp4e", "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", "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", "id": "wh4-fr-translation",
"compatibility": { "compatibility": {
"minimum": "11", "minimum": "10",
"verified": "11" "verified": "11"
}, },
"relationships": { "relationships": {