mirror of
https://github.com/zoriya/Kyoo.git
synced 2025-06-01 04:34:50 -04:00
Add a language preference
This commit is contained in:
parent
b97942b10f
commit
9fe24cd115
@ -55,6 +55,7 @@ import { useMutation, useQueryClient } from "@tanstack/react-query";
|
|||||||
import { PasswordInput } from "../login/password-input";
|
import { PasswordInput } from "../login/password-input";
|
||||||
|
|
||||||
import Theme from "@material-symbols/svg-400/outlined/dark_mode.svg";
|
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 Username from "@material-symbols/svg-400/outlined/badge.svg";
|
||||||
import Mail from "@material-symbols/svg-400/outlined/mail.svg";
|
import Mail from "@material-symbols/svg-400/outlined/mail.svg";
|
||||||
import Password from "@material-symbols/svg-400/outlined/password.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 = () => {
|
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<ReactElement | undefined>(undefined);
|
const [popup, setPopup] = useState<ReactElement | undefined>(undefined);
|
||||||
|
|
||||||
const theme = useUserTheme("auto");
|
const theme = useUserTheme("auto");
|
||||||
@ -407,10 +409,30 @@ export const SettingsPage: QueryPage = () => {
|
|||||||
getLabel={(key) => t(`settings.general.theme.${key}`)}
|
getLabel={(key) => t(`settings.general.theme.${key}`)}
|
||||||
/>
|
/>
|
||||||
</Preference>
|
</Preference>
|
||||||
|
<Preference
|
||||||
|
icon={Language}
|
||||||
|
label={t("settings.general.language.label")}
|
||||||
|
description={t("settings.general.language.description")}
|
||||||
|
>
|
||||||
|
<Select
|
||||||
|
label={t("settings.general.language.label")}
|
||||||
|
value={i18n.resolvedLanguage!}
|
||||||
|
onValueChange={(value) =>
|
||||||
|
i18n.changeLanguage(value !== "system" ? value : (i18n.options.lng as string))
|
||||||
|
}
|
||||||
|
values={["system", ...Object.keys(i18n.options.resources!)]}
|
||||||
|
getLabel={(key) =>
|
||||||
|
key === "system" ? t("settings.general.language.system") : languages.of(key) ?? key
|
||||||
|
}
|
||||||
|
/>
|
||||||
|
</Preference>
|
||||||
</SettingsContainer>
|
</SettingsContainer>
|
||||||
<AccountSettings setPopup={setPopup} />
|
<AccountSettings setPopup={setPopup} />
|
||||||
<SettingsContainer title={t("settings.about.label")}>
|
<SettingsContainer title={t("settings.about.label")}>
|
||||||
<Link href="https://github.com/zoriya/kyoo/releases/latest/download/kyoo.apk" target="_blank">
|
<Link
|
||||||
|
href="https://github.com/zoriya/kyoo/releases/latest/download/kyoo.apk"
|
||||||
|
target="_blank"
|
||||||
|
>
|
||||||
<Preference
|
<Preference
|
||||||
icon={Android}
|
icon={Android}
|
||||||
label={t("settings.about.android-app.label")}
|
label={t("settings.about.android-app.label")}
|
||||||
|
@ -84,6 +84,11 @@
|
|||||||
"auto": "System",
|
"auto": "System",
|
||||||
"light": "Light",
|
"light": "Light",
|
||||||
"dark": "Dark"
|
"dark": "Dark"
|
||||||
|
},
|
||||||
|
"language": {
|
||||||
|
"label": "Language",
|
||||||
|
"description": "Set the language of your application",
|
||||||
|
"system": "System"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"account": {
|
"account": {
|
||||||
|
@ -84,6 +84,11 @@
|
|||||||
"auto": "Système",
|
"auto": "Système",
|
||||||
"light": "Clair",
|
"light": "Clair",
|
||||||
"dark": "Sombre"
|
"dark": "Sombre"
|
||||||
|
},
|
||||||
|
"language": {
|
||||||
|
"label": "Langue",
|
||||||
|
"description": "Définissez la langue de votre application",
|
||||||
|
"system": "Système"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"account": {
|
"account": {
|
||||||
@ -104,6 +109,17 @@
|
|||||||
"oldPassword": "Ancien mot de passe",
|
"oldPassword": "Ancien mot de passe",
|
||||||
"newPassword": "Nouveau mot de passe"
|
"newPassword": "Nouveau mot de passe"
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
"about": {
|
||||||
|
"label": "À propos",
|
||||||
|
"android-app": {
|
||||||
|
"label": "Application Android",
|
||||||
|
"description": "Téléchargez l'application Android"
|
||||||
|
},
|
||||||
|
"git": {
|
||||||
|
"label": "Github",
|
||||||
|
"description": "Ouvrez la page github où vous pouvez lire le code de kyoo"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"player": {
|
"player": {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user