mirror of
https://github.com/KivotosRailway/website.git
synced 2026-11-03 11:06:32 +09:00
i18n 代码进入URL路由,优化重定向规则
This commit is contained in:
@@ -0,0 +1,11 @@
|
||||
"use client";
|
||||
|
||||
import { createContext, useContext } from "react";
|
||||
import type { Locale } from "@/lib/i18n";
|
||||
|
||||
export const LocaleContext = createContext<Locale>("zh-Hans");
|
||||
export function useRouteLocale() { return useContext(LocaleContext); }
|
||||
|
||||
export function LocaleProvider({ locale, children }: { locale: Locale; children: React.ReactNode }) {
|
||||
return <LocaleContext.Provider value={locale}>{children}</LocaleContext.Provider>;
|
||||
}
|
||||
Reference in New Issue
Block a user