mirror of
https://github.com/lukevella/rallly.git
synced 2025-07-26 12:47:55 +02:00
Load locale ondemand + spanish locale (#249)
This commit is contained in:
parent
0f35bd0518
commit
c2aea134ef
30 changed files with 700 additions and 455 deletions
|
@ -1,18 +1,16 @@
|
|||
import clsx from "clsx";
|
||||
import Cookies from "js-cookie";
|
||||
import { useRouter } from "next/router";
|
||||
import { useTranslation } from "next-i18next";
|
||||
|
||||
export const LanguageSelect: React.VoidFunctionComponent<{
|
||||
className?: string;
|
||||
onChange?: (language: string) => void;
|
||||
}> = ({ className, onChange }) => {
|
||||
const { t } = useTranslation("common");
|
||||
const router = useRouter();
|
||||
const { t, i18n } = useTranslation("common");
|
||||
return (
|
||||
<select
|
||||
className={clsx("input", className)}
|
||||
defaultValue={router.locale}
|
||||
defaultValue={i18n.language}
|
||||
onChange={(e) => {
|
||||
Cookies.set("NEXT_LOCALE", e.target.value, {
|
||||
expires: 365,
|
||||
|
@ -21,6 +19,7 @@ export const LanguageSelect: React.VoidFunctionComponent<{
|
|||
}}
|
||||
>
|
||||
<option value="en">{t("english")}</option>
|
||||
<option value="es">{t("spanish")}</option>
|
||||
<option value="fr">{t("french")}</option>
|
||||
<option value="de">{t("german")}</option>
|
||||
<option value="sv">{t("swedish")}</option>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue