From 536d9c97428c5d9655931659e9a4a4d9b00678e6 Mon Sep 17 00:00:00 2001
From: wukko <me@wukko.me>
Date: Fri, 9 Aug 2024 14:40:30 +0600
Subject: [PATCH] web/i18n: move call to action button strings to own file

---
 web/i18n/en/a11y/dialog.json                      |  4 +---
 web/i18n/en/button.json                           | 15 +++++++++++++++
 web/i18n/en/dialog.json                           | 11 -----------
 .../components/buttons/ResetSettingsButton.svelte |  4 ++--
 web/src/components/dialog/SavingDialog.svelte     | 10 +++++-----
 web/src/components/donate/DonateShareCard.svelte  |  2 +-
 .../components/save/buttons/DownloadButton.svelte |  6 +++---
 .../components/settings/TransferSettings.svelte   |  6 +++---
 web/src/lib/api.ts                                |  4 ++--
 9 files changed, 32 insertions(+), 30 deletions(-)
 create mode 100644 web/i18n/en/button.json

diff --git a/web/i18n/en/a11y/dialog.json b/web/i18n/en/a11y/dialog.json
index 478a1587..84df736b 100644
--- a/web/i18n/en/a11y/dialog.json
+++ b/web/i18n/en/a11y/dialog.json
@@ -1,7 +1,5 @@
 {
     "picker.item.photo": "photo thumbnail",
     "picker.item.video": "video thumbnail",
-    "picker.item.gif": "gif thumbnail",
-
-    "saving.copied": "link copied"
+    "picker.item.gif": "gif thumbnail"
 }
