feat: support mobile video previews

This commit is contained in:
TerryM
2026-06-01 16:35:40 +08:00
parent c53032155b
commit a968f47640
16 changed files with 275 additions and 47 deletions

13
src/useLocalizedPath.ts Normal file
View File

@@ -0,0 +1,13 @@
import { useCallback } from "react";
import { useI18n } from "./i18n";
import { localizePath } from "./languageRoutes";
/**
* Returns a stable `(path) => localized path` function bound to the current
* UI language. Use this anywhere a `<Link to>` or `navigate()` target needs to
* preserve the active language prefix (e.g. `/malay/browse`).
*/
export function useLocalizedPath() {
const { lang } = useI18n();
return useCallback((path: string) => localizePath(path, lang), [lang]);
}