fix: revert i18n hook changes (#10249)

This commit is contained in:
sean-brydon authored and GitHub committed 2023-07-19 12:30:25 +00:00
1 parent e6f2ba2c25
commit dfffd8b577
2 files changed
+5 -4

No files matched your search

+3 -2
View File
@@ -19,7 +19,7 @@ export function useViewerI18n() {
/**
* Auto-switches locale client-side to the logged in user's preference
*/
const useI18nLanguageHandler = () => {
const I18nLanguageHandler = () => {
const { i18n } = useTranslation("common");
const locale = useViewerI18n().data?.locale || i18n.language;
@@ -34,6 +34,7 @@ const useI18nLanguageHandler = () => {
document.dir = i18n.dir();
document.documentElement.setAttribute("lang", locale);
}, [locale, i18n]);
return null;
};
export default useI18nLanguageHandler;
export default I18nLanguageHandler;
+2 -2
View File
@@ -13,7 +13,7 @@ import type { AppProps } from "@lib/app-providers";
import AppProviders from "@lib/app-providers";
import { seoConfig } from "@lib/config/next-seo.config";
import useI18nLanguageHandler from "@components/I18nLanguageHandler";
import I18nLanguageHandler from "@components/I18nLanguageHandler";
export interface CalPageWrapper {
(props?: AppProps): JSX.Element;
@@ -29,7 +29,6 @@ const calFont = localFont({
});
function PageWrapper(props: AppProps) {
useI18nLanguageHandler();
const { Component, pageProps, err, router } = props;
let pageStatus = "200";
@@ -73,6 +72,7 @@ function PageWrapper(props: AppProps) {
}
{...seoConfig.defaultNextSeo}
/>
<I18nLanguageHandler />
<Script
nonce={nonce}
id="page-status"