diff --git a/src/module/config.ts b/src/module/config.ts index 0f1bd1e0..d023fc05 100644 --- a/src/module/config.ts +++ b/src/module/config.ts @@ -9,16 +9,11 @@ export const DS4 = { =============================================================================================`, /** - * A dictionary of dictionaries each mapping keys to localized strings. - * To be filled with the localizations derived from i18nKeys. + * A dictionary of dictionaries each mapping keys to localized strings + * resp. their localization keys. + * The localization is assumed to take place on each reload. */ i18n: { - // to be filled with the localized mappings from i18nKeys - }, - /** - * A dictionary of dictionaries each mapping keys to localization keys. - */ - i18nKeys: { /** * Define the set of acttack types that can be performed with weapon items */ diff --git a/src/module/ds4.ts b/src/module/ds4.ts index a2f6ff2f..63a2dec4 100644 --- a/src/module/ds4.ts +++ b/src/module/ds4.ts @@ -29,8 +29,8 @@ Hooks.once("init", async function () { CONFIG.Item.entityClass = DS4Item as typeof Item; // Define localized type labels - CONFIG.Actor.typeLabels = DS4.i18nKeys.actorTypes; - CONFIG.Item.typeLabels = DS4.i18nKeys.itemTypes; + CONFIG.Actor.typeLabels = DS4.i18n.actorTypes; + CONFIG.Item.typeLabels = DS4.i18n.itemTypes; // Configure Dice CONFIG.Dice.types = [Die, DS4Check]; @@ -88,8 +88,8 @@ Hooks.once("setup", function () { const noSort = ["attributes", "traits", "combatValues", "creatureSizeCategories"]; // Localize and sort CONFIG objects - for (const o of Object.keys(CONFIG.DS4.i18nKeys)) { - const localized = Object.entries(CONFIG.DS4.i18nKeys[o]).map((e) => { + for (const o of Object.keys(CONFIG.DS4.i18n)) { + const localized = Object.entries(CONFIG.DS4.i18n[o]).map((e) => { return [e[0], game.i18n.localize(e[1] as string)]; }); if (!noSort.includes(o)) localized.sort((a, b) => a[1].localeCompare(b[1])); diff --git a/src/module/item/item-data.ts b/src/module/item/item-data.ts index 63951e46..b1cc26ef 100644 --- a/src/module/item/item-data.ts +++ b/src/module/item/item-data.ts @@ -1,7 +1,7 @@ import { ModifiableData } from "../common/common-data"; import { DS4 } from "../config"; -export type ItemType = keyof typeof DS4.i18nKeys.itemTypes; +export type ItemType = keyof typeof DS4.i18n.itemTypes; export type DS4ItemDataType = | DS4Weapon