From e4e0b3074ff891d698e74a514370e43398fc1d65 Mon Sep 17 00:00:00 2001 From: BartlomiejBielecki Date: Tue, 4 Jun 2024 12:06:24 +0200 Subject: [PATCH 1/3] localize npc add option to localize by system npc skills and S.P.E.C.I.A.L in npc sheet --- system/src/apps/CompendiumItemSelectors/ItemSelector.mjs | 4 ++++ system/templates/actor/npc/partials/attributes_npc.hbs | 3 ++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/system/src/apps/CompendiumItemSelectors/ItemSelector.mjs b/system/src/apps/CompendiumItemSelectors/ItemSelector.mjs index 87b0b115..6703c163 100644 --- a/system/src/apps/CompendiumItemSelectors/ItemSelector.mjs +++ b/system/src/apps/CompendiumItemSelectors/ItemSelector.mjs @@ -78,6 +78,10 @@ export default class ItemSelector extends CompendiumItemSelector { const modType = item.system.modType; return `${item.name} (${weaponType}, ${modType})`; } + case "skill": { + const localizeName = fallout.utils.getLocalizedSkillName(item); + return `${localizeName}`; + } default: return super.decorateName(item); } diff --git a/system/templates/actor/npc/partials/attributes_npc.hbs b/system/templates/actor/npc/partials/attributes_npc.hbs index 51aeeb6c..9337cca3 100644 --- a/system/templates/actor/npc/partials/attributes_npc.hbs +++ b/system/templates/actor/npc/partials/attributes_npc.hbs @@ -1,6 +1,7 @@
{{#each FALLOUT.ATTRIBUTES as |attribute key|}} {{> specialAttribute + attributeName=(localize attribute) attribute=(lookup ../system.attributes key) key=key }} @@ -10,7 +11,7 @@ {{#*inline "specialAttribute"}}
- {{subString key 0 1}} + {{subString attributeName 0 1}}
Date: Fri, 14 Jun 2024 22:37:26 +0200 Subject: [PATCH 2/3] Revert "localize npc" This reverts commit e4e0b3074ff891d698e74a514370e43398fc1d65. --- system/src/apps/CompendiumItemSelectors/ItemSelector.mjs | 4 ---- system/templates/actor/npc/partials/attributes_npc.hbs | 3 +-- 2 files changed, 1 insertion(+), 6 deletions(-) diff --git a/system/src/apps/CompendiumItemSelectors/ItemSelector.mjs b/system/src/apps/CompendiumItemSelectors/ItemSelector.mjs index 6703c163..87b0b115 100644 --- a/system/src/apps/CompendiumItemSelectors/ItemSelector.mjs +++ b/system/src/apps/CompendiumItemSelectors/ItemSelector.mjs @@ -78,10 +78,6 @@ export default class ItemSelector extends CompendiumItemSelector { const modType = item.system.modType; return `${item.name} (${weaponType}, ${modType})`; } - case "skill": { - const localizeName = fallout.utils.getLocalizedSkillName(item); - return `${localizeName}`; - } default: return super.decorateName(item); } diff --git a/system/templates/actor/npc/partials/attributes_npc.hbs b/system/templates/actor/npc/partials/attributes_npc.hbs index 9337cca3..51aeeb6c 100644 --- a/system/templates/actor/npc/partials/attributes_npc.hbs +++ b/system/templates/actor/npc/partials/attributes_npc.hbs @@ -1,7 +1,6 @@
{{#each FALLOUT.ATTRIBUTES as |attribute key|}} {{> specialAttribute - attributeName=(localize attribute) attribute=(lookup ../system.attributes key) key=key }} @@ -11,7 +10,7 @@ {{#*inline "specialAttribute"}}
- {{subString attributeName 0 1}} + {{subString key 0 1}}
Date: Fri, 14 Jun 2024 22:49:34 +0200 Subject: [PATCH 3/3] lozalization of apparel_mod --- system/src/handlebars.mjs | 13 +++++++++++++ system/templates/item/item-apparel_mod-sheet.hbs | 2 +- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/system/src/handlebars.mjs b/system/src/handlebars.mjs index 6a4a6592..437c1fd1 100644 --- a/system/src/handlebars.mjs +++ b/system/src/handlebars.mjs @@ -247,4 +247,17 @@ export default function registerHandlebarsHelpers() { return html.replace(rgx, "$& selected"); }); + Handlebars.registerHelper("localizeKey", function(key) { + let type = key; + switch (type) { + case "energy": + return game.i18n.localize("FALLOUT.RESISTANCE.energy"); + case "physical": + return game.i18n.localize("FALLOUT.RESISTANCE.physical"); + case "radiation": + return game.i18n.localize("FALLOUT.RESISTANCE.radiation"); + } + }); + + } diff --git a/system/templates/item/item-apparel_mod-sheet.hbs b/system/templates/item/item-apparel_mod-sheet.hbs index 9e5fd02a..75cb98a7 100644 --- a/system/templates/item/item-apparel_mod-sheet.hbs +++ b/system/templates/item/item-apparel_mod-sheet.hbs @@ -28,7 +28,7 @@ {{#each system.resistance as |item key|}}
- +
{{/each}}