From f8dc013b0d81d5d463c086e291ce99ab1d796a9d Mon Sep 17 00:00:00 2001 From: Cytrogen Date: Sun, 5 Apr 2026 09:41:13 -0400 Subject: [PATCH] [feature] Add language selector to local settings --- .../features/local_settings/page/index.jsx | 2 + .../local_settings/page/language_selector.jsx | 151 ++++++++++++++++++ 2 files changed, 153 insertions(+) create mode 100644 app/javascript/flavours/glitch/features/local_settings/page/language_selector.jsx diff --git a/app/javascript/flavours/glitch/features/local_settings/page/index.jsx b/app/javascript/flavours/glitch/features/local_settings/page/index.jsx index 1cd8b353edb46b380a1803aa1f9e8815111a4c81..764993cabae061c3a31be215e55b99dd0e1fe08c 100644 --- a/app/javascript/flavours/glitch/features/local_settings/page/index.jsx +++ b/app/javascript/flavours/glitch/features/local_settings/page/index.jsx @@ -9,6 +9,7 @@ import ImmutablePropTypes from "react-immutable-proptypes"; // Our imports import LocalSettingsPageItem from "./item"; +import LanguageSelector from "./language_selector"; // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * @@ -61,6 +62,7 @@ class LocalSettingsPage extends PureComponent { > + { + const locale = e.target.value; + localStorage.setItem(LOCALE_STORAGE_KEY, locale); + this.setState({ currentLocale: locale }); + // Reload to apply the new locale + window.location.reload(); + }; + + render() { + const { currentLocale } = this.state; + + const sortedLocales = Object.entries(LOCALE_NAMES).sort((a, b) => + a[1].localeCompare(b[1]) + ); + + return ( +
+
+ + + + +
+
+ ); + } + +}