From bb67788abcb14ca9fc1dae2eb8c84dede4edffa5 Mon Sep 17 00:00:00 2001
From: Johannes Loher <johannes.loher@fg4f.de>
Date: Thu, 22 Jul 2021 02:20:17 +0200
Subject: [PATCH] Localize names / labels of newly created embedded items /
 effects

---
 src/lang/de.json                       | 15 ++++++++++++++-
 src/lang/en.json                       | 15 ++++++++++++++-
 src/module/actor/sheets/actor-sheet.ts |  4 ++--
 src/module/item/item-sheet.ts          |  2 +-
 4 files changed, 31 insertions(+), 5 deletions(-)

diff --git a/src/lang/de.json b/src/lang/de.json
index 5a6b293..62b6bd3 100644
--- a/src/lang/de.json
+++ b/src/lang/de.json
@@ -258,6 +258,7 @@
     "DS4.ErrorActorDoesNotHaveItem": "Der Aktor '{actor}' hat kein Item mit der ID '{id}'.",
     "DS4.ErrorUnexpectedError": "Es gab einen unerwarteten Fehler im Dungeonslayers 4 System. Für mehr Details schauen Sie bitte in die Konsole (F12).",
     "DS4.ErrorItemDoesNotHaveEffect": "Das Item '{item}' hat keinen Effekt mit der ID '{id}'.",
+    "DS4.ErrorActorDoesNotHaveEffect": "Der Aktor '{actor}' hat keinen Effekt mit der ID '{id}'.",
     "DS4.DialogRollOptionsCheckTargetNumberLabel": "Probenwert",
     "DS4.DialogRollOptionsGMModifierLabel": "SL-Modifikator",
     "DS4.DialogRollOptionsMaximumCoupResultLabel": "Immersieg bis",
@@ -300,5 +301,17 @@
     "DS4.ChecksWorkMechanism": "Mechanismus Öffnen",
     "DS4.ActorCheckFlavor": "{actor} würfelt eine {check} Probe.",
     "DS4.ActorGenericCheckFlavor": "{actor} würfelt eine Probe gegen {attribute} + {trait}.",
-    "DS4.CheckTooltip": "{check} Probe würfeln"
+    "DS4.CheckTooltip": "{check} Probe würfeln",
+    "DS4.NewWeaponName": "Neue Waffe",
+    "DS4.NewArmorName": "Neue Panzerung",
+    "DS4.NewShieldName": "Neuer Schild",
+    "DS4.NewSpellName": "Neuer Zauberspruch",
+    "DS4.NewEquipmentName": "Neue Ausrüstung",
+    "DS4.NewLootName": "Neue Beute",
+    "DS4.NewTalentName": "Neues Talent",
+    "DS4.NewRacialAbilityName": "Neue Volksfähigkeit",
+    "DS4.NewLanguageName": "Neue Sprache",
+    "DS4.NewAlphabetName": "Neue Schriftzeichen",
+    "DS4.NewSpecialCreatureAbilityName": "Neue Besondere Kreaturenfähigkeit",
+    "DS4.NewEffectLabel": "Neuer Effekt"
 }
diff --git a/src/lang/en.json b/src/lang/en.json
index 9ce4238..c68a490 100644
--- a/src/lang/en.json
+++ b/src/lang/en.json
@@ -258,6 +258,7 @@
     "DS4.ErrorActorDoesNotHaveItem": "The actor '{actor}' does not have any item with the id '{id}'.",
     "DS4.ErrorUnexpectedError": "There was an unexpected error in the Dungeonslayers 4 system. For more details, please take a look at the console (F12).",
     "DS4.ErrorItemDoesNotHaveEffect": "The item '{item}' does not have any effect with the id '{id}'.",
+    "DS4.ErrorActorDoesNotHaveEffect": "The actor '{actor}' does not have any effect with the id '{id}'.",
     "DS4.DialogRollOptionsCheckTargetNumberLabel": "Check Target Number",
     "DS4.DialogRollOptionsGMModifierLabel": "Game Master Modifier",
     "DS4.DialogRollOptionsMaximumCoupResultLabel": "Coup to",
@@ -300,5 +301,17 @@
     "DS4.ChecksWorkMechanism": "Work Mechanism",
     "DS4.ActorCheckFlavor": "{actor} rolls a {check} check.",
     "DS4.ActorGenericCheckFlavor": "{actor} rolls a check against {attribute} + {trait}.",
-    "DS4.CheckTooltip": "Roll a {check} check"
+    "DS4.CheckTooltip": "Roll a {check} check",
+    "DS4.NewWeaponName": "New Weapon",
+    "DS4.NewArmorName": "New Armor",
+    "DS4.NewShieldName": "New Shield",
+    "DS4.NewSpellName": "New Spell",
+    "DS4.NewEquipmentName": "New Equipment",
+    "DS4.NewLootName": "New Loot",
+    "DS4.NewTalentName": "News Talent",
+    "DS4.NewRacialAbilityName": "New Racial Ability",
+    "DS4.NewLanguageName": "New Language",
+    "DS4.NewAlphabetName": "New Alphabet",
+    "DS4.NewSpecialCreatureAbilityName": "New Special Creature Ability",
+    "DS4.NewEffectLabel": "New Effect"
 }
diff --git a/src/module/actor/sheets/actor-sheet.ts b/src/module/actor/sheets/actor-sheet.ts
index d68d29e..373f755 100644
--- a/src/module/actor/sheets/actor-sheet.ts
+++ b/src/module/actor/sheets/actor-sheet.ts
@@ -147,7 +147,7 @@ export class DS4ActorSheet extends ActorSheet<ActorSheet.Options, DS4ActorSheetD
 
         const { type, ...data } = foundry.utils.deepClone(header.dataset);
 
-        const name = `New ${type.capitalize()}`;
+        const name = getGame().i18n.localize(`DS4.New${type.capitalize()}Name`);
 
         const itemData = {
             name: name,
@@ -259,7 +259,7 @@ export class DS4ActorSheet extends ActorSheet<ActorSheet.Options, DS4ActorSheetD
 
     protected onCreateEffect(): void {
         const createData = {
-            label: "New Effect",
+            label: getGame().i18n.localize(`DS4.NewEffectLabel`),
             icon: "icons/svg/aura.svg",
             origin: this.actor.uuid,
         };
diff --git a/src/module/item/item-sheet.ts b/src/module/item/item-sheet.ts
index 7fc5f8e..eca1d17 100644
--- a/src/module/item/item-sheet.ts
+++ b/src/module/item/item-sheet.ts
@@ -99,7 +99,7 @@ export class DS4ItemSheet extends ItemSheet<ItemSheet.Options, DS4ItemSheetData>
      */
     protected async createActiveEffect(): Promise<ActiveEffect | undefined> {
         const createData = {
-            label: "New Effect",
+            label: getGame().i18n.localize(`DS4.NewEffectLabel`),
             icon: "icons/svg/aura.svg",
             origin: this.item.uuid,
         };