merged i18n and i18nKeys
This commit is contained in:
parent
62ab89f83b
commit
0b70bbf9b9
3 changed files with 8 additions and 13 deletions
|
@ -9,16 +9,11 @@ export const DS4 = {
|
||||||
=============================================================================================`,
|
=============================================================================================`,
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A dictionary of dictionaries each mapping keys to localized strings.
|
* A dictionary of dictionaries each mapping keys to localized strings
|
||||||
* To be filled with the localizations derived from i18nKeys.
|
* resp. their localization keys.
|
||||||
|
* The localization is assumed to take place on each reload.
|
||||||
*/
|
*/
|
||||||
i18n: {
|
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
|
* Define the set of acttack types that can be performed with weapon items
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -29,8 +29,8 @@ Hooks.once("init", async function () {
|
||||||
CONFIG.Item.entityClass = DS4Item as typeof Item;
|
CONFIG.Item.entityClass = DS4Item as typeof Item;
|
||||||
|
|
||||||
// Define localized type labels
|
// Define localized type labels
|
||||||
CONFIG.Actor.typeLabels = DS4.i18nKeys.actorTypes;
|
CONFIG.Actor.typeLabels = DS4.i18n.actorTypes;
|
||||||
CONFIG.Item.typeLabels = DS4.i18nKeys.itemTypes;
|
CONFIG.Item.typeLabels = DS4.i18n.itemTypes;
|
||||||
|
|
||||||
// Configure Dice
|
// Configure Dice
|
||||||
CONFIG.Dice.types = [Die, DS4Check];
|
CONFIG.Dice.types = [Die, DS4Check];
|
||||||
|
@ -88,8 +88,8 @@ Hooks.once("setup", function () {
|
||||||
const noSort = ["attributes", "traits", "combatValues", "creatureSizeCategories"];
|
const noSort = ["attributes", "traits", "combatValues", "creatureSizeCategories"];
|
||||||
|
|
||||||
// Localize and sort CONFIG objects
|
// Localize and sort CONFIG objects
|
||||||
for (const o of Object.keys(CONFIG.DS4.i18nKeys)) {
|
for (const o of Object.keys(CONFIG.DS4.i18n)) {
|
||||||
const localized = Object.entries(CONFIG.DS4.i18nKeys[o]).map((e) => {
|
const localized = Object.entries(CONFIG.DS4.i18n[o]).map((e) => {
|
||||||
return [e[0], game.i18n.localize(e[1] as string)];
|
return [e[0], game.i18n.localize(e[1] as string)];
|
||||||
});
|
});
|
||||||
if (!noSort.includes(o)) localized.sort((a, b) => a[1].localeCompare(b[1]));
|
if (!noSort.includes(o)) localized.sort((a, b) => a[1].localeCompare(b[1]));
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
import { ModifiableData } from "../common/common-data";
|
import { ModifiableData } from "../common/common-data";
|
||||||
import { DS4 } from "../config";
|
import { DS4 } from "../config";
|
||||||
|
|
||||||
export type ItemType = keyof typeof DS4.i18nKeys.itemTypes;
|
export type ItemType = keyof typeof DS4.i18n.itemTypes;
|
||||||
|
|
||||||
export type DS4ItemDataType =
|
export type DS4ItemDataType =
|
||||||
| DS4Weapon
|
| DS4Weapon
|
||||||
|
|
Loading…
Reference in a new issue