feat(site): responsive mobile nav, css-driven theme icons, localizePath helper

This commit is contained in:
Christian Visintin
2026-06-07 21:50:21 +02:00
parent 6765606acf
commit 6ea0ffe391
5 changed files with 47 additions and 24 deletions
+5
View File
@@ -25,6 +25,11 @@ export function isLocale(value: string): value is Locale {
return (locales as readonly string[]).includes(value);
}
/** Prefix a path with the locale, except for the default locale. */
export function localizePath(locale: Locale, path: string): string {
return locale === defaultLocale ? path : `/${locale}${path}`;
}
/** Resolve a translator for `locale`, falling back to en, then to the key. */
export function useTranslations(locale: Locale) {
const dict = dictionaries[locale] ?? dictionaries[defaultLocale];