Skip to content

Commit

Permalink
Localization Update
Browse files Browse the repository at this point in the history
# Changelog
## lang\de.json
* Added German translation. Credit to [Karsten W](https://github.com/KarstenW76) for help in translating the module.

## lang\en.json
* Added a "Common" section for keys that are used in more than one location.
* Added "Visible" key to "Common"
* Added "Hidden" key to "Common"
* Added "Objective" key to "Editor"
* Added "ActiveQuests" key to "Tracker"
* Added "AddQuest" key to "Tracker"
* Added "Delete" key to "Tracker"
* Added "Edit" key to "Tracker"
* Added "Expand" key to "Tracker"
* Added "Minimize" key to "Tracker"
* Added "Title" key to "Tracker"
* Added "Incomplete" key to "Tracker"
* Added "Complete" key to "Tracker"
* Added "Failed" key to "Tracker"

## module.json
* Incremented module build version from "0.1.2" to "0.1.3"
* Added German to language options.

## scripts\helpers\settings.json
* Renamed "Active Quests" hidden setting to "Expanded Quests" for clarity

## scripts\ui\questeditor.js
* Removed line 134 to stop localizing text. This should be done in the template for consistency.

## scripts\ui\ui-manager.js
* Changed `#controls` from an object to a getter function to fix a bug where the object would attempt to initialize before `game.i18n` exists.
* Changed `#headerButtons`  from an object to a getter function to fix a bug where the object would attempt to initialize before `game.i18n` exists.

## scripts\ui\editor.hbs
* Added localized `title` attribute to eye icon to state visibility.
* Added localized `title` attribute to eye-slash icon to state visibility.
* Replaced hardcoded text "Objectives:" with localized string
* Replaced data reference of `saveText` to a localized string as this value is no longer provided by `scripts\ui\questeditor.js`

## templates\tracker-body.hbs
* Replaced hardcoded text "Visible" with localized string
* Replaced hardcoded text "Hidden" with localized string
* Replaced hardcoded text "Edit" with localized string
* Replaced hardcoded text "Delete" with localized string
* Added localized `title` attribute to complete icon
* Added localized `title` attribute to failed icon
* Added localized `title` attribute to incomplete icon

## templates\tracker-body.hbs
* Added localized `title` attribute to expand icon
* Replaced hardcoded text "Active Quests" with localized string
* Replaced hardcoded text "Add Quest" with localized string
* Added localized `title` attribute to minimize icon
  • Loading branch information
MythicPalette committed Sep 29, 2024
1 parent 8a3c3ff commit 23572df
Show file tree
Hide file tree
Showing 9 changed files with 128 additions and 47 deletions.
65 changes: 65 additions & 0 deletions lang/de.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
{
"SimplerQuests": {
"Common": {
"Visible": "Sichtbar",
"Hidden": "Versteckt"
},
"Controls": {
"Tracker": "Quest-Log"
},
"DeleteDialog": {
"Title": "Quest löschen",
"Message": "Bist du sicher, dass du \"{title}\" löschen möchtest?"
},
"Editor": {
"Title": "Quest Editor",
"SaveText": "Speichern",
"ViewStyle": "Ansicht",
"Objectives": "Ziele:"
},
"Quest": {
"New": "Neue Quest"
},
"Settings": {
"ExpandMultiple": {
"Name": "Erlaube das Erweitern mehrerer Quests",
"Hint": "Wenn diese Option aktiviert ist, kannst du mehrere Quests im Log erweitern. Ist sie deaktiviert, werden beim Erweitern einer Quest alle anderen geschlossen (das spart Platz)."
},
"ViewStyle": {
"Name": "Standard-Ansicht für Quests",
"Hint": "Steuert, wie Quest-Ziele den Spielern angezeigt werden. Enthält keine geheimen Ziele.",
"All": "Alle Quest-Ziele",
"Next": "Nur bis zum nächsten Quest-Ziel",
"Complete": "Nur abgeschlossene Quest-Ziele"
},
"TrackerDocked": {
"Name": "Quest-Log andocken",
"Hint": "Wenn aktiviert, ist das Quest-Log an die Seitenleiste angedockt. Wenn deaktiviert, ist das Quest-Log ein schwebendes Fenster. (Neuladen erforderlich)"
},
"TrackerOffset": {
"Name": "Quest-Log verschieben",
"Hint": "Passt die Position des Quest-Logs an, wenn es angedockt ist. Je höher die Zahl, desto niedriger die Position des Quest-Logs."
},
"TrackerWidth": {
"Name": "Quest-Log Breite",
"Hint": "Legt die Breite (in Pixeln) des Quest-Logs fest, wenn es angedockt ist. Hat keine Auswirkung, wenn schwebend.."
},
"TrackerMaxHeight": {
"Name": "Quest-Log Max Höhe",
"Hint": "Legt die maximale Höhe (in Pixeln) des Quest-Logs fest, wenn es angedockt ist. Hat keine Auswirkung, wenn schwebend."
}
},
"Tracker": {
"ActiveQuests": "Aktive Quests",
"AddQuest": "Quest hinzufügen",
"Delete": "Löschen",
"Edit": "Bearbeiten",
"Expand": "Erweitern",
"Minimize": "Minimieren",
"Title": "Quest-Tracker",
"Incomplete": "Unvollständig",
"Complete": "Abgeschlossen",
"Failed": "Gescheitert"
}
}
}
18 changes: 16 additions & 2 deletions lang/en.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
{
"SimplerQuests": {
"Common": {
"Visible": "Visible",
"Hidden": "Hidden"
},
"Controls": {
"Tracker": "Quest Tracker"
},
Expand All @@ -10,7 +14,8 @@
"Editor": {
"Title": "Quest Editor",
"SaveText": "Save",
"ViewStyle": "View Style"
"ViewStyle": "View Style",
"Objectives": "Objectives:"
},
"Quest": {
"New": "New Quest"
Expand Down Expand Up @@ -45,7 +50,16 @@
}
},
"Tracker": {
"Title": "Quest Tracker"
"ActiveQuests": "Active Quests",
"AddQuest": "Add Quest",
"Delete": "Delete",
"Edit": "Edit",
"Expand": "Expand",
"Minimize": "Minimize",
"Title": "Quest Tracker",
"Incomplete": "Incomplete",
"Complete": "Complete",
"Failed": "Failed"
}
}
}
7 changes: 6 additions & 1 deletion module.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
}
}
],
"version": "0.1.2",
"version": "0.1.3",
"compatibility": {
"minimum": "12",
"verified": "12"
Expand All @@ -22,6 +22,11 @@
"lang": "en",
"name": "English",
"path": "lang/en.json"
},
{
"lang": "de",
"name": "German",
"path": "lang/de.json"
}
],
"esmodules": ["scripts/init.js"],
Expand Down
2 changes: 1 addition & 1 deletion scripts/helpers/settings.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ export class Settings {
});

