Skip to content

Commit e5d9fee

Browse files
authored
feat(i18n): add multi-language support with next-intl (#1775)
1. Integrate next-intl/routing for locale-based routing 2. Add translation files for Chinese, English, and Japanese 3. Replace hardcoded Chinese strings with translation keys across components 4. Implement LocaleSwitcherFAB for language switching in footer 5. Update middleware to handle Accept-Language header and locale cookies 6. Migrate all pages to [locale]/ route structure 7. Replace next/link with enhanced Link/Router for locale-aware navigation
1 parent f016fb2 commit e5d9fee

142 files changed

Lines changed: 4782 additions & 1040 deletions

File tree

Some content is hidden

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

.env.example

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
11
NEXT_PUBLIC_API_URL=http://127.0.0.1:2333/api/v2
22
NEXT_PUBLIC_GATEWAY_URL=http://127.0.0.1:2333
33
NEXT_PUBLIC_SNIPPET_NAME=kami
4+
NEXT_PUBLIC_KAMI_LOCALES=zh,en
5+
# Comma-separated locale codes (zh,en,ja). Omit or leave empty to enable all. Must include zh.
6+
# NEXT_PUBLIC_KAMI_LOCALES=zh,en
47
ASSETPREFIX=

.eslintrc.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,17 @@
11
module.exports = {
22
extends: ['@innei/eslint-config-react-ts'],
3+
settings: {
4+
react: {
5+
version: 'detect',
6+
},
7+
},
38
rules: {
49
'@typescript-eslint/no-empty-function': 'off',
510
'@typescript-eslint/no-empty-interface': 'off',
611
'@typescript-eslint/no-non-null-assertion': 'off',
712
'no-restricted-globals': ['error', 'close', 'open', 'name', 'event'],
13+
'react/display-name': 'off',
14+
'react-hooks/exhaustive-deps': 'off',
815
'react/self-closing-comp': 'warn',
916
'react/jsx-curly-brace-presence': [
1017
'error',

.github/workflows/nextjs_bundle_analysis.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ jobs:
5959
run: npx -p nextjs-bundle-analysis report
6060

6161
- name: Upload bundle
62-
uses: actions/upload-artifact@v3
62+
uses: actions/upload-artifact@v4
6363
with:
6464
name: bundle
6565
path: .next/analyze/__bundle_analysis.json
@@ -78,7 +78,7 @@ jobs:
7878

7979
- name: Upload analysis
8080
if: success() && github.event.number
81-
uses: actions/upload-artifact@v3
81+
uses: actions/upload-artifact@v4
8282
with:
8383
name: analysis_comment
8484
path: .next/analyze/__bundle_analysis_comment.txt
@@ -89,7 +89,7 @@ jobs:
8989

9090
- name: Upload PR number
9191
if: ${{ always() }}
92-
uses: actions/upload-artifact@v3
92+
uses: actions/upload-artifact@v4
9393
with:
9494
name: pr
9595
path: ./pr-id.txt

package.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@
6060
"dependencies": {
6161
"@floating-ui/react-dom": "2.0.2",
6262
"@formkit/auto-animate": "1.0.0-beta.6",
63-
"@mx-space/api-client": "1.13.1",
63+
"@mx-space/api-client": "2.0.0",
6464
"@sentry/nextjs": "7.74.1",
6565
"axios": "1.5.1",
6666
"clsx": "2.0.0",
@@ -75,6 +75,7 @@
7575
"medium-zoom": "1.0.8",
7676
"mermaid": "10.5.0",
7777
"next": "13.5.3",
78+
"next-intl": "^4.7.0",
7879
"next-seo": "6.1.0",
7980
"next-suspense": "0.2.3",
8081
"randomcolor": "0.6.2",
@@ -108,7 +109,7 @@
108109
"@types/markdown-escape": "1.1.2",
109110
"@types/node": "20.8.6",
110111
"@types/randomcolor": "0.5.8",
111-
"@types/react": "17.0.68",
112+
"@types/react": "18.2.13",
112113
"@types/react-color": "3.0.9",
113114
"@types/react-dom": "18.2.13",
114115
"@types/remove-markdown": "0.3.3",

0 commit comments

Comments
 (0)