Fix talents naming

This commit is contained in:
LeRatierBretonnien 2023-09-28 07:49:24 +02:00
parent 044dcde7bf
commit 644e8b8146
3 changed files with 15 additions and 21 deletions

View File

@ -158,7 +158,7 @@ Hooks.once('init', () => {
for (i = 0; i < len; i++) {
skills_list[i] = skills_list[i].trim();
for (let compData of validCompendiums) {
let transl = game.babele.translate(compData.metadata.id, { name: skills_list[i] }, true).name;
let transl = game.babele.translate(compData.metadata.id, { name: skills_list[i], type: "skill" }, true).name;
if (!transl) transl = skills_list[i]
//console.log("List ...", skills_list[i]);
if (transl == skills_list[i]) {
@ -167,13 +167,13 @@ Hooks.once('init', () => {
//console.log("Matched/split:", res[1], res[2]);
let subword = game.i18n.localize(res[2].trim());
let s1 = res[1].trim() + " ()";
let translw = game.babele.translate(compData.metadata.id, { name: s1 }, true).name;
let translw = game.babele.translate(compData.metadata.id, { name: s1, type: "skill" }, true).name;
if (translw != s1) {
let res2 = re.exec(translw);
transl = res2[1] + "(" + subword + ")";
} else {
s1 = res[1].trim() + " ( )";
translw = game.babele.translate(compData.metadata.id, { name: s1 }, true).name;
translw = game.babele.translate(compData.metadata.id, { name: s1, type: "skill" }, true).name;
let res2 = re.exec(translw);
transl = res2[1] + "(" + subword + ")";
}
@ -241,32 +241,26 @@ Hooks.once('init', () => {
let len = talents_list.length;
let re = /(.*)\((.*)\)/i;
for (i = 0; i < len; i++) {
let translated = false;
for (let compData of validCompendiums) {
let transl = game.babele.translate(compData.metadata.id, { name: talents_list[i] }, true).name;
//console.log("TALENT - Parsing : ", talents_list)
let transl = game.babele.translate(compData.metadata.id, { name: talents_list[i], type: "talent" }, true).name;
if (!transl) transl = talents_list[i]
if (transl == talents_list[i]) {
let res = re.exec(talents_list[i]);
if (res) {
//console.log("Matched/split:", res[1], res[2]);
let subword = game.i18n.localize(res[2].trim());
let s1 = res[1].trim(); // No () in talents table
let translw = game.babele.translate(compData.metadata.id, { name: s1 }, true).name;
if (translw != s1) {
let translw = game.babele.translate(compData.metadata.id, { name: s1, type: "talent" }, true).name;
//console.log("Ssearch talent name:", compData.metadata.id, s1, translw);
if (translw && translw != s1) {
transl = translw + " (" + subword + ")";
} else {
s1 = res[1].trim() + " ( )";
translw = game.babele.translate(compData.metadata.id, { name: s1 }, true).name;
let res2 = re.exec(translw);
if (res2) {
transl = res2[1] + " (" + subword + ")";
} else {
transl = translw
}
translated = true
}
}
}
talents_list[i] = transl;
if (transl?.system)
if (translated)
break;
}
}

View File

@ -24731,7 +24731,7 @@
{
"id": "Informer",
"trappings": [
"Bâtonnet de fusain",,
"Bâtonnet de fusain",
"Besace contenant 2 tenues vestimentaires différentes et une Cape à capuchon"
],
"description": "<p>@UUID[Compendium.wfrp4e-core.journals.wczCPcuHT4VQDLpL.JournalEntryPage.ssJHG82vEHHRoAUF]{Espion}<\/p>",

View File

@ -8,7 +8,7 @@
}
],
"url": "https://www.uberwald.me/gitea/public/foundryvtt-wh4-lang-fr-fr",
"version": "7.0.10",
"version": "7.0.11",
"esmodules": [
"babele-register.js",
"addon-register.js",
@ -160,7 +160,7 @@
}
],
"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.10.zip",
"download": "https://www.uberwald.me/gitea/public/foundryvtt-wh4-lang-fr-fr/archive/foundryvtt-wh4-lang-fr-7.0.11.zip",
"id": "wh4-fr-translation",
"compatibility": {
"minimum": "10",