game.settings.register(constants.moduleName, this.NAMES.ACTIVE_QUESTS, {
name: "Active Quests",
name: "Expanded Quests",
scope: "local",
type: Object,
default: { active: [] },
Expand Down
1 change: 0 additions & 1 deletion scripts/ui/questeditor.js
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,6 @@ export class QuestEditor extends Application {
title: "Quest Editor Test",
questTitle: this.quest.title,
objectives: objectiveString,
saveText: game.i18n.localize("SimplerQuests.Editor.SaveText"),
visible: this.quest.visible,
viewStyle: viewStyle,
viewStyleHint: this.#viewStyles[viewStyle],
Expand Down
52 changes: 25 additions & 27 deletions scripts/ui/ui-manager.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,37 +10,35 @@ export class UIManager {
return this.#tracker;
}

static #controls = Object.freeze([
{
name: constants.moduleName,
title: "SimplerQuests.Controls.Tracker",
icon: "fas fa-scroll",
visible: true,
onClick: () =>
UIManager.tracker.render(true, {
focus: true,
}),
button: true,
},
]);
static get controls() {
return this.#controls;
return [
{
name: constants.moduleName,
title: "SimplerQuests.Controls.Tracker",
icon: "fas fa-scroll",
visible: true,
onClick: () =>
UIManager.tracker.render(true, {
focus: true,
}),
button: true,
},
];
}

static #headerButtons = Object.freeze([
{
class: "add-quest",
icon: "fa-solid fa-plus",
tooltip: "Add Quest",
onclick: () => {
// Load a blank QuestEditor and render.
let qe = new QuestEditor();
qe.render(true, { focus: true });
},
},
]);
static get headerButtons() {
return this.#headerButtons;
return [
{
class: "add-quest",
icon: "fa-solid fa-plus",
tooltip: game.i18n.localize("SimplerQuests.Tracker.AddQuest"),
onclick: () => {
// Load a blank QuestEditor and render.
let qe = new QuestEditor();
qe.render(true, { focus: true });
},
},
];
}

