From 9e2b7993a8f8a24771d6e040dcdd929ff7e63236 Mon Sep 17 00:00:00 2001 From: rift <117926989+Riftriot@users.noreply.github.com> Date: Sun, 17 Dec 2023 11:40:41 -0600 Subject: [PATCH] language switcher --- src/locales/en.json | 5 +++++ src/locales/ja.json | 5 +++++ src/pages/Settings/Dropdown.tsx | 7 ++++++- src/pages/Settings/Misc.tsx | 16 ++++++++-------- src/pages/Settings/Proxy.tsx | 7 ++++++- 5 files changed, 30 insertions(+), 10 deletions(-) diff --git a/src/locales/en.json b/src/locales/en.json index 5c88410..cc1c848 100644 --- a/src/locales/en.json +++ b/src/locales/en.json @@ -28,6 +28,11 @@ "proxy": { "title": "Proxy", "automatic": "Automatic" + }, + "languages": { + "title": "Language", + "japanese": "Japanese", + "english": "English" } } } diff --git a/src/locales/ja.json b/src/locales/ja.json index 7003a4f..4d67130 100644 --- a/src/locales/ja.json +++ b/src/locales/ja.json @@ -28,6 +28,11 @@ "proxy": { "title": "プロキシ", "automatic": "自動" + }, + "languages": { + "title": "言語", + "japanese": "日本語", + "english": "英語" } } } diff --git a/src/pages/Settings/Dropdown.tsx b/src/pages/Settings/Dropdown.tsx index 6aab6d7..0027ced 100644 --- a/src/pages/Settings/Dropdown.tsx +++ b/src/pages/Settings/Dropdown.tsx @@ -7,12 +7,14 @@ interface Option { const Dropdown = ({ name, + storageKey, options, - storageKey + refresh }: { name: string; storageKey: string; options: Option[]; + refresh: boolean; }) => { const [isOpen, setIsOpen] = useState(false); @@ -45,6 +47,9 @@ const Dropdown = ({ setIsOpen(false); setChoice(option.id); localStorage.setItem(storageKey, option.id); + if (refresh == true) { + window.location.reload() + } }} > {option.label} diff --git a/src/pages/Settings/Misc.tsx b/src/pages/Settings/Misc.tsx index b331a41..822f80a 100644 --- a/src/pages/Settings/Misc.tsx +++ b/src/pages/Settings/Misc.tsx @@ -5,11 +5,10 @@ import { useTranslation } from "react-i18next"; const Misc = ({ id, active }) => { const { t } = useTranslation(); - const engines = [ - { id: "automatic", label: t("settings.proxy.automatic") }, - { id: "ultraviolet", label: "Ultraviolet" }, - { id: "rammerhead", label: "Rammerhead" }, - { id: "dynamic", label: "Dynamic" } + + const languages = [ + { id: "ja", label: t("settings.languages.japanese") }, + { id: "en-US", label: t("settings.languages.english") } ]; return ( @@ -26,9 +25,10 @@ const Misc = ({ id, active }) => { className="content-card flex flex-row flex-wrap justify-around" > diff --git a/src/pages/Settings/Proxy.tsx b/src/pages/Settings/Proxy.tsx index 1ff1c2f..7d848a2 100644 --- a/src/pages/Settings/Proxy.tsx +++ b/src/pages/Settings/Proxy.tsx @@ -25,7 +25,12 @@ const Proxy = ({ id, active }) => { variants={settingsPageVariant} className="content-card flex flex-row flex-wrap justify-around" > - + );