diff --git a/examples/with-react-intl/lang/en.json b/examples/with-react-intl/lang/en.json
index e6cd30bb2f93..64e7e19221b3 100644
--- a/examples/with-react-intl/lang/en.json
+++ b/examples/with-react-intl/lang/en.json
@@ -1,7 +1,7 @@
{
- "11754": "An example app integrating React Intl with Next.js",
- "65a8e": "Hello, World!",
- "8cf04": "Home",
- "8f7f4": "About",
- "9c817": "React Intl Next.js Example"
+ "AvQcw8": "React Intl Next.js Example",
+ "N015Sp": "Hello, World!",
+ "ejEGdx": "Home",
+ "fnfXnF": "An example app integrating React Intl with Next.js",
+ "g5pX+a": "About"
}
diff --git a/examples/with-react-intl/lang/fr.json b/examples/with-react-intl/lang/fr.json
index 10c7641a614e..27abeef6365d 100644
--- a/examples/with-react-intl/lang/fr.json
+++ b/examples/with-react-intl/lang/fr.json
@@ -1,7 +1,7 @@
{
- "11754": "Un exemple d'application intégrant React Intl avec Next.js",
- "65a8e": "Bonjour le monde!",
- "8cf04": "Accueil",
- "8f7f4": "À propos de nous",
- "9c817": "React Intl Next.js Exemple"
+ "AvQcw8": "Un exemple d'application intégrant React Intl avec Next.js",
+ "N015Sp": "Bonjour le monde!",
+ "ejEGdx": "Accueil",
+ "fnfXnF": "À propos de nous",
+ "g5pX+a": "React Intl Next.js Exemple"
}
diff --git a/examples/with-react-intl/package.json b/examples/with-react-intl/package.json
index 4aa47f941d7f..2e41e4fcaa29 100644
--- a/examples/with-react-intl/package.json
+++ b/examples/with-react-intl/package.json
@@ -4,7 +4,7 @@
"scripts": {
"dev": "cross-env NODE_ICU_DATA=node_modules/full-icu ts-node --project tsconfig.server.json server.ts",
"build": "npm run extract:i18n && npm run compile:i18n && next build && tsc -p tsconfig.server.json",
- "extract:i18n": "formatjs extract '{pages,components}/*.{js,ts,tsx}' --format simple --out-file lang/en.json",
+ "extract:i18n": "formatjs extract '{pages,components}/*.{js,ts,tsx}' --format simple --id-interpolation-pattern '[sha512:contenthash:base64:6]' --out-file lang/en.json",
"compile:i18n": "formatjs compile-folder --ast --format simple lang/ compiled-lang/",
"start": "cross-env NODE_ENV=production NODE_ICU_DATA=node_modules/full-icu node dist/server"
},
diff --git a/examples/with-react-intl/pages/_app.tsx b/examples/with-react-intl/pages/_app.tsx
index fcdd1a8ec1aa..4f184ca0ee46 100644
--- a/examples/with-react-intl/pages/_app.tsx
+++ b/examples/with-react-intl/pages/_app.tsx
@@ -27,7 +27,7 @@ const getInitialProps: typeof App.getInitialProps = async appContext => {
const {
ctx: {req},
} = appContext;
- const locale = (req as any)?.locale ?? 'en';
+ const locale = (req as any)?.locale || (window as any).LOCALE || 'en';
const [appProps, messages] = await Promise.all([
polyfill(locale),
diff --git a/examples/with-react-intl/pages/_document.tsx b/examples/with-react-intl/pages/_document.tsx
new file mode 100644
index 000000000000..0eda159f2141
--- /dev/null
+++ b/examples/with-react-intl/pages/_document.tsx
@@ -0,0 +1,46 @@
+import Document, {
+ Html,
+ Head,
+ Main,
+ NextScript,
+ DocumentContext,
+} from 'next/document';
+
+interface Props {
+ locale: string;
+ lang: string;
+ nonce: string;
+}
+
+class MyDocument extends Document