From ff3a9d03a4c2328eb85383d0ca7ebcafd5fb39f8 Mon Sep 17 00:00:00 2001 From: Alex van Andel Date: Tue, 10 Oct 2023 22:28:41 +0100 Subject: [PATCH] fix: Bring back dir attr using Intl (#11806) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Omar López --- apps/web/pages/_document.tsx | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/apps/web/pages/_document.tsx b/apps/web/pages/_document.tsx index a033102ee5..06564ead2d 100644 --- a/apps/web/pages/_document.tsx +++ b/apps/web/pages/_document.tsx @@ -50,9 +50,18 @@ class MyDocument extends Document { const nonceParsed = z.string().safeParse(this.props.nonce); const nonce = nonceParsed.success ? nonceParsed.data : ""; + + const intlLocale = new Intl.Locale(newLocale); + // @ts-expect-error INFO: Typescript does not know about the Intl.Locale textInfo attribute + const direction = intlLocale.textInfo?.direction; + if (!direction) { + throw new Error("NodeJS major breaking change detected, use getTextInfo() instead."); + } + return (