config-patch WIP

This commit is contained in:
2025-05-08 21:38:19 +02:00
parent 1d166df55c
commit 881ca2f6e5
33 changed files with 190 additions and 189 deletions
+56 -56
View File
@@ -23,16 +23,14 @@ const vo_conditions = {
}
const __SELECT_BONUS_PREFIX_D = {
"initiative": 1,
"intelligence": 1,
"endurance": 1,
"agilite": 1,
"agilité": 1
"widerstand": 1,
"gewandheit": 1,
"geschicklichkeit": 1
}
/************************************************************************************/
export class WFRP4FrTranslation {
static parseSpellContent(spell) {
if (spell.system.range?.value) {
spell.system.range.value = this.processSpellContent(spell.system.range.value)
@@ -43,10 +41,10 @@ export class WFRP4FrTranslation {
if (spell.system.duration?.value) {
spell.system.duration.value = this.processSpellContent(spell.system.duration?.value)
}
if ( spell.system.range?.value) {
if (spell.system.range?.value) {
spell.system.range.value = this.processSpellContent(spell.system.range?.value)
}
if (spell.system.target?.value ) {
if (spell.system.target?.value) {
spell.system.target.value = this.processSpellContent(spell.system.target?.value)
}
}
@@ -54,9 +52,9 @@ export class WFRP4FrTranslation {
static processSpellContent(value) {
//console.log("Spell duration/range/damage/target :", value);
if (value == "") return ""; // Hop !
if (value == "Touch") return "Contact"; // Hop !
if (value == "You") return "Vous"; // Hop !
if (value == "Instant") return "Instantané"; // Hop !
if (value == "Touch") return "Berührung"; // Hop !
if (value == "You") return "Du"; // Hop !
if (value == "Instant") return "Sofort"; // Hop !
let translw = value;
let re = /(.*)\s+[Bb]onus\s*(\w*)/i;
let res = re.exec(value);
@@ -65,8 +63,10 @@ export class WFRP4FrTranslation {
if (res) { // Test "<charac> Bonus <unit>" pattern
if (res[1]) { // We have char name, then convert it
translw = game.i18n.localize(res[1].trim());
let bonusPrefix = (translw.toLowerCase() in __SELECT_BONUS_PREFIX_D) ? "Bonus d'" : "Bonus de ";
translw = bonusPrefix + translw
// let bonusPrefix = (translw.toLowerCase() in __SELECT_BONUS_PREFIX_D) ? "Bonus d'" : "Bonus de ";
// translw = bonusPrefix + translw
let bonusSufix = (translw.toLowerCase() in __SELECT_BONUS_PREFIX_D) ? "sbonus" : "bonus";
translw = translw + "bonusSufix"
}
unit = res[2];
} else {
@@ -84,14 +84,14 @@ export class WFRP4FrTranslation {
}
}
}
if (unit == "hour") unit = "heure";
if (unit == "hours") unit = "heures";
if (unit == "days") unit = "jours";
if (unit == "yard") unit = "mètre";
if (unit == "yards") unit = "mètres";
if (unit == "hour") unit = "stunde";
if (unit == "hours") unit = "stunden";
if (unit == "days") unit = "tage";
if (unit == "yard") unit = "meter";
if (unit == "yards") unit = "meter";
if (unit == "Bonus") { // Another weird management
console.log("Translating bonus", unit);
translw = "Bonus de " + translw;
translw = translw + " Bonus";
} else {
translw += " " + unit;
}
@@ -116,8 +116,8 @@ Hooks.once('init', () => {
game.wfrp4e.apps.StatBlockParser.parseStatBlock = async function (statString, type = "npc") {
return statParserFR(statString, type);
}
console.log("WFRP4E-FR | Loading Babele translation module ...");
console.log("WFRP4E-DE | Loading Babele translation module ...");
loadScripts();
/*---------------------------------------------------------------------*/
@@ -225,7 +225,7 @@ Hooks.once('init', () => {
lang: 'de',
dir: 'compendium'
},
)
)
game.babele.registerConverters({
@@ -258,7 +258,7 @@ Hooks.once('init', () => {
s1 = res[1].trim() + " ( )";
translItem = game.babele.translate(compData.metadata.id, { name: s1, type: "skill" }, true)
translw = translItem?.name || undefined
if(translw) {
if (translw) {
let res2 = re.exec(translw);
transl = res2[1] + "(" + subword + ")";
} else {
@@ -285,16 +285,16 @@ Hooks.once('init', () => {
for (let e of effectsData) {
let origName = e.name
e.name = tc_translations.name || game.i18n.localize(e.name)
if ( e.flags?.wfrp4e?.scriptData) {
if (e.flags?.wfrp4e?.scriptData) {
for (let script of e.flags.wfrp4e.scriptData) {
if (script?.label) {
// Quand le label du script est strictement identique au nom de l'item concerné
if ( script.label.toLowerCase() == origName.toLowerCase() ) {
script.label = e.name
if (script.label.toLowerCase() == origName.toLowerCase()) {
script.label = e.name
} else if (script.label.toLowerCase().includes("tests to affect")) {
script.label = script.label.replace("Tests to affect", "Tests relatifs à ")
script.label = script.label.replace("Tests to affect", "Würfe zum Beeinflussen von ")
} else if (script.label.toLowerCase().includes("using torn muscle")) {
script.label = script.label.replace("Using Torn Muscle", "Utilisation du muscle déchiré ")
script.label = script.label.replace("Using Torn Muscle", "Verwende gerissenen Muskel ")
} else {
script.label = game.i18n.localize(script.label)
}
@@ -360,8 +360,8 @@ Hooks.once('init', () => {
for (let compData of validCompendiums) {
let translItem = game.babele.translate(compData.metadata.id, { name: talents_list[i] }, true);
// Specific case management
if (talents_list[i] === "Trapper") {
translItem = game.babele.translate(compData.metadata.id, { name: "a7v422EZcOUUC20X" }, true);
if (talents_list[i] === "Trapper") {
translItem = game.babele.translate(compData.metadata.id, { name: "a7v422EZcOUUC20X" }, true);
}
//console.log("Search talent name:", compData.metadata.id, talents_list[i], translItem);
let transl = translItem?.name || undefined
@@ -480,7 +480,7 @@ Hooks.once('init', () => {
let validCompendiums = game.wfrp4e.tags.getPacksWithTag("spell")
for (let compData of validCompendiums) {
let trait_fr = game.babele.translate(compData.metadata.id, { name: name_en }, true)
if (trait_fr?.system) {
if (trait_fr?.system) {
//DEBUG : console.log(">>>>> Spell ?", name_en, special, trait_fr);
WFRP4FrTranslation.parseSpellContent(trait_en)
trait_fr.name = trait_fr.name || name_en
@@ -591,7 +591,7 @@ Hooks.once('init', () => {
"career_careergroup": (value) => {
// Manage exception - Dirty hack
if (value == 'Slayer') {
return "Tueur";
return "Slayer";
}
if (value == 'Druidic Priest') {
return "Druide";
@@ -604,7 +604,7 @@ Hooks.once('init', () => {
if (!newName) newName = value
return newName
}
ui.notifications.error("Impossible de trouver la carrière " + value + ". Elle n'est probablement pas traduite.", { permanent: true })
ui.notifications.error("Das Übersetzen der Karriere " + value + " ist nicht möglich. Sie ist wahrscheinlich nicht übersetzt.", { permanent: true })
return value
},
@@ -612,29 +612,29 @@ Hooks.once('init', () => {
//console.log("Parsing mutation :", value);
if (!value) return;
value = value.toLowerCase();
value = value.replace("gain a broken condition if you fail a test derived from ", "Gagnez un état Brisé si vous échouez à un test dérivé de ");
value = value.replace("weapon skill", "Capacité de Combat");
value = value.replace("ballistic skill", "Capacité de Tir");
value = value.replace("strength", "Force");
value = value.replace("toughness", "Endurance");
value = value.replace("agility", "Agilité");
value = value.replace("dexterity", "Dextérité");
value = value.replace("willpower", "Force Mentale");
value = value.replace("fellowship", "Sociabilité");
value = value.replace("gain a broken condition if you fail a test derived from ", "Du erhälst einen Demoralisiert-Zustand wenn dir ein Wurf misslingt in ");
value = value.replace("weapon skill" ,"Kampfgeschick");
value = value.replace("ballistic skill", "Ballisitsche Fertigkeit");
value = value.replace("strength", "Stärke");
value = value.replace("toughness", "Widerstand");
value = value.replace("agility", "Gewandheit");
value = value.replace("dexterity", "Geschicklichkeit");
value = value.replace("willpower", "Willenskraft");
value = value.replace("fellowship", "Charisma");
value = value.replace("initiative", "Initiative");
value = value.replace("intelligence", "Intelligence");
value = value.replace("armor points to the head", "PA à la Tête");
value = value.replace("subject to frenzy", "Sujet à la Frénésie");
value = value.replace("you do not scar", "Aucune cicatrice");
value = value.replace("movement", "Mouvement");
value = value.replace("armor points to all locations", "PA sur tout le corps");
value = value.replace("to any test when alone", "à tout les tests lorsque seul");
value = value.replace("track", "Pistage");
value = value.replace("to any test not hurting another", "à tout les Tests n'aggressant pas autrui");
value = value.replace("on tests to hurt", "pour les tests impliquant une agression")
value = value.replace("to all language tests when speaking", "à tout les Tests de Langue lorsque vous parlez");
value = value.replace("on perception tests involving sight", "aux Tests de Perception impliquant la Vue");
value = value.replace("to all Sociabilité tests", "à tout les Tests de Sociabilité");
value = value.replace("intelligence", "Intelligenz");
value = value.replace("armor points to the head", "RP am Kopf");
value = value.replace("subject to frenzy", "unterliegt Raserei");
value = value.replace("you do not scar", "Du bildest keine Narben");
value = value.replace("movement", "Bewegung");
value = value.replace("armor points to all locations", "RP am ganzen Körper");
value = value.replace("to any test when alone", "auf jeden Wurf, wenn du alleine bsit");
value = value.replace("track", "Spurenlesen");
value = value.replace("to any test not hurting another", "auf jeden Wurf, um anderen keine Schmerzen zuzufügen");
value = value.replace("on tests to hurt", "auf jeden Wurf, um anderen Schmerzen zuzufügen")
value = value.replace("to all language tests when speaking", "auf alle Sprache-Würfe beim Sprechen");
value = value.replace("on perception tests involving sight", "auf Wahrnehmungs-Würfe, bei denen es um die Sicht geht");
value = value.replace("to all Sociabilité tests", "auf alle gesellschaftlichen Würfe");
return value;
},
"talent_name": (name, translation) => {
@@ -673,7 +673,7 @@ Hooks.once('init', () => {
"disease_duration_unit": (unit) => {
return game.i18n.localize(unit).capitalize();
}
});
});
}
});