From 6c6c6626cfa8040eb2e3a49348d6e8755aba5952 Mon Sep 17 00:00:00 2001 From: Riftriot Date: Thu, 4 Jan 2024 14:31:52 -0600 Subject: [PATCH] Localize bare switcher and add button --- .env | 1 + src/locales/en.json | 6 ++++-- src/locales/es.json | 5 +++++ src/locales/ja.json | 5 +++++ src/pages/Settings/BareInput.tsx | 29 +++++++++++++++++++---------- src/pages/Settings/Proxy.tsx | 8 ++++---- 6 files changed, 38 insertions(+), 16 deletions(-) create mode 100644 .env diff --git a/.env b/.env new file mode 100644 index 0000000..9d26a4d --- /dev/null +++ b/.env @@ -0,0 +1 @@ +test=TESTTTT \ No newline at end of file diff --git a/src/locales/en.json b/src/locales/en.json index f046963..fc5a8fd 100644 --- a/src/locales/en.json +++ b/src/locales/en.json @@ -52,11 +52,13 @@ }, "bare": { "title": "Bare Server", - "subtitle": "Enter the URL of your bare server" + "subtitle": "Enter the URL of your bare server", + "select": "Select" }, "theme": { "title": "Theme", - "subtitle": "Choose a theme so your eyes don't hate us" + "subtitle": "Choose a theme so your eyes don't hate us", + "select": "Select" } }, "titles": { diff --git a/src/locales/es.json b/src/locales/es.json index a50f39a..98b59e9 100644 --- a/src/locales/es.json +++ b/src/locales/es.json @@ -50,6 +50,11 @@ "title": "Buscador", "subtitle": "Elige tu motor de búsqueda." }, + "bare": { + "title": "Bare Server", + "subtitle": "Pon tu url de tu bare server", + "select": "Seleccionar" + }, "theme": { "title": "Mirar", "subtitle": "Elige una mirada para que tus ojos no nos odienn" diff --git a/src/locales/ja.json b/src/locales/ja.json index 8e286e5..e78bf48 100644 --- a/src/locales/ja.json +++ b/src/locales/ja.json @@ -50,6 +50,11 @@ "title": "検索エンジン", "subtitle": "ネビュラの検索エンジンを選択してください" }, + "bare": { + "title": "Bare サーバー", + "subtitle": "Bare サーバー URL を入力してください", + "select": "選択する" + }, "theme": { "title": "テーマ", "subtitle": "目が嫌いにならないようにテーマを選んでください" diff --git a/src/pages/Settings/BareInput.tsx b/src/pages/Settings/BareInput.tsx index c25ed8d..4a46769 100644 --- a/src/pages/Settings/BareInput.tsx +++ b/src/pages/Settings/BareInput.tsx @@ -1,6 +1,7 @@ import { useState, useEffect } from "preact/hooks"; import { set } from "../../util/IDB"; import { uninstallServiceWorkers } from "../../util/SWHelper"; +import { useTranslation } from "react-i18next"; interface BareInputProps { placeholder: string; @@ -8,6 +9,7 @@ interface BareInputProps { } function BareInput(props: BareInputProps) { + const { t } = useTranslation(); const value = localStorage.getItem(props.storageKey) || "/bare/"; const [inputValue, setInputValue] = useState(value); function validateUrl(url: string) { @@ -28,22 +30,29 @@ function BareInput(props: BareInputProps) { } return finalUrl; } - function handleChange(event: any) { - const url = validateUrl(event.target.value); - setInputValue(event.target.value); + function handleChange() { + const url = validateUrl((document.getElementById("input") as HTMLInputElement).value); + setInputValue((document.getElementById("input") as HTMLInputElement).value); set(props.storageKey, url); localStorage.setItem(props.storageKey, url); uninstallServiceWorkers(); window.location.reload(); } return ( - +
+ +
+ {t("settings.bare.select")} +
+
); } diff --git a/src/pages/Settings/Proxy.tsx b/src/pages/Settings/Proxy.tsx index 2b948cd..25edd95 100644 --- a/src/pages/Settings/Proxy.tsx +++ b/src/pages/Settings/Proxy.tsx @@ -39,7 +39,7 @@ const Proxy = ({ id, active }) => { variants={settingsPageVariant} className="content-card flex w-full flex-row flex-wrap justify-center gap-4" > -
+
{t("settings.proxy.title")}
@@ -48,7 +48,7 @@ const Proxy = ({ id, active }) => {
-
+
{t("settings.proxymodes.title")}
@@ -61,7 +61,7 @@ const Proxy = ({ id, active }) => { refresh={false} />
-
+
{t("settings.search.title")}
@@ -74,7 +74,7 @@ const Proxy = ({ id, active }) => { refresh={false} />
-
+
{t("settings.bare.title")}