static init() {
Expand Down
8 changes: 4 additions & 4 deletions templates/editor.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@
/>
<div class="quest-visibility">
{{#if this.visible}}
<i class="fa-solid fa-eye"></i>
<i class="fa-solid fa-eye" title="{{localize 'SimplerQuests.Common.Visible'}}"></i>
{{else}}
<i class="fa-solid fa-eye-slash"></i>
<i class="fa-solid fa-eye-slash" title="{{localize 'SimplerQuests.Common.Hidden'}}"></i>
{{/if}}
</div>
</div>
Expand All @@ -33,11 +33,11 @@
</div>
</div>
</div>
<p>Objectives:</p>
<p>{{localize 'SimplerQuests.Editor.Objectives'}}</p>
<textarea
id="quest-objective-input"
class="dark-textarea no-resize quest-objectives"
>{{this.objectives}}</textarea>
<button class="save-quest"><i class="fa-solid fa-floppy-disk"></i>
{{saveText}}</button>
{{localize 'SimplerQuests.Editor.SaveText'}}</button>
</div>
14 changes: 7 additions & 7 deletions templates/tracker-body.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -7,24 +7,24 @@
<h3>{{this.title}}</h3>
{{#if ../isGM}}
{{#if this.visible}}
<div class="vis-toggle" title="Visible"><i class="fa-solid fa-eye"></i></div>
<div class="vis-toggle" title="{{localize 'SimplerQuests.Common.Visible'}}"><i class="fa-solid fa-eye"></i></div>
{{else}}
<div class="vis-toggle" title="Hidden"><i class="fa-solid fa-eye-slash"></i></div>
<div class="vis-toggle" title="{{localize 'SimplerQuests.Common.Hidden'}}"><i class="fa-solid fa-eye-slash"></i></div>
{{/if}}
<div class="edit" title="Edit"><i class="fa-solid fa-pen-to-square"></i></div>
<div class="delete" title="Delete"><i class="fa-solid fa-trash"></i></div>
<div class="edit" title="{{localize 'SimplerQuests.Tracker.Edit'}}"><i class="fa-solid fa-pen-to-square"></i></div>
<div class="delete" title="{{localize 'SimplerQuests.Tracker.Delete'}}"><i class="fa-solid fa-trash"></i></div>
{{/if}}
</div>
{{#if (simplerQuestIsActiveQuest ../activeQuests this.id)}}
{{#each this.objectives}}
<div class="simpler-quest-objective{{#unless (simplerQuestsEquals this.state 0)}} complete{{/unless}}{{#if (simplerQuestsEquals this.state -1)}} failed{{/if}}{{#if this.secret}} secret{{/if}}"
data-index="{{this.index}}">
{{#if (simplerQuestsEquals this.state 1)}}
<i class="fa-regular fa-square-check"></i>
<i class="fa-regular fa-square-check" title="{{localize 'SimplerQuests.Tracker.Complete'}}"></i>
{{else if (simplerQuestsEquals this.state -1)}}
<i class="fa-solid fa-square-xmark"></i>
<i class="fa-solid fa-square-xmark" title="{{localize 'SimplerQuests.Tracker.Failed'}}"></i>
{{else}}
<i class="fa-regular fa-square"></i>
<i class="fa-regular fa-square" title="{{localize 'SimplerQuests.Tracker.Incomplete'}}"></i>
{{/if}}
{{this.text}}
</div>
Expand Down
8 changes: 4 additions & 4 deletions templates/tracker-dock.hbs
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
<section class="simpler-quests tracker{{#if collapsed}} collapsed{{/if}} docked" style="--offset: {{offset}}; --trackerWidth: {{trackerWidth}}px; --trackerMaxHeight: {{trackerMaxH}}px;">
{{#if collapsed}}
<div class="header">
<div class="minimize"><i class="fas fa-scroll"></i></div>
<div class="minimize" title="{{localize 'SimplerQuests.Tracker.Expand'}}"><i class="fas fa-scroll"></i></div>
</div>
{{else}}
<div class="header">
<h3>Active Quests</h3>
<h3>{{localize 'SimplerQuests.Tracker.ActiveQuests'}}</h3>
{{#if isGM}}
<div class="new-quest" title="Add Quest"><i class="fa-solid fa-plus"></i></div>
<div class="new-quest" title="{{localize 'SimplerQuests.Tracker.AddQuest'}}"><i class="fa-solid fa-plus"></i></div>
{{/if}}
<div class="minimize"><i class="fa-solid fa-window-minimize"></i></div>
<div class="minimize" title="{{localize 'SimplerQuests.Tracker.Minimize'}}"><i class="fa-solid fa-window-minimize"></i></div>
</div>
{{> trackerBody}}
{{/if}}
Expand Down

0 comments on commit 23572df

Please sign in to comment.