Skip to content

Commit a1890e9

Browse files
mikecaoclaude
andcommitted
Replace react-intl with next-intl and consolidate lang files.
Migrate i18n from react-intl to next-intl, eliminating the formatjs compilation pipeline. Translation files now live as nested JSON in public/intl/messages/ (single source of truth), removing the duplicated src/lang/ directory and the copy/compile build steps. The useMessages() hook API is preserved so all 195+ consumer components are unchanged. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent fed8d4c commit a1890e9

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

118 files changed

+18149
-136655
lines changed

next.config.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
import 'dotenv/config';
2+
import createNextIntlPlugin from 'next-intl/plugin';
23
import pkg from './package.json' with { type: 'json' };
34

5+
const withNextIntl = createNextIntlPlugin('./src/i18n/request.ts');
6+
47
const TRACKER_SCRIPT = '/script.js';
58

69
const basePath = process.env.BASE_PATH || '';
@@ -164,7 +167,7 @@ if (cloudMode) {
164167
}
165168

166169
/** @type {import('next').NextConfig} */
167-
export default {
170+
export default withNextIntl({
168171
reactStrictMode: false,
169172
env: {
170173
basePath,
@@ -202,4 +205,4 @@ export default {
202205
async redirects() {
203206
return [...redirects];
204207
},
205-
};
208+
});

package.json

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
},
1212
"type": "module",
1313
"scripts": {
14-
"dev": "next dev -p 3001 --turbo",
14+
"dev": "next dev -p 3003 --turbo",
1515
"build": "npm-run-all check-env build-db check-db build-tracker build-geo build-app",
1616
"start": "next start",
1717
"build-docker": "npm-run-all build-db build-tracker build-geo build-app",
@@ -23,7 +23,7 @@
2323
"build-components": "tsup",
2424
"build-tracker": "rollup -c rollup.tracker.config.js",
2525
"build-prisma-client": "node scripts/build-prisma-client.js",
26-
"build-lang": "npm-run-all format-lang compile-lang download-country-names download-language-names clean-lang",
26+
"build-lang": "npm-run-all download-country-names download-language-names",
2727
"build-geo": "node scripts/build-geo.js",
2828
"build-db": "npm-run-all build-db-client build-prisma-client",
2929
"build-db-schema": "prisma db pull",
@@ -33,12 +33,6 @@
3333
"check-db": "node scripts/check-db.js",
3434
"check-env": "node scripts/check-env.js",
3535
"copy-db-files": "node scripts/copy-db-files.js",
36-
"extract-messages": "formatjs extract \"src/components/messages.ts\" --out-file build/extracted-messages.json",
37-
"merge-messages": "node scripts/merge-messages.js",
38-
"generate-lang": "npm-run-all extract-messages merge-messages",
39-
"format-lang": "node scripts/format-lang.js",
40-
"compile-lang": "formatjs compile-folder --ast build/messages public/intl/messages",
41-
"clean-lang": "prettier --write ./public/intl/**/*.json",
4236
"download-country-names": "node scripts/download-country-names.js",
4337
"download-language-names": "node scripts/download-language-names.js",
4438
"change-password": "node scripts/change-password.js",
@@ -102,6 +96,7 @@
10296
"lucide-react": "^0.543.0",
10397
"maxmind": "^5.0.5",
10498
"next": "^16.1.6",
99+
"next-intl": "^4.8.2",
105100
"node-fetch": "^3.2.8",
106101
"npm-run-all": "^4.1.5",
107102
"papaparse": "^5.5.3",
@@ -111,7 +106,6 @@
111106
"react": "^19.2.4",
112107
"react-dom": "^19.2.4",
113108
"react-error-boundary": "^4.0.4",
114-
"react-intl": "^7.1.14",
115109
"react-resizable-panels": "^4.6.0",
116110
"react-simple-maps": "^2.3.0",
117111
"react-use-measure": "^2.0.4",
@@ -127,7 +121,6 @@
127121
},
128122
"devDependencies": {
129123
"@biomejs/biome": "^2.3.14",
130-
"@formatjs/cli": "^4.2.29",
131124
"@netlify/plugin-nextjs": "^5.15.7",
132125
"@rollup/plugin-alias": "^5.0.0",
133126
"@rollup/plugin-commonjs": "^25.0.4",
@@ -143,7 +136,6 @@
143136
"babel-plugin-react-compiler": "19.1.0-rc.2",
144137
"cross-env": "^10.1.0",
145138
"cypress": "^13.6.6",
146-
"extract-react-intl-messages": "^4.1.1",
147139
"husky": "^9.1.7",
148140
"jest": "^29.7.0",
149141
"lint-staged": "^16.2.6",

0 commit comments

Comments
 (0)