From 9fe24cd115a8d4a2e6237de1c8f6d5bef851ede4 Mon Sep 17 00:00:00 2001 From: Zoe Roux Date: Wed, 10 Jan 2024 22:17:09 +0100 Subject: [PATCH] Add a language preference --- front/packages/ui/src/settings/index.tsx | 26 ++++++++++++++++++++++-- front/translations/en.json | 5 +++++ front/translations/fr.json | 16 +++++++++++++++ 3 files changed, 45 insertions(+), 2 deletions(-) diff --git a/front/packages/ui/src/settings/index.tsx b/front/packages/ui/src/settings/index.tsx index 3f47c1e3..5fba6888 100644 --- a/front/packages/ui/src/settings/index.tsx +++ b/front/packages/ui/src/settings/index.tsx @@ -55,6 +55,7 @@ import { useMutation, useQueryClient } from "@tanstack/react-query"; import { PasswordInput } from "../login/password-input"; import Theme from "@material-symbols/svg-400/outlined/dark_mode.svg"; +import Language from "@material-symbols/svg-400/outlined/language.svg"; import Username from "@material-symbols/svg-400/outlined/badge.svg"; import Mail from "@material-symbols/svg-400/outlined/mail.svg"; import Password from "@material-symbols/svg-400/outlined/password.svg"; @@ -386,7 +387,8 @@ const AccountSettings = ({ setPopup }: { setPopup: (e?: ReactElement) => void }) }; export const SettingsPage: QueryPage = () => { - const { t } = useTranslation(); + const { t, i18n } = useTranslation(); + const languages = new Intl.DisplayNames([i18n.language ?? "en"], { type: "language" }); const [popup, setPopup] = useState(undefined); const theme = useUserTheme("auto"); @@ -407,10 +409,30 @@ export const SettingsPage: QueryPage = () => { getLabel={(key) => t(`settings.general.theme.${key}`)} /> + +