perf: make useLocale hook to use server-fetched i18n if in App router context (#20597)

* write I18nProvider

* rename

* update useLocale

* fix

* use a singleton

* safer

* better

* fix e2e test 1

* fix e2e test 2

* fix e2e test 3

* fix e2e test 4

* fix

* refactor

* address comments

* fix

* fix

* fix

* fix

* fix

* fix

* fix

* fix

* fix

* fix

* fix flaky test

* add more caching

* revert changes to e2e tests

* add jsdoc

* memoize

* update window object with new translations in /settings/my-account/general

* remove dead code

* only use locale and ns as deps

* fix
This commit is contained in:
Benny Joo authored and GitHub committed 2025-04-11 14:28:26 -07:00
1 parent 9eb1fe06e3
commit b17b5a169f
7 files changed
+182 -101

No files matched your search

@@ -1,7 +1,5 @@
"use client";
import type { SSRConfig } from "next-i18next/dist/types/types";
// import I18nLanguageHandler from "@components/I18nLanguageHandler";
import { usePathname } from "next/navigation";
import Script from "next/script";
@@ -16,7 +14,6 @@ export type PageWrapperProps = Readonly<{
requiresLicense: boolean;
nonce: string | undefined;
isBookingPage?: boolean;
i18n?: SSRConfig;
}>;
function PageWrapper(props: PageWrapperProps) {
@@ -45,7 +42,6 @@ function PageWrapper(props: PageWrapperProps) {
return (
<AppProviders {...providerProps}>
{/* <I18nLanguageHandler locales={props.router.locales || []} /> */}
<>
<Script
nonce={nonce}