diff --git a/todoblue/src/app/(i18n)/(locales)/(board)/en-US.json b/todoblue/src/app/(i18n)/(locales)/(board)/en-US.json new file mode 100644 index 0000000..f0e3ae0 --- /dev/null +++ b/todoblue/src/app/(i18n)/(locales)/(board)/en-US.json @@ -0,0 +1,3 @@ +{ + "headerToggleEditingTitle": "Toggle editing board settings" +} diff --git a/todoblue/src/app/(i18n)/client.ts b/todoblue/src/app/(i18n)/client.ts index e50f65c..5a09acc 100644 --- a/todoblue/src/app/(i18n)/client.ts +++ b/todoblue/src/app/(i18n)/client.ts @@ -5,14 +5,14 @@ import resourcesToBackend from "i18next-resources-to-backend" import {useEffect, useState} from "react" -async function init(lng: string, ns: string): Promise { +async function init(lang: string, ns: string): Promise { const instance = createInstance() await instance .use(resourcesToBackend((language: string, namespace: string) => import(`./(locales)/(${namespace})/${language}.json`))) .init({ supportedLngs: ["en-US"], fallbackLng: "en-US", - lng, + lng: lang, fallbackNS: "common", defaultNS: "common", ns, @@ -20,22 +20,22 @@ async function init(lng: string, ns: string): Promise { return instance } -export function useClientTranslation(lng: string, ns: string) { +export function useClientTranslation(lang: string, ns: string) { const [instance, setInstance] = useState(undefined); useEffect( () => { - console.debug("[useTranslation] Initializing translation with:", lng, ":", ns) - init(lng, ns).then((v: i18n) => { + console.debug("[useTranslation] Initializing translation with:", lang, ":", ns) + init(lang, ns).then((v: i18n) => { console.debug("[useTranslation] Initialized i18n:", v) return setInstance(v) }) }, - [lng, ns] + [lang, ns] ) return { - t: instance?.getFixedT(lng, Array.isArray(ns) ? ns[0] : ns) ?? ((...args) => `${args}`), + t: instance?.getFixedT(lang, Array.isArray(ns) ? ns[0] : ns) ?? ((...args) => `${args}`), i18n: instance, } } diff --git a/todoblue/src/app/(i18n)/server.ts b/todoblue/src/app/(i18n)/server.ts index b82889c..fef8601 100644 --- a/todoblue/src/app/(i18n)/server.ts +++ b/todoblue/src/app/(i18n)/server.ts @@ -3,14 +3,14 @@ import {createInstance, i18n} from "i18next" import resourcesToBackend from "i18next-resources-to-backend" -async function init(lng: string, ns: string): Promise { +async function init(lang: string, ns: string): Promise { const instance = createInstance() await instance .use(resourcesToBackend((language: string, namespace: string) => import(`./(locales)/(${namespace})/${language}.json`))) .init({ supportedLngs: ["en-US"], fallbackLng: "en-US", - lng, + lng: lang, fallbackNS: "common", defaultNS: "common", ns, @@ -18,10 +18,10 @@ async function init(lng: string, ns: string): Promise { return instance } -export async function useServerTranslation(lng: string, ns: string) { - const instance = await init(lng, ns) +export async function useServerTranslation(lang: string, ns: string) { + const instance = await init(lang, ns) return { - t: instance.getFixedT(lng, Array.isArray(ns) ? ns[0] : ns), + t: instance.getFixedT(lang, Array.isArray(ns) ? ns[0] : ns), i18n: instance } } diff --git a/todoblue/src/app/[lang]/(page)/CreateBoardChapter.tsx b/todoblue/src/app/[lang]/(page)/CreateBoardChapter.tsx index 47679c1..0d3d6e9 100644 --- a/todoblue/src/app/[lang]/(page)/CreateBoardChapter.tsx +++ b/todoblue/src/app/[lang]/(page)/CreateBoardChapter.tsx @@ -4,16 +4,16 @@ import {CreatePublicBoardPanel} from "@/app/[lang]/(page)/CreatePublicBoardPanel import {default as React} from "react" -export async function CreateBoardChapter({lng}: {lng: string}) { - const {t} = await useServerTranslation(lng, "root") +export async function CreateBoardChapter({lang}: {lang: string}) { + const {t} = await useServerTranslation(lang, "root") return (

{t("createBoardTitle")}

- - + +
) } diff --git a/todoblue/src/app/[lang]/(page)/CreatePrivateBoardPanel.tsx b/todoblue/src/app/[lang]/(page)/CreatePrivateBoardPanel.tsx index ec8fbcf..f197d3d 100644 --- a/todoblue/src/app/[lang]/(page)/CreatePrivateBoardPanel.tsx +++ b/todoblue/src/app/[lang]/(page)/CreatePrivateBoardPanel.tsx @@ -7,8 +7,8 @@ import classNames from "classnames" import {useRouter} from "next/navigation" import {default as React, SyntheticEvent, useCallback, useEffect, useState} from "react" -export function CreatePrivateBoardPanel({lng}: {lng: string}) { - const {t} = useClientTranslation(lng, "root") +export function CreatePrivateBoardPanel({lang}: {lang: string}) { + const {t} = useClientTranslation(lang, "root") const router = useRouter(); const [canCreate, setCanCreate] = useState(null); diff --git a/todoblue/src/app/[lang]/(page)/CreatePublicBoardPanel.tsx b/todoblue/src/app/[lang]/(page)/CreatePublicBoardPanel.tsx index 2f635f1..3447169 100644 --- a/todoblue/src/app/[lang]/(page)/CreatePublicBoardPanel.tsx +++ b/todoblue/src/app/[lang]/(page)/CreatePublicBoardPanel.tsx @@ -9,8 +9,8 @@ import {default as React, SyntheticEvent, useCallback} from "react" import {FontAwesomeIcon} from "@fortawesome/react-fontawesome" -export function CreatePublicBoardPanel({lng}: {lng: string}) { - const {t} = useClientTranslation(lng, "root") +export function CreatePublicBoardPanel({lang}: {lang: string}) { + const {t} = useClientTranslation(lang, "root") const [code, setCode] = useLowerKebabState("") const router = useRouter(); diff --git a/todoblue/src/app/[lang]/(page)/ExistingBoardChapter.tsx b/todoblue/src/app/[lang]/(page)/ExistingBoardChapter.tsx index 7c76497..9d15571 100644 --- a/todoblue/src/app/[lang]/(page)/ExistingBoardChapter.tsx +++ b/todoblue/src/app/[lang]/(page)/ExistingBoardChapter.tsx @@ -4,16 +4,16 @@ import {StarredBoardsPanel} from "@/app/[lang]/(page)/StarredBoardsPanel" import {default as React} from "react" -export async function ExistingBoardChapter({lng}: {lng: string}) { - const {t} = await useServerTranslation(lng, "root") +export async function ExistingBoardChapter({lang}: {lang: string}) { + const {t} = await useServerTranslation(lang, "root") return (

{t("existingBoardTitle")}

- - + +
) } diff --git a/todoblue/src/app/[lang]/(page)/KnownBoardsPanel.tsx b/todoblue/src/app/[lang]/(page)/KnownBoardsPanel.tsx index dad4d51..def4eeb 100644 --- a/todoblue/src/app/[lang]/(page)/KnownBoardsPanel.tsx +++ b/todoblue/src/app/[lang]/(page)/KnownBoardsPanel.tsx @@ -9,8 +9,8 @@ import {default as React, SyntheticEvent, useCallback} from "react" import {FontAwesomeIcon} from "@fortawesome/react-fontawesome" -export function KnownBoardsPanel({lng}: {lng: string}) { - const {t} = useClientTranslation(lng, "root") +export function KnownBoardsPanel({lang}: {lang: string}) { + const {t} = useClientTranslation(lang, "root") const [code, setCode] = useLowerKebabState("") const router = useRouter(); diff --git a/todoblue/src/app/[lang]/(page)/RootHeader.tsx b/todoblue/src/app/[lang]/(page)/RootHeader.tsx index 69257ff..98d76fa 100644 --- a/todoblue/src/app/[lang]/(page)/RootHeader.tsx +++ b/todoblue/src/app/[lang]/(page)/RootHeader.tsx @@ -3,8 +3,8 @@ import style from "./RootHeader.module.css" import {default as React} from "react" -export async function RootHeader({lng}: {lng: string}) { - const {t} = await useServerTranslation(lng, "root") +export async function RootHeader({lang}: {lang: string}) { + const {t} = await useServerTranslation(lang, "root") return (
diff --git a/todoblue/src/app/[lang]/(page)/RootMain.tsx b/todoblue/src/app/[lang]/(page)/RootMain.tsx index 2a95a09..4d98430 100644 --- a/todoblue/src/app/[lang]/(page)/RootMain.tsx +++ b/todoblue/src/app/[lang]/(page)/RootMain.tsx @@ -4,11 +4,11 @@ import style from "./RootMain.module.css" import {default as React} from "react" -export async function RootMain({lng}: {lng: string}) { +export async function RootMain({lang}: {lang: string}) { return (
- - + +
) } diff --git a/todoblue/src/app/[lang]/(page)/StarredBoardsPanel.tsx b/todoblue/src/app/[lang]/(page)/StarredBoardsPanel.tsx index 32355b1..6275ee5 100644 --- a/todoblue/src/app/[lang]/(page)/StarredBoardsPanel.tsx +++ b/todoblue/src/app/[lang]/(page)/StarredBoardsPanel.tsx @@ -9,8 +9,8 @@ import Link from "next/link" import {useEffect, useState} from "react" -export function StarredBoardsPanel({lng}: {lng: string}) { - const {t} = useClientTranslation(lng, "root") +export function StarredBoardsPanel({lang}: {lang: string}) { + const {t} = useClientTranslation(lang, "root") const [isClient, setIsClient] = useState(null); const {starred} = useStarredConsumer() diff --git a/todoblue/src/app/[lang]/page.tsx b/todoblue/src/app/[lang]/page.tsx index eab99e2..6fa8369 100644 --- a/todoblue/src/app/[lang]/page.tsx +++ b/todoblue/src/app/[lang]/page.tsx @@ -5,11 +5,11 @@ import {default as React} from "react"; import style from "./page.module.css" -export default async function page({params: {lng}}: {params: {lng: string}}) { +export default async function page({params: {lang}}: {params: {lang: string}}) { return (
- - + +
)