Fix: Localisation des compétences du PNJ rapide dans le chat

- Ajout des helpers Handlebars localizeSkill et joinLocalizedSkills
- Template npc-result.hbs utilise maintenant joinLocalizedSkills pour afficher les compétences en français
- Import de localizeSkill depuis mgt2eSkills.js
- Résout le problème où les compétences s'affichaient en anglais (pilot, guncombat, melee...) au lieu de français (Pilote, Combat Arme, Mêlée...)

Generated by Mistral Vibe.
Co-Authored-By: Mistral Vibe <vibe@mistral.ai>
This commit is contained in:
2026-05-28 01:06:25 +02:00
parent b6a4148829
commit 9d96ec5543
10 changed files with 26 additions and 1 deletions
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
+12
View File
@@ -55,3 +55,15 @@
2026/05/28-00:53:23.184161 7f3e6effd6c0 Level-0 table #75: started 2026/05/28-00:53:23.184161 7f3e6effd6c0 Level-0 table #75: started
2026/05/28-00:53:23.202618 7f3e6effd6c0 Level-0 table #75: 1901920 bytes OK 2026/05/28-00:53:23.202618 7f3e6effd6c0 Level-0 table #75: 1901920 bytes OK
2026/05/28-00:53:23.208730 7f3e6effd6c0 Delete type=0 #72 2026/05/28-00:53:23.208730 7f3e6effd6c0 Delete type=0 #72
2026/05/28-01:02:57.320650 7f3e6effd6c0 Level-0 table #77: started
2026/05/28-01:02:57.341951 7f3e6effd6c0 Level-0 table #77: 1962797 bytes OK
2026/05/28-01:02:57.347793 7f3e6effd6c0 Delete type=0 #74
2026/05/28-01:02:57.348132 7f3e6effd6c0 Compacting 4@0 + 1@1 files
2026/05/28-01:02:57.369982 7f3e6effd6c0 Generated table #78@0: 12958 keys, 1962797 bytes
2026/05/28-01:02:57.370013 7f3e6effd6c0 Compacted 4@0 + 1@1 files => 1962797 bytes
2026/05/28-01:02:57.376098 7f3e6effd6c0 compacted to: files[ 0 1 1 0 0 0 0 ]
2026/05/28-01:02:57.376330 7f3e6effd6c0 Delete type=2 #69
2026/05/28-01:02:57.376716 7f3e6effd6c0 Delete type=2 #71
2026/05/28-01:02:57.377097 7f3e6effd6c0 Delete type=2 #73
2026/05/28-01:02:57.377594 7f3e6effd6c0 Delete type=2 #75
2026/05/28-01:02:57.377833 7f3e6effd6c0 Delete type=2 #77
Binary file not shown.
+13
View File
@@ -3,6 +3,7 @@ import { createNpcActor, generateClientMission, generateEncounter, generateQuick
import { NPC_RELATIONS } from './data/npcTables.js'; import { NPC_RELATIONS } from './data/npcTables.js';
import { generateAndCreateTravellerNpc } from './travellerNpcGenerator.js'; import { generateAndCreateTravellerNpc } from './travellerNpcGenerator.js';
import { generateRandomName } from './data/travellerNpcGenerator.js'; import { generateRandomName } from './data/travellerNpcGenerator.js';
import { localizeSkill } from './mgt2eSkills.js';
import { import {
CITIZEN_CATEGORY_LIST, CITIZEN_CATEGORY_LIST,
EXPERIENCE_LEVEL_LIST, EXPERIENCE_LEVEL_LIST,
@@ -325,6 +326,18 @@ function registerHandlebarsHelpers() {
Handlebars.registerHelper('formatCredits', (amount) => formatCredits(amount)); Handlebars.registerHelper('formatCredits', (amount) => formatCredits(amount));
Handlebars.registerHelper('contains', (text, search) => String(text ?? '').includes(search)); Handlebars.registerHelper('contains', (text, search) => String(text ?? '').includes(search));
// Helper pour localiser une compétence (ex: 'pilot' -> 'Pilote')
Handlebars.registerHelper('localizeSkill', (skillFqn) => {
if (!skillFqn) return '';
return localizeSkill(String(skillFqn));
});
// Helper pour joindre un tableau de compétences en les localisant
Handlebars.registerHelper('joinLocalizedSkills', (arr, sep = ', ') => {
if (!Array.isArray(arr)) return '';
return arr.map(skill => localizeSkill(String(skill))).join(sep);
});
// Helpers pour Traveller NPC // Helpers pour Traveller NPC
Handlebars.registerHelper('gt', (a, b) => a > b); Handlebars.registerHelper('gt', (a, b) => a > b);
+1 -1
View File
@@ -34,7 +34,7 @@
<div class="npc-section"> <div class="npc-section">
<div class="npc-section-title">Résumé jouable</div> <div class="npc-section-title">Résumé jouable</div>
<p><strong>Relation :</strong> {{relation.summary}}</p> <p><strong>Relation :</strong> {{relation.summary}}</p>
<p><strong>Compétences-types :</strong> {{join experience.profile.skills ", "}}</p> <p><strong>Compétences-types :</strong> {{joinLocalizedSkills experience.profile.skills ", "}}</p>
<p><strong>Niveau moyen de compétence :</strong> {{experience.profile.skillLevel}}</p> <p><strong>Niveau moyen de compétence :</strong> {{experience.profile.skillLevel}}</p>
<p><strong>Bonus de caractéristiques :</strong> <p><strong>Bonus de caractéristiques :</strong>
{{#if experience.profile.characteristicBonuses.length}} {{#if experience.profile.characteristicBonuses.length}}