{t("Welcome back")}
; + * ``` + */ +export const useI18n = () => useContext(I18nContext); diff --git a/frontend/src/i18n/I18nContext.ts b/frontend/src/i18n/I18nContext.ts new file mode 100644 index 0000000..467a876 --- /dev/null +++ b/frontend/src/i18n/I18nContext.ts @@ -0,0 +1,27 @@ +import { createContext } from "react"; +import type { TFunction } from "./t"; +import { DEFAULT_LANGUAGE } from "../../i18n.config"; + +/** + * The type of the context used by TranslationProvider. + * + * - `t`: the translation function (msgid -> msgstr) + * - `lang`: the currently selected language (e.g. "en", "sv") + * - `setLang`: function to switch the active language + */ +export type I18nContextType = { + t: TFunction; + lang: string; + setLang: (lang: string) => void; +}; + +/** + * The actual React context object shared via{t("Here you can see the latest and greatest")}
+ > + ); +} diff --git a/frontend/src/studentportalen/Layout.tsx b/frontend/src/studentportalen/Layout.tsx new file mode 100644 index 0000000..7fa0357 --- /dev/null +++ b/frontend/src/studentportalen/Layout.tsx @@ -0,0 +1,20 @@ +import Header from "./Header.tsx"; +import Menu from "./Menu.tsx"; +import { Outlet } from "react-router"; +import Footer from "./Footer.tsx"; +import "./layout.css"; + +export default function Layout() { + return ( + <> +