change logic of register sheets

add localization
This commit is contained in:
Mykhailo Budiakov
2025-08-31 19:15:33 +03:00
parent 6854fda59e
commit 043a4c5a0b
2 changed files with 12 additions and 6 deletions
+10 -6
View File
@@ -53,6 +53,14 @@ Hooks.once("init", async () => {
CONFIG.Actor.documentClass = DeltaGreenActor;
CONFIG.Item.documentClass = DeltaGreenItem;
// Preload Handlebars Templates
preloadHandlebarsTemplates();
// Add Handlebars helpers
registerHandlebarsHelpers();
});
Hooks.once("setup", async () => {
// Unregister core sheets.
Actors.unregisterSheet("core", foundry.appv1.sheets.ActorSheet);
Items.unregisterSheet("core", foundry.appv1.sheets.ItemSheet);
@@ -65,9 +73,11 @@ Hooks.once("init", async () => {
vehicle: DGVehicleSheet,
};
Object.entries(sheetClassMap).forEach(([actorType, SheetClass]) => {
const localizedType = game.i18n.localize(`TYPES.Actor.${actorType}`);
Actors.registerSheet(DG.ID, SheetClass, {
makeDefault: true,
themes: null,
label: game.i18n.format("DG.TypedSheet", { type: localizedType }),
types: [actorType],
});
});
@@ -77,12 +87,6 @@ Hooks.once("init", async () => {
makeDefault: true,
themes: null,
});
// Preload Handlebars Templates
preloadHandlebarsTemplates();
// Add Handlebars helpers
registerHandlebarsHelpers();
});
Hooks.once("ready", async () => {