From 3ddabcaaac797287b0bdcae342210501ac652cdb Mon Sep 17 00:00:00 2001 From: Gesina Schwalbe Date: Sun, 24 Jan 2021 17:39:11 +0100 Subject: [PATCH 1/6] fixed some German translations --- src/lang/de.json | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/lang/de.json b/src/lang/de.json index f81a5f29..455c97c4 100644 --- a/src/lang/de.json +++ b/src/lang/de.json @@ -12,11 +12,11 @@ "DS4.HeadingSpells": "Zaubersprüche", "DS4.HeadingDescription": "Beschreibung", "DS4.HeadingSpecialCreatureAbilites": "Besondere Fähigkeiten", - "DS4.AttackType": "Angriffs Typ", + "DS4.AttackType": "Angriffstyp", "DS4.AttackTypeAbbr": "AT", - "DS4.WeaponBonus": "Waffen Bonus", + "DS4.WeaponBonus": "Waffenbonus", "DS4.WeaponBonusAbbr": "WB", - "DS4.OpponentDefense": "Gegner Abwehr", + "DS4.OpponentDefense": "Gegnerabwehr", "DS4.OpponentDefenseAbbr": "GA", "DS4.AttackTypeMelee": "Schlagen", "DS4.AttackTypeRanged": "Schießen", @@ -61,9 +61,9 @@ "DS4.ItemTypeSpecialCreatureAbilityPlural": "Besondere Kreaturenfähigkeiten", "DS4.ArmorType": "Panzerungstyp", "DS4.ArmorTypeAbbr": "PAT", - "DS4.ArmorMaterialType": "Material Typ", + "DS4.ArmorMaterialType": "Materialtyp", "DS4.ArmorMaterialTypeAbbr": "Mat.", - "DS4.ArmorValue": "Panzerungs Wert", + "DS4.ArmorValue": "Panzerungswert", "DS4.ArmorValueAbbr": "PA", "DS4.ArmorTypeBody": "Körper", "DS4.ArmorTypeBodyAbbr": "Körper", @@ -125,7 +125,7 @@ "DS4.CombatValuesTargetedSpellcasting": "Zielzaubern", "DS4.CharacterBaseInfoRace": "Volk", "DS4.CharacterBaseInfoClass": "Klasse", - "DS4.CharacterBaseInfoHeroClass": "Helden Klasse", + "DS4.CharacterBaseInfoHeroClass": "Heldenklasse", "DS4.CharacterBaseInfoCulture": "Kultur", "DS4.CharacterProgressionLevel": "Stufe", "DS4.CharacterProgressionExperiencePoints": "Erfahrungspunkte", @@ -193,7 +193,7 @@ "DS4.UnitCustom": "individuell", "DS4.UnitCustomAbbr": " ", "DS4.RollDialogDefaultTitle": "Proben-Optionen", - "DS4.RollDialogOkButton": "Ok", + "DS4.RollDialogOkButton": "OK", "DS4.RollDialogCancelButton": "Abbrechen", "DS4.ErrorUnexpectedHtmlType": "Typfehler: Erwartet wurde {exType}, tatsächlich erhalten wurde {realType}", "DS4.RollDialogTargetLabel": "Probenwert", From 3ba5c0d6409950681ccb72a09c53ae0cbff53ad3 Mon Sep 17 00:00:00 2001 From: Gesina Schwalbe Date: Sun, 24 Jan 2021 17:40:08 +0100 Subject: [PATCH 2/6] localized effect control buttons --- src/lang/de.json | 3 +++ src/lang/en.json | 3 +++ src/templates/item/partials/effects.hbs | 10 ++++++---- 3 files changed, 12 insertions(+), 4 deletions(-) diff --git a/src/lang/de.json b/src/lang/de.json index 455c97c4..d7cb9c9d 100644 --- a/src/lang/de.json +++ b/src/lang/de.json @@ -2,6 +2,9 @@ "DS4.UserInteractionAddItem": "Neu", "DS4.UserInteractionEditItem": "Bearbeiten", "DS4.UserInteractionDeleteItem": "Löschen", + "DS4.UserInteractionAddEffect": "Neuer Effekt", + "DS4.UserInteractionEditEffect": "Effekt bearbeiten", + "DS4.UserInteractionDeleteEffect": "Effekt löschen", "DS4.NotOwned": "Nicht besessen", "DS4.HeadingBiography": "Biografie", "DS4.HeadingDetails": "Details", diff --git a/src/lang/en.json b/src/lang/en.json index ee1927ee..b3b7af82 100644 --- a/src/lang/en.json +++ b/src/lang/en.json @@ -2,6 +2,9 @@ "DS4.UserInteractionAddItem": "Add item", "DS4.UserInteractionEditItem": "Edit item", "DS4.UserInteractionDeleteItem": "Delete item", + "DS4.UserInteractionAddEffect": "Add Effect", + "DS4.UserInteractionEditEffect": "Edit Effect", + "DS4.UserInteractionDeleteEffect": "Delete Effect", "DS4.NotOwned": "No owner", "DS4.HeadingBiography": "Biography", "DS4.HeadingDetails": "Details", diff --git a/src/templates/item/partials/effects.hbs b/src/templates/item/partials/effects.hbs index b829bfac..a064313e 100644 --- a/src/templates/item/partials/effects.hbs +++ b/src/templates/item/partials/effects.hbs @@ -5,16 +5,18 @@
Name
{{#each item.effects as |effect id|}}
  • {{effect.label}}

    - - + + + +
  • {{/each}} From a5d91eca71b7f0df6790ccc6ed0b2887a698ec44 Mon Sep 17 00:00:00 2001 From: Gesina Schwalbe Date: Sun, 24 Jan 2021 17:45:39 +0100 Subject: [PATCH 3/6] localized edit & delete item buttons --- src/templates/actor/partials/overview-control-buttons.hbs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/templates/actor/partials/overview-control-buttons.hbs b/src/templates/actor/partials/overview-control-buttons.hbs index d10dbc3f..2c85899f 100644 --- a/src/templates/actor/partials/overview-control-buttons.hbs +++ b/src/templates/actor/partials/overview-control-buttons.hbs @@ -3,6 +3,6 @@ !-- The current item is defined by the data-item-id HTML property of the parent li element. --}}
    - - + +
    From d831f376e1b6c92929788f45d54816add4dd6f98 Mon Sep 17 00:00:00 2001 From: Gesina Schwalbe Date: Sun, 24 Jan 2021 17:47:47 +0100 Subject: [PATCH 4/6] moved localization mappings in CONFIG.DS4.i18nKeys - moved all mappings in CONFIG.DS4 that belong to localization into common parent CONFIG.DS4.i18nKeys - adapted logic in ds4.ts to not overwrite entries in CONFIG.DS4.i18nKeys - adapted calls to config in templates --- src/module/config.ts | 561 +++++++++--------- src/module/ds4.ts | 40 +- src/module/item/item-data.ts | 2 +- src/templates/actor/character-sheet.hbs | 12 +- src/templates/actor/creature-sheet.hbs | 14 +- .../actor/partials/attributes-traits.hbs | 4 +- .../actor/partials/character-inventory.hbs | 6 +- .../actor/partials/character-progression.hbs | 4 +- .../actor/partials/combat-values.hbs | 2 +- .../actor/partials/items-overview.hbs | 10 +- src/templates/actor/partials/profile.hbs | 4 +- .../actor/partials/spells-overview.hbs | 6 +- src/templates/item/armor-sheet.hbs | 4 +- src/templates/item/partials/details.hbs | 2 +- src/templates/item/partials/sheet-header.hbs | 2 +- src/templates/item/spell-sheet.hbs | 8 +- src/templates/item/weapon-sheet.hbs | 2 +- src/templates/roll/roll-options.hbs | 2 +- 18 files changed, 333 insertions(+), 352 deletions(-) diff --git a/src/module/config.ts b/src/module/config.ts index cd927290..5654c189 100644 --- a/src/module/config.ts +++ b/src/module/config.ts @@ -9,12 +9,293 @@ export const DS4 = { =============================================================================================`, /** - * Define the set of acttack types that can be performed with weapon items + * A dictionary of dictionaries each mapping keys to localized strings. + * To be filled with the localizations derived from i18nKeys. */ - attackTypes: { - melee: "DS4.AttackTypeMelee", - ranged: "DS4.AttackTypeRanged", - meleeRanged: "DS4.AttackTypeMeleeRanged", + 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 + */ + attackTypes: { + melee: "DS4.AttackTypeMelee", + ranged: "DS4.AttackTypeRanged", + meleeRanged: "DS4.AttackTypeMeleeRanged", + }, + + /** + * Define the set of item availabilties + */ + itemAvailabilities: { + unset: "DS4.ItemAvailabilityUnset", + hamlet: "DS4.ItemAvailabilityHamlet", + village: "DS4.ItemAvailabilityVilage", + city: "DS4.ItemAvailabilityCity", + elves: "DS4.ItemAvailabilityElves", + dwarves: "DS4.ItemAvailabilityDwarves", + nowhere: "DS4.ItemAvailabilityNowhere", + }, + + /** + * Define the set of item types + */ + itemTypes: { + weapon: "DS4.ItemTypeWeapon", + armor: "DS4.ItemTypeArmor", + shield: "DS4.ItemTypeShield", + spell: "DS4.ItemTypeSpell", + trinket: "DS4.ItemTypeTrinket", + equipment: "DS4.ItemTypeEquipment", + talent: "DS4.ItemTypeTalent", + racialAbility: "DS4.ItemTypeRacialAbility", + language: "DS4.ItemTypeLanguage", + alphabet: "DS4.ItemTypeAlphabet", + specialCreatureAbility: "DS4.ItemTypeSpecialCreatureAbility", + }, + + /** + * Define the set of armor types, a character may only wear one item of each at any given time + */ + armorTypes: { + body: "DS4.ArmorTypeBody", + helmet: "DS4.ArmorTypeHelmet", + vambrace: "DS4.ArmorTypeVambrace", + greaves: "DS4.ArmorTypeGreaves", + vambraceGreaves: "DS4.ArmorTypeVambraceGreaves", + }, + + /** + * Define abbreviations for the armor types + */ + armorTypesAbbr: { + body: "DS4.ArmorTypeBodyAbbr", + helmet: "DS4.ArmorTypeHelmetAbbr", + vambrace: "DS4.ArmorTypeVambraceAbbr", + greaves: "DS4.ArmorTypeGreavesAbbr", + vambraceGreaves: "DS4.ArmorTypeVambraceGreavesAbbr", + }, + + /** + * Define the set of armor materials, used to determine if a characer may wear the armor without additional penalties + */ + armorMaterialTypes: { + cloth: "DS4.ArmorMaterialTypeCloth", + leather: "DS4.ArmorMaterialTypeLeather", + chain: "DS4.ArmorMaterialTypeChain", + plate: "DS4.ArmorMaterialTypePlate", + }, + + /** + * Define the abbreviations of armor materials + */ + armorMaterialTypesAbbr: { + cloth: "DS4.ArmorMaterialTypeClothAbbr", + leather: "DS4.ArmorMaterialTypeLeatherAbbr", + chain: "DS4.ArmorMaterialTypeChainAbbr", + plate: "DS4.ArmorMaterialTypePlateAbbr", + }, + + spellTypes: { + spellcasting: "DS4.SpellTypeSpellcasting", + targetedSpellcasting: "DS4.SpellTypeTargetedSpellcasting", + }, + + spellCategories: { + healing: "DS4.SpellCategoryHealing", + fire: "DS4.SpellCategoryFire", + ice: "DS4.SpellCategoryIce", + light: "DS4.SpellCategoryLight", + darkness: "DS4.SpellCategoryDarkness", + mindAffecting: "DS4.SpellCategoryMindAffecting", + electricity: "DS4.SpellCategoryElectricity", + none: "DS4.SpellCategoryNone", + unset: "DS4.SpellCategoryUnset", + }, + + /** + * Define the set of actor types + */ + actorTypes: { + character: "DS4.ActorTypeCharacter", + creature: "DS4.ActorTypeCreature", + }, + + /** + * Define the set of attributes an actor has + */ + attributes: { + body: "DS4.AttributeBody", + mobility: "DS4.AttributeMobility", + mind: "DS4.AttributeMind", + }, + + /** + * Define the set of traits an actor has + */ + traits: { + strength: "DS4.TraitStrength", + agility: "DS4.TraitAgility", + intellect: "DS4.TraitIntellect", + constitution: "DS4.TraitConstitution", + dexterity: "DS4.TraitDexterity", + aura: "DS4.TraitAura", + }, + + /** + * Define the set of combat values an actor has + */ + combatValues: { + hitPoints: "DS4.CombatValuesHitPoints", + defense: "DS4.CombatValuesDefense", + initiative: "DS4.CombatValuesInitiative", + movement: "DS4.CombatValuesMovement", + meleeAttack: "DS4.CombatValuesMeleeAttack", + rangedAttack: "DS4.CombatValuesRangedAttack", + spellcasting: "DS4.CombatValuesSpellcasting", + targetedSpellcasting: "DS4.CombatValuesTargetedSpellcasting", + }, + + /** + * Define the base info of a character + */ + characterBaseInfo: { + race: "DS4.CharacterBaseInfoRace", + class: "DS4.CharacterBaseInfoClass", + heroClass: "DS4.CharacterBaseInfoHeroClass", + culture: "DS4.CharacterBaseInfoCulture", + }, + + /** + * Define the progression info of a character + */ + characterProgression: { + level: "DS4.CharacterProgressionLevel", + experiencePoints: "DS4.CharacterProgressionExperiencePoints", + talentPoints: "DS4.CharacterProgressionTalentPoints", + progressPoints: "DS4.CharacterProgressionProgressPoints", + }, + + /** + * Define the language info of a character + */ + characterLanguage: { + languages: "DS4.CharacterLanguageLanguages", + alphabets: "DS4.CharacterLanguageAlphabets", + }, + + /** + * Define the profile info of a character + */ + characterProfile: { + biography: "DS4.CharacterProfileBiography", + gender: "DS4.CharacterProfileGender", + birthday: "DS4.CharacterProfileBirthday", + birthplace: "DS4.CharacterProfileBirthplace", + age: "DS4.CharacterProfileAge", + height: "DS4.CharacterProfileHeight", + hairColor: "DS4.CharacterProfileHairColor", + weight: "DS4.CharacterProfileWeight", + eyeColor: "DS4.CharacterProfileEyeColor", + specialCharacteristics: "DS4.CharacterProfileSpecialCharacteristics", + }, + /** + * Define currency elements of a character + */ + characterCurrency: { + gold: "DS4.CharacterCurrencyGold", + silver: "DS4.CharacterCurrencySilver", + copper: "DS4.CharacterCurrencyCopper", + }, + + /** + * Define the different creature types a creature can be + */ + creatureTypes: { + animal: "DS4.CreatureTypeAnimal", + construct: "DS4.CreatureTypeConstruct", + humanoid: "DS4.CreatureTypeHumanoid", + magicalEntity: "DS4.CreatureTypeMagicalEntity", + plantBeing: "DS4.CreatureTypePlantBeing", + undead: "DS4.CreatureTypeUndead", + }, + + /** + * Define the different size categories creatures fall into + */ + creatureSizeCategories: { + tiny: "DS4.CreatureSizeCategoryTiny", + small: "DS4.CreatureSizeCategorySmall", + normal: "DS4.CreatureSizeCategoryNormal", + large: "DS4.CreatureSizeCategoryLarge", + huge: "DS4.CreatureSizeCategoryHuge", + colossal: "DS4.CreatureSizeCategoryColossal", + }, + + /** + * Define the base info of a creature + */ + creatureBaseInfo: { + loot: "DS4.CreatureBaseInfoLoot", + foeFactor: "DS4.CreatureBaseInfoFoeFactor", + creatureType: "DS4.CreatureBaseInfoCreatureType", + sizeCategory: "DS4.CreatureBaseInfoSizeCategory", + experiencePoints: "DS4.CreatureBaseInfoExperiencePoints", + description: "DS4.CreatureBaseInfoDescription", + }, + + /** + * Define translations for available distance units + */ + distanceUnits: { + meter: "DS4.UnitMeters", + kilometer: "DS4.UnitKilometers", + custom: "DS4.UnitCustom", + }, + /** + * Define abbreviations for available distance units + */ + distanceUnitsAbbr: { + meter: "DS4.UnitMetersAbbr", + kilometer: "DS4.UnitKilometersAbbr", + custom: "DS4.UnitCustomAbbr", + }, + + /** + * Define translations for available distance units + */ + temporalUnits: { + rounds: "DS4.UnitRounds", + minutes: "DS4.UnitMinutes", + hours: "DS4.UnitHours", + days: "DS4.UnitDays", + custom: "DS4.UnitCustom", + }, + + /** + * Define abbreviations for available units + */ + temporalUnitsAbbr: { + rounds: "DS4.UnitRoundsAbbr", + minutes: "DS4.UnitMinutesAbbr", + hours: "DS4.UnitHoursAbbr", + days: "DS4.UnitDaysAbbr", + custom: "DS4.UnitCustomAbbr", + }, + + /** + * Define localization strings for Chat Visibility + */ + chatVisibilities: { + roll: "DS4.ChatVisibilityRoll", + gmroll: "DS4.ChatVisibilityGmRoll", + blindroll: "DS4.ChatVisibilityBlindRoll", + selfroll: "DS4.ChatVisibilitySelfRoll", + }, }, /** @@ -34,182 +315,6 @@ export const DS4 = { targetedSpellcasting: "systems/ds4/assets/icons/official/combat-values/targeted-spellcasting.png", }, - /** - * Define the set of item availabilties - */ - itemAvailabilities: { - unset: "DS4.ItemAvailabilityUnset", - hamlet: "DS4.ItemAvailabilityHamlet", - village: "DS4.ItemAvailabilityVilage", - city: "DS4.ItemAvailabilityCity", - elves: "DS4.ItemAvailabilityElves", - dwarves: "DS4.ItemAvailabilityDwarves", - nowhere: "DS4.ItemAvailabilityNowhere", - }, - - /** - * Define the set of item types - */ - itemTypes: { - weapon: "DS4.ItemTypeWeapon", - armor: "DS4.ItemTypeArmor", - shield: "DS4.ItemTypeShield", - spell: "DS4.ItemTypeSpell", - trinket: "DS4.ItemTypeTrinket", - equipment: "DS4.ItemTypeEquipment", - talent: "DS4.ItemTypeTalent", - racialAbility: "DS4.ItemTypeRacialAbility", - language: "DS4.ItemTypeLanguage", - alphabet: "DS4.ItemTypeAlphabet", - specialCreatureAbility: "DS4.ItemTypeSpecialCreatureAbility", - }, - - /** - * Define the set of armor types, a character may only wear one item of each at any given time - */ - armorTypes: { - body: "DS4.ArmorTypeBody", - helmet: "DS4.ArmorTypeHelmet", - vambrace: "DS4.ArmorTypeVambrace", - greaves: "DS4.ArmorTypeGreaves", - vambraceGreaves: "DS4.ArmorTypeVambraceGreaves", - }, - - /** - * Define abbreviations for the armor types - */ - armorTypesAbbr: { - body: "DS4.ArmorTypeBodyAbbr", - helmet: "DS4.ArmorTypeHelmetAbbr", - vambrace: "DS4.ArmorTypeVambraceAbbr", - greaves: "DS4.ArmorTypeGreavesAbbr", - vambraceGreaves: "DS4.ArmorTypeVambraceGreavesAbbr", - }, - - /** - * Define the set of armor materials, used to determine if a characer may wear the armor without additional penalties - */ - armorMaterialTypes: { - cloth: "DS4.ArmorMaterialTypeCloth", - leather: "DS4.ArmorMaterialTypeLeather", - chain: "DS4.ArmorMaterialTypeChain", - plate: "DS4.ArmorMaterialTypePlate", - }, - - /** - * Define the abbreviations of armor materials - */ - armorMaterialTypesAbbr: { - cloth: "DS4.ArmorMaterialTypeClothAbbr", - leather: "DS4.ArmorMaterialTypeLeatherAbbr", - chain: "DS4.ArmorMaterialTypeChainAbbr", - plate: "DS4.ArmorMaterialTypePlateAbbr", - }, - - spellTypes: { - spellcasting: "DS4.SpellTypeSpellcasting", - targetedSpellcasting: "DS4.SpellTypeTargetedSpellcasting", - }, - - spellCategories: { - healing: "DS4.SpellCategoryHealing", - fire: "DS4.SpellCategoryFire", - ice: "DS4.SpellCategoryIce", - light: "DS4.SpellCategoryLight", - darkness: "DS4.SpellCategoryDarkness", - mindAffecting: "DS4.SpellCategoryMindAffecting", - electricity: "DS4.SpellCategoryElectricity", - none: "DS4.SpellCategoryNone", - unset: "DS4.SpellCategoryUnset", - }, - - /** - * Define the set of actor types - */ - actorTypes: { - character: "DS4.ActorTypeCharacter", - creature: "DS4.ActorTypeCreature", - }, - - /** - * Define the set of attributes an actor has - */ - attributes: { - body: "DS4.AttributeBody", - mobility: "DS4.AttributeMobility", - mind: "DS4.AttributeMind", - }, - - /** - * Define the set of traits an actor has - */ - traits: { - strength: "DS4.TraitStrength", - agility: "DS4.TraitAgility", - intellect: "DS4.TraitIntellect", - constitution: "DS4.TraitConstitution", - dexterity: "DS4.TraitDexterity", - aura: "DS4.TraitAura", - }, - - /** - * Define the set of combat values an actor has - */ - combatValues: { - hitPoints: "DS4.CombatValuesHitPoints", - defense: "DS4.CombatValuesDefense", - initiative: "DS4.CombatValuesInitiative", - movement: "DS4.CombatValuesMovement", - meleeAttack: "DS4.CombatValuesMeleeAttack", - rangedAttack: "DS4.CombatValuesRangedAttack", - spellcasting: "DS4.CombatValuesSpellcasting", - targetedSpellcasting: "DS4.CombatValuesTargetedSpellcasting", - }, - - /** - * Define the base info of a character - */ - characterBaseInfo: { - race: "DS4.CharacterBaseInfoRace", - class: "DS4.CharacterBaseInfoClass", - heroClass: "DS4.CharacterBaseInfoHeroClass", - culture: "DS4.CharacterBaseInfoCulture", - }, - - /** - * Define the progression info of a character - */ - characterProgression: { - level: "DS4.CharacterProgressionLevel", - experiencePoints: "DS4.CharacterProgressionExperiencePoints", - talentPoints: "DS4.CharacterProgressionTalentPoints", - progressPoints: "DS4.CharacterProgressionProgressPoints", - }, - - /** - * Define the language info of a character - */ - characterLanguage: { - languages: "DS4.CharacterLanguageLanguages", - alphabets: "DS4.CharacterLanguageAlphabets", - }, - - /** - * Define the profile info of a character - */ - characterProfile: { - biography: "DS4.CharacterProfileBiography", - gender: "DS4.CharacterProfileGender", - birthday: "DS4.CharacterProfileBirthday", - birthplace: "DS4.CharacterProfileBirthplace", - age: "DS4.CharacterProfileAge", - height: "DS4.CharacterProfileHeight", - hairColor: "DS4.CharacterProfileHairColor", - weight: "DS4.CharacterProfileWeight", - eyeColor: "DS4.CharacterProfileEyeColor", - specialCharacteristics: "DS4.CharacterProfileSpecialCharacteristics", - }, - /** * Define the profile info types for handlebars of a character */ @@ -225,98 +330,4 @@ export const DS4 = { eyeColor: "String", specialCharacteristics: "String", }, - - /** - * Define currency elements of a character - */ - characterCurrency: { - gold: "DS4.CharacterCurrencyGold", - silver: "DS4.CharacterCurrencySilver", - copper: "DS4.CharacterCurrencyCopper", - }, - - /** - * Define the different creature types a creature can be - */ - creatureTypes: { - animal: "DS4.CreatureTypeAnimal", - construct: "DS4.CreatureTypeConstruct", - humanoid: "DS4.CreatureTypeHumanoid", - magicalEntity: "DS4.CreatureTypeMagicalEntity", - plantBeing: "DS4.CreatureTypePlantBeing", - undead: "DS4.CreatureTypeUndead", - }, - - /** - * Define the different size categories creatures fall into - */ - creatureSizeCategories: { - tiny: "DS4.CreatureSizeCategoryTiny", - small: "DS4.CreatureSizeCategorySmall", - normal: "DS4.CreatureSizeCategoryNormal", - large: "DS4.CreatureSizeCategoryLarge", - huge: "DS4.CreatureSizeCategoryHuge", - colossal: "DS4.CreatureSizeCategoryColossal", - }, - - /** - * Define the base info of a creature - */ - creatureBaseInfo: { - loot: "DS4.CreatureBaseInfoLoot", - foeFactor: "DS4.CreatureBaseInfoFoeFactor", - creatureType: "DS4.CreatureBaseInfoCreatureType", - sizeCategory: "DS4.CreatureBaseInfoSizeCategory", - experiencePoints: "DS4.CreatureBaseInfoExperiencePoints", - description: "DS4.CreatureBaseInfoDescription", - }, - - /** - * Define translations for available distance units - */ - distanceUnits: { - meter: "DS4.UnitMeters", - kilometer: "DS4.UnitKilometers", - custom: "DS4.UnitCustom", - }, - /** - * Define abbreviations for available distance units - */ - distanceUnitsAbbr: { - meter: "DS4.UnitMetersAbbr", - kilometer: "DS4.UnitKilometersAbbr", - custom: "DS4.UnitCustomAbbr", - }, - - /** - * Define translations for available distance units - */ - temporalUnits: { - rounds: "DS4.UnitRounds", - minutes: "DS4.UnitMinutes", - hours: "DS4.UnitHours", - days: "DS4.UnitDays", - custom: "DS4.UnitCustom", - }, - - /** - * Define abbreviations for available units - */ - temporalUnitsAbbr: { - rounds: "DS4.UnitRoundsAbbr", - minutes: "DS4.UnitMinutesAbbr", - hours: "DS4.UnitHoursAbbr", - days: "DS4.UnitDaysAbbr", - custom: "DS4.UnitCustomAbbr", - }, - - /** - * Define localization strings for Chat Visibility - */ - chatVisibilities: { - roll: "DS4.ChatVisibilityRoll", - gmroll: "DS4.ChatVisibilityGmRoll", - blindroll: "DS4.ChatVisibilityBlindRoll", - selfroll: "DS4.ChatVisibilitySelfRoll", - }, }; diff --git a/src/module/ds4.ts b/src/module/ds4.ts index 81115a4c..a2f6ff2f 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.actorTypes; - CONFIG.Item.typeLabels = DS4.itemTypes; + CONFIG.Actor.typeLabels = DS4.i18nKeys.actorTypes; + CONFIG.Item.typeLabels = DS4.i18nKeys.itemTypes; // Configure Dice CONFIG.Dice.types = [Die, DS4Check]; @@ -84,46 +84,16 @@ async function registerHandlebarsPartials() { * This function runs after game data has been requested and loaded from the servers, so entities exist */ Hooks.once("setup", function () { - // Localize CONFIG objects once up-front - const toLocalize = [ - "attackTypes", - "itemAvailabilities", - "itemTypes", - "armorTypes", - "armorTypesAbbr", - "armorMaterialTypes", - "armorMaterialTypesAbbr", - "armorMaterialTypes", - "spellTypes", - "spellCategories", - "attributes", - "traits", - "combatValues", - "characterBaseInfo", - "characterProgression", - "characterLanguage", - "characterProfile", - "characterCurrency", - "creatureTypes", - "creatureSizeCategories", - "creatureBaseInfo", - "temporalUnits", - "temporalUnitsAbbr", - "distanceUnits", - "distanceUnitsAbbr", - "chatVisibilities", - ]; - // Exclude some from sorting where the default order matters const noSort = ["attributes", "traits", "combatValues", "creatureSizeCategories"]; // Localize and sort CONFIG objects - for (const o of toLocalize) { - const localized = Object.entries(CONFIG.DS4[o]).map((e) => { + for (const o of Object.keys(CONFIG.DS4.i18nKeys)) { + const localized = Object.entries(CONFIG.DS4.i18nKeys[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])); - CONFIG.DS4[o] = localized.reduce((obj, e) => { + CONFIG.DS4.i18n[o] = localized.reduce((obj, e) => { obj[e[0]] = e[1]; return obj; }, {}); diff --git a/src/module/item/item-data.ts b/src/module/item/item-data.ts index d7467f8a..63951e46 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.itemTypes; +export type ItemType = keyof typeof DS4.i18nKeys.itemTypes; export type DS4ItemDataType = | DS4Weapon diff --git a/src/templates/actor/character-sheet.hbs b/src/templates/actor/character-sheet.hbs index 0fb538f9..d63758e3 100644 --- a/src/templates/actor/character-sheet.hbs +++ b/src/templates/actor/character-sheet.hbs @@ -13,20 +13,20 @@
    + for="data.baseInfo.race">{{config.i18n.characterBaseInfo.race}}
    + for="data.baseInfo.culture">{{config.i18n.characterBaseInfo.culture}}
    + for="data.progression.progressPoints.used">{{config.i18n.characterProgression.progressPoints}}
    + for="data.progression.talentPoints.used">{{config.i18n.characterProgression.talentPoints}}
    + for="data.baseInfo.class">{{config.i18n.characterBaseInfo.class}}
    + for="data.baseInfo.heroClass">{{config.i18n.characterBaseInfo.heroClass}} diff --git a/src/templates/actor/creature-sheet.hbs b/src/templates/actor/creature-sheet.hbs index 7571eaba..424dbcc2 100644 --- a/src/templates/actor/creature-sheet.hbs +++ b/src/templates/actor/creature-sheet.hbs @@ -6,10 +6,10 @@

    - +
    + for="data.baseInfo.foeFactor">{{config.i18n.creatureBaseInfo.foeFactor}}
    - +
    diff --git a/src/templates/actor/partials/attributes-traits.hbs b/src/templates/actor/partials/attributes-traits.hbs index 14fece65..9c12a6ae 100644 --- a/src/templates/actor/partials/attributes-traits.hbs +++ b/src/templates/actor/partials/attributes-traits.hbs @@ -42,11 +42,11 @@ {{!-- ======================================================================== --}}
    - {{#each config.attributes as |attribute-label attribute-key|}} + {{#each config.i18n.attributes as |attribute-label attribute-key|}} {{> attribute attribute-label=attribute-label attribute-key=attribute-key attribute-data=(lookup ../data.attributes attribute-key)}} {{/each}} - {{#each config.traits as |trait-label trait-key|}} + {{#each config.i18n.traits as |trait-label trait-key|}} {{> trait trait-label=trait-label trait-key=trait-key trait-data=(lookup ../data.traits trait-key)}} {{/each}}
    diff --git a/src/templates/actor/partials/character-inventory.hbs b/src/templates/actor/partials/character-inventory.hbs index 19a4009d..b27fff63 100644 --- a/src/templates/actor/partials/character-inventory.hbs +++ b/src/templates/actor/partials/character-inventory.hbs @@ -4,13 +4,13 @@

    {{localize 'DS4.CharacterCurrency'}}

    1. - + - + - +
    2. diff --git a/src/templates/actor/partials/character-progression.hbs b/src/templates/actor/partials/character-progression.hbs index fd0a3932..e890a024 100644 --- a/src/templates/actor/partials/character-progression.hbs +++ b/src/templates/actor/partials/character-progression.hbs @@ -1,6 +1,6 @@
      -

      +

      + for="data.progression.experiencePoints">{{config.i18n.characterProgression.experiencePoints}}

      - {{#each config.combatValues as |combat-value-label combat-value-key|}} + {{#each config.i18n.combatValues as |combat-value-label combat-value-key|}} {{> combat-value combat-value-key=combat-value-key combat-value-data=(lookup ../data.combatValues combat-value-key)}} {{/each}} diff --git a/src/templates/actor/partials/items-overview.hbs b/src/templates/actor/partials/items-overview.hbs index 55b34411..f8ca7d8f 100644 --- a/src/templates/actor/partials/items-overview.hbs +++ b/src/templates/actor/partials/items-overview.hbs @@ -111,7 +111,7 @@ {{#> itemListEntry item=item}}
      + title="{{lookup ../../config.i18n.attackTypes item.data.data.attackType}}" width="24" height="24" />
      {{ item.data.data.weaponBonus}}
      {{ item.data.data.opponentDefense}}
      @@ -135,11 +135,11 @@ {{/itemListHeader}} {{#each itemsByType.armor as |item id|}} {{#> itemListEntry item=item }} -
      - {{lookup ../../config.armorMaterialTypesAbbr item.data.data.armorMaterialType}} +
      + {{lookup ../../config.i18n.armorMaterialTypesAbbr item.data.data.armorMaterialType}}
      -
      - {{lookup ../../config.armorTypesAbbr item.data.data.armorType}} +
      + {{lookup ../../config.i18n.armorTypesAbbr item.data.data.armorType}}
      {{ item.data.data.armorValue}}
      {{/itemListEntry}} diff --git a/src/templates/actor/partials/profile.hbs b/src/templates/actor/partials/profile.hbs index be95eeb5..2a520d8b 100644 --- a/src/templates/actor/partials/profile.hbs +++ b/src/templates/actor/partials/profile.hbs @@ -4,10 +4,10 @@ {{#if (ne profile-data-key 'biography')}}
      + data-dtype="{{lookup ../config.i18n.characterProfileDTypes profile-data-key}}" />
      {{/if}} {{/each}} diff --git a/src/templates/actor/partials/spells-overview.hbs b/src/templates/actor/partials/spells-overview.hbs index 8bcd33e3..f82237ff 100644 --- a/src/templates/actor/partials/spells-overview.hbs +++ b/src/templates/actor/partials/spells-overview.hbs @@ -23,11 +23,11 @@ !-- directly handing over the latter two. --}} {{#*inline "temporalUnit"}} -{{> unit unitNames=config.temporalUnits unitAbbrs=config.temporalUnitsAbbr unitDatum=unitDatum localizationString=localizationString}} +{{> unit unitNames=config.i18n.temporalUnits unitAbbrs=config.i18n.temporalUnitsAbbr unitDatum=unitDatum localizationString=localizationString}} {{/inline}} {{#*inline "distanceUnit"}} -{{> unit unitNames=config.distanceUnits unitAbbrs=config.distanceUnitsAbbr unitDatum=unitDatum localizationString=localizationString}} +{{> unit unitNames=config.i18n.distanceUnits unitAbbrs=config.i18n.distanceUnitsAbbr unitDatum=unitDatum localizationString=localizationString}} {{/inline}} @@ -72,7 +72,7 @@ {{!-- spell type --}}
      + title="{{lookup ../config.i18n.spellTypes item.data.data.spellType}}" width="24" height="24" />
      {{!-- spell bonus --}} {{localize "DS4.ArmorType"}} {{#select data.armorMaterialType}} - {{#each config.armorMaterialTypes as |value key|}} + {{#each config.i18n.armorMaterialTypes as |value key|}} {{/each}} {{/select}} diff --git a/src/templates/item/partials/details.hbs b/src/templates/item/partials/details.hbs index 0408641a..69f7526a 100644 --- a/src/templates/item/partials/details.hbs +++ b/src/templates/item/partials/details.hbs @@ -11,7 +11,7 @@ -

      {{localize (lookup config.itemTypes item.type)}}

      +

      {{lookup config.i18n.itemTypes item.type}}

      {{> @partial-block}}
      \ No newline at end of file diff --git a/src/templates/item/spell-sheet.hbs b/src/templates/item/spell-sheet.hbs index 4e180755..4fdd6dc1 100644 --- a/src/templates/item/spell-sheet.hbs +++ b/src/templates/item/spell-sheet.hbs @@ -12,9 +12,9 @@ @@ -33,7 +33,7 @@ {{#select data.spellCategory}} - {{#each config.spellCategories as |value key|}} + {{#each config.i18n.spellCategories as |value key|}} {{/each}} {{/select}} diff --git a/src/templates/item/weapon-sheet.hbs b/src/templates/item/weapon-sheet.hbs index b92bf97f..65005984 100644 --- a/src/templates/item/weapon-sheet.hbs +++ b/src/templates/item/weapon-sheet.hbs @@ -5,7 +5,7 @@ {{#each rollModes as |rollMode|}} - + {{/each}} From 62ab89f83bb4d951366c223b44a784635bd2b638 Mon Sep 17 00:00:00 2001 From: Gesina Schwalbe Date: Sun, 24 Jan 2021 17:56:32 +0100 Subject: [PATCH 5/6] moved icon mappings in CONFIG.DS4.icons --- src/module/config.ts | 29 +++++++++++-------- .../actor/partials/items-overview.hbs | 2 +- .../actor/partials/spells-overview.hbs | 2 +- 3 files changed, 19 insertions(+), 14 deletions(-) diff --git a/src/module/config.ts b/src/module/config.ts index 5654c189..0f1bd1e0 100644 --- a/src/module/config.ts +++ b/src/module/config.ts @@ -299,20 +299,25 @@ export const DS4 = { }, /** - * Define the file paths to icon images + * A dictionary of dictionaries mapping keys to icon file paths. */ - attackTypesIcons: { - melee: "systems/ds4/assets/icons/official/combat-values/melee-attack.png", - meleeRanged: "systems/ds4/assets/icons/official/combat-values/melee-ranged-attack.png", - ranged: "systems/ds4/assets/icons/official/combat-values/ranged-attack.png", - }, + icons: { + /** + * Define the file paths to icon images + */ + attackTypes: { + melee: "systems/ds4/assets/icons/official/combat-values/melee-attack.png", + meleeRanged: "systems/ds4/assets/icons/official/combat-values/melee-ranged-attack.png", + ranged: "systems/ds4/assets/icons/official/combat-values/ranged-attack.png", + }, - /** - * Define the file paths to icon images - */ - spellTypesIcons: { - spellcasting: "systems/ds4/assets/icons/official/combat-values/spellcasting.png", - targetedSpellcasting: "systems/ds4/assets/icons/official/combat-values/targeted-spellcasting.png", + /** + * Define the file paths to icon images + */ + spellTypes: { + spellcasting: "systems/ds4/assets/icons/official/combat-values/spellcasting.png", + targetedSpellcasting: "systems/ds4/assets/icons/official/combat-values/targeted-spellcasting.png", + }, }, /** diff --git a/src/templates/actor/partials/items-overview.hbs b/src/templates/actor/partials/items-overview.hbs index f8ca7d8f..b7d5fbf7 100644 --- a/src/templates/actor/partials/items-overview.hbs +++ b/src/templates/actor/partials/items-overview.hbs @@ -110,7 +110,7 @@ {{#each itemsByType.weapon as |item id|}} {{#> itemListEntry item=item}}
      -
      {{ item.data.data.weaponBonus}}
      diff --git a/src/templates/actor/partials/spells-overview.hbs b/src/templates/actor/partials/spells-overview.hbs index f82237ff..819cb45a 100644 --- a/src/templates/actor/partials/spells-overview.hbs +++ b/src/templates/actor/partials/spells-overview.hbs @@ -71,7 +71,7 @@ data-property="name" title="{{localize 'DS4.ItemName'}}" /> {{!-- spell type --}}
      -
      {{!-- spell bonus --}} From 0b70bbf9b90987e34df756fd2742e4586fcc144f Mon Sep 17 00:00:00 2001 From: Gesina Schwalbe Date: Tue, 26 Jan 2021 20:47:28 +0100 Subject: [PATCH 6/6] merged i18n and i18nKeys --- src/module/config.ts | 11 +++-------- src/module/ds4.ts | 8 ++++---- src/module/item/item-data.ts | 2 +- 3 files changed, 8 insertions(+), 13 deletions(-) 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