aboutsummaryrefslogtreecommitdiff
path: root/src/lib/Tools/Tracker
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/Tools/Tracker')
-rw-r--r--src/lib/Tools/Tracker/Tool.svelte34
1 files changed, 24 insertions, 10 deletions
diff --git a/src/lib/Tools/Tracker/Tool.svelte b/src/lib/Tools/Tracker/Tool.svelte
index 8f7a3197..b495522a 100644
--- a/src/lib/Tools/Tracker/Tool.svelte
+++ b/src/lib/Tools/Tracker/Tool.svelte
@@ -4,6 +4,8 @@ import { v6 as uuidv6 } from "uuid";
import { database, type TrackerEntry } from "$lib/Database/IDB/tracker";
import { onMount } from "svelte";
import Message from "$lib/Loading/Message.svelte";
+import locale from "$stores/locale";
+import { get } from "svelte/store";
let url = "";
let title = "";
@@ -34,15 +36,19 @@ const adjustEntry = (id: string, to: number) => {
const addEntry = async (url: string, title: string, progress: number) => {
if (!url || !title) {
- error = "URL and title are required fields";
+ error =
+ get(locale)().tools.tracker?.urlTitleRequired ??
+ "URL and title are required fields";
return;
}
if (listAccess.some((entry) => entry.url === url)) {
- error =
- "Entry with URL already exists: " +
- listAccess.find((entry) => entry.url === url)?.title;
+ const existing = listAccess.find((entry) => entry.url === url)?.title;
+
+ error = (
+ get(locale)().tools.tracker?.entryExists ?? "Entry with URL already exists: {url}"
+ ).replace("{url}", existing ?? "");
return;
}
@@ -55,7 +61,9 @@ const addEntry = async (url: string, title: string, progress: number) => {
const deleteEntry = async (id: string) => {
if (confirmDelete !== 1) {
confirmDelete = 1;
- error = "Click again to confirm deletion";
+ error =
+ get(locale)().tools.tracker?.confirmDelete ??
+ "Click again to confirm deletion";
return;
}
@@ -73,10 +81,16 @@ const deleteEntry = async (id: string) => {
<p><b>Error</b>: {error}</p>
{/if}
- <input type="url" placeholder="URL" bind:value={url} />
- <input type="text" placeholder="Title" bind:value={title} />
- <input type="number" placeholder="Progress (defaults to 0)" bind:value={progress} />
- <button class="button-lined" onclick={() => addEntry(url, title, progress)}> Add </button>
+ <input type="url" placeholder={$locale().tools.tracker?.urlPlaceholder} bind:value={url} />
+ <input type="text" placeholder={$locale().tools.tracker?.titlePlaceholder} bind:value={title} />
+ <input
+ type="number"
+ placeholder={$locale().tools.tracker?.progressPlaceholder}
+ bind:value={progress}
+ />
+ <button class="button-lined" onclick={() => addEntry(url, title, progress)}
+ >{$locale().common?.add}</button
+ >
<Spacer />
@@ -120,7 +134,7 @@ const deleteEntry = async (id: string) => {
+
</button>
<span class="opaque">|</span>
- <button onclick={() => deleteEntry(entry.id)}>Remove</button>
+ <button onclick={() => deleteEntry(entry.id)}>{$locale().common?.remove}</button>
</span>
</div>
</li>