's'
This commit is contained in:
@@ -53,7 +53,10 @@ export function LocaleProvider({
|
||||
const setLocale = useCallback((newLocale: Locale) => {
|
||||
const path = window.location.pathname;
|
||||
const newPath = path.replace(/^\/(zh|en)/, `/${newLocale}`);
|
||||
window.location.href = newPath || `/${newLocale}/digital`;
|
||||
void import("@/app/lib/navigation-loading").then(({ startNavigation }) => {
|
||||
startNavigation();
|
||||
window.location.href = newPath || `/${newLocale}/digital`;
|
||||
});
|
||||
}, []);
|
||||
|
||||
const value: LocaleContextValue = {
|
||||
@@ -95,7 +98,10 @@ export function useLocaleRouter() {
|
||||
? cleanPath
|
||||
: `/digital${cleanPath === "/" ? "" : cleanPath}`;
|
||||
const newPath = `/${newLocale}${digitalPath}`;
|
||||
window.location.href = newPath;
|
||||
void import("@/app/lib/navigation-loading").then(({ startNavigation }) => {
|
||||
startNavigation();
|
||||
window.location.href = newPath;
|
||||
});
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user