diff --git a/web/i18n/en/button.json b/web/i18n/en/button.json
new file mode 100644
index 00000000..5672cf5f
--- /dev/null
+++ b/web/i18n/en/button.json
@@ -0,0 +1,15 @@
+{
+    "gotit": "got it",
+    "cancel": "cancel",
+    "reset": "reset",
+    "done": "done",
+    "downloadAudio": "download audio",
+    "download": "download",
+    "share": "share",
+    "copy": "copy",
+    "copied": "copied",
+    "import": "import",
+    "continue": "continue",
+    "star": "star",
+    "follow": "follow"
+}
diff --git a/web/i18n/en/dialog.json b/web/i18n/en/dialog.json
index 6e9bb72e..3039a4b4 100644
--- a/web/i18n/en/dialog.json
+++ b/web/i18n/en/dialog.json
@@ -1,15 +1,4 @@
 {
-    "button.gotit": "got it",
-    "button.cancel": "cancel",
-    "button.reset": "reset",
-    "button.done": "done",
-    "button.downloadAudio": "download audio",
-    "button.download": "download",
-    "button.share": "share",
-    "button.copy": "copy",
-    "button.import": "import",
-    "button.continue": "continue",
-
     "reset.title": "reset all settings?",
     "reset.body": "are you sure you want to reset all settings? this action is immediate and irreversible.",
 
diff --git a/web/src/components/buttons/ResetSettingsButton.svelte b/web/src/components/buttons/ResetSettingsButton.svelte
index ee60938e..63d8ec43 100644
--- a/web/src/components/buttons/ResetSettingsButton.svelte
+++ b/web/src/components/buttons/ResetSettingsButton.svelte
@@ -15,12 +15,12 @@
             bodyText: $t("dialog.reset.body"),
             buttons: [
                 {
-                    text: $t("dialog.button.cancel"),
+                    text: $t("button.cancel"),
                     main: false,
                     action: () => {},
                 },
                 {
-                    text: $t("dialog.button.reset"),
+                    text: $t("button.reset"),
                     color: "red",
                     main: true,
                     timeout: 5000,
diff --git a/web/src/components/dialog/SavingDialog.svelte b/web/src/components/dialog/SavingDialog.svelte
index 4f686904..e430bee9 100644
--- a/web/src/components/dialog/SavingDialog.svelte
+++ b/web/src/components/dialog/SavingDialog.svelte
@@ -53,7 +53,7 @@
                         click={() => openURL(url)}
                     >
                         <IconDownload />
-                        {$t("dialog.button.download")}
+                        {$t("button.download")}
                     </VerticalActionButton>
                 {/if}
 
@@ -65,7 +65,7 @@
                         click={async () => await shareURL(url)}
                     >
                         <IconShare2 />
-                        {$t("dialog.button.share")}
+                        {$t("button.share")}
                     </VerticalActionButton>
                 {/if}
 
@@ -77,10 +77,10 @@
                         copyURL(url);
                         copied = true;
                     }}
-                    ariaLabel={copied ? $t("a11y.dialog.saving.copied") : ""}
+                    ariaLabel={copied ? $t("button.copied") : ""}
                 >
                     <CopyIcon check={copied} />
-                    {$t("dialog.button.copy")}
+                    {$t("button.copy")}
                 </VerticalActionButton>
             </div>
         </div>
@@ -94,7 +94,7 @@
         <DialogButtons
             buttons={[
                 {
-                    text: $t("dialog.button.done"),
+                    text: $t("button.done"),
                     main: true,
                     action: () => {},
                 },
diff --git a/web/src/components/donate/DonateShareCard.svelte b/web/src/components/donate/DonateShareCard.svelte
index cb4c413c..2cd9f534 100644
--- a/web/src/components/donate/DonateShareCard.svelte
+++ b/web/src/components/donate/DonateShareCard.svelte
@@ -42,7 +42,7 @@
                     copyURL(cobaltUrl);
                     copied = true;
                 }}
-                aria-label={copied ? $t("a11y.dialog.saving.copied") : ""}
+                aria-label={copied ? $t("button.copied") : ""}
             >
                 <div class="share-button-icon">
                     <CopyIcon check={copied} />
diff --git a/web/src/components/save/buttons/DownloadButton.svelte b/web/src/components/save/buttons/DownloadButton.svelte
index 3f026dac..7beaf976 100644
--- a/web/src/components/save/buttons/DownloadButton.svelte
+++ b/web/src/components/save/buttons/DownloadButton.svelte
@@ -20,7 +20,7 @@
         meowbalt: "error",
         buttons: [
             {
-                text: $t("dialog.button.gotit"),
+                text: $t("button.gotit"),
                 main: true,
                 action: () => {},
             },
@@ -110,7 +110,7 @@
             changeDownloadButton("done");
             const buttons = [
                 {
-                    text: $t("dialog.button.done"),
+                    text: $t("button.done"),
                     main: true,
                     action: () => {},
                 },
@@ -119,7 +119,7 @@
             if (response.audio) {
                 const pickerAudio = response.audio;
                 buttons.unshift({
-                    text: $t("dialog.button.downloadAudio"),
+                    text: $t("button.download_audio"),
                     main: false,
                     action: () => {
                         downloadFile(pickerAudio);
diff --git a/web/src/components/settings/TransferSettings.svelte b/web/src/components/settings/TransferSettings.svelte
index b36a1131..e123081b 100644
--- a/web/src/components/settings/TransferSettings.svelte
+++ b/web/src/components/settings/TransferSettings.svelte
@@ -30,12 +30,12 @@
                 bodyText: $t("dialog.import.body"),
                 buttons: [
                     {
-                        text: $t("dialog.button.cancel"),
+                        text: $t("button.cancel"),
                         main: false,
                         action: () => {},
                     },
                     {
-                        text: $t("dialog.button.import"),
+                        text: $t("button.import"),
                         color: "red",
                         main: true,
                         timeout: 5000,
@@ -60,7 +60,7 @@
                 bodyText: message,
                 buttons: [
                     {
-                        text: $t("dialog.button.gotit"),
+                        text: $t("button.gotit"),
                         main: true,
                         action: () => {},
                     },
diff --git a/web/src/lib/api.ts b/web/src/lib/api.ts
index a631bf1c..ad0b58e2 100644
--- a/web/src/lib/api.ts
+++ b/web/src/lib/api.ts
@@ -51,7 +51,7 @@ const request = async (url: string) => {
             dismissable: false,
             buttons: [
                 {
-                    text: get(t)("dialog.button.cancel"),
+                    text: get(t)("button.cancel"),
                     main: false,
                     action: () => {
                         _actions.reject();
@@ -63,7 +63,7 @@ const request = async (url: string) => {
                     },
                 },
                 {
-                    text: get(t)("dialog.button.continue"),
+                    text: get(t)("button.continue"),
                     color: "red",
                     main: true,
                     timeout: 5000,