diff --git a/.github/actions/update-search-index/action.yml b/.github/actions/update-search-index/action.yml
index 7d40c350..eb6361c5 100644
--- a/.github/actions/update-search-index/action.yml
+++ b/.github/actions/update-search-index/action.yml
@@ -4,11 +4,8 @@ inputs:
locale:
description: "Locale to update (e.g., 'en' or 'zh-hans')"
required: true
- orama_private_api_key_en:
- description: "Orama Private API Key for EN"
- required: true
- orama_private_api_key_zh_hans:
- description: "Orama Private API Key for ZH-HANS"
+ orama_private_api_key:
+ description: "Orama Private API Key"
required: true
runs:
using: "composite"
@@ -26,5 +23,4 @@ runs:
run: pnpm run update-search-index
env:
LOCALE: "${{ inputs.locale }}"
- ORAMA_PRIVATE_API_KEY_EN: ${{ inputs.orama_private_api_key_en }}
- ORAMA_PRIVATE_API_KEY_ZH_HANS: ${{ inputs.orama_private_api_key_zh_hans }}
+ ORAMA_PRIVATE_API_KEY: ${{ inputs.orama_private_api_key }}
diff --git a/.github/actions/vercel-deploy/action.yml b/.github/actions/vercel-deploy/action.yml
index 6aae8586..7ff908f4 100644
--- a/.github/actions/vercel-deploy/action.yml
+++ b/.github/actions/vercel-deploy/action.yml
@@ -30,6 +30,14 @@ runs:
VERCEL_PROJECT_ID: ${{ inputs.vercel_project_id }}
VERCEL_ORG_ID: ${{ inputs.vercel_org_id }}
shell: bash
+ - name: Echo Vercel Environment File
+ run: |
+ ls -l .vercel/.env*
+ for f in .vercel/.env*; do
+ echo "\n----- $f -----"
+ cat "$f"
+ done
+ shell: bash
- name: Build Project Artifacts
run: npx vercel build ${{ inputs.prodFlag }} --token=${{ inputs.vercel_token }}
env:
diff --git a/.github/workflows/prerelease.yml b/.github/workflows/prerelease.yml
index f42bb615..9d8a05fa 100644
--- a/.github/workflows/prerelease.yml
+++ b/.github/workflows/prerelease.yml
@@ -19,13 +19,13 @@ jobs:
strategy:
matrix:
include:
- - name: Deploy EN
- locale: EN
+ - locale: en
secret_project_id: VERCEL_PROJECT_EN_ID
- - name: Deploy ZH-HANS
- locale: ZH-HANS
+ - locale: zh-hans
secret_project_id: VERCEL_PROJECT_ZH_HANS_ID
- name: ${{ matrix.name }}
+ - locale: zh-hant
+ secret_project_id: VERCEL_PROJECT_ZH_HANT_ID
+ name: Deploy ${{ matrix.locale }}
steps:
- name: Checkout code
uses: actions/checkout@v3
@@ -38,7 +38,6 @@ jobs:
uses: ./.github/actions/vercel-deploy
with:
environment: preview
- prodFlag: ""
vercel_project_id: ${{ secrets[matrix.secret_project_id] }}
vercel_org_id: ${{ secrets.VERCEL_ORG_ID }}
vercel_token: ${{ secrets.VERCEL_TOKEN }}
diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml
index 53af9eb2..b178fba8 100644
--- a/.github/workflows/release.yml
+++ b/.github/workflows/release.yml
@@ -12,13 +12,16 @@ jobs:
strategy:
matrix:
include:
- - name: Deploy EN
- locale: en
+ - locale: en
secret_project_id: VERCEL_PROJECT_EN_ID
- - name: Deploy ZH-HANS
- locale: zh-hans
+ orama_private_api_key: ORAMA_PRIVATE_API_KEY_EN
+ - locale: zh-hans
secret_project_id: VERCEL_PROJECT_ZH_HANS_ID
- name: ${{ matrix.name }}
+ orama_private_api_key: ORAMA_PRIVATE_API_KEY_ZH_HANS
+ - locale: zh-hant
+ secret_project_id: VERCEL_PROJECT_ZH_HANT_ID
+ orama_private_api_key: ORAMA_PRIVATE_API_KEY_ZH_HANT
+ name: Deploy ${{ matrix.locale }}
steps:
- name: Checkout code
uses: actions/checkout@v3
@@ -39,5 +42,4 @@ jobs:
uses: ./.github/actions/update-search-index
with:
locale: ${{ matrix.locale }}
- orama_private_api_key_en: ${{ secrets.ORAMA_PRIVATE_API_KEY_EN }}
- orama_private_api_key_zh_hans: ${{ secrets.ORAMA_PRIVATE_API_KEY_ZH_HANS }}
+ orama_private_api_key: ${{ secrets[matrix.orama_private_api_key] }}
diff --git a/README.md b/README.md
index 17d9e4de..965e85d8 100644
--- a/README.md
+++ b/README.md
@@ -47,7 +47,7 @@ pnpm dev
This project includes a custom translation utility that can translate the Next.js documentation into multiple languages. Currently, it supports:
- English (source)
-- Simplified Chinese (zh-Hans)
+- Simplified Chinese (zh-hans)
- More languages can be added in the translation configuration
Documentation content is stored in the `apps/docs/content` directory:
diff --git a/apps/docs/messages/zh-hant.json b/apps/docs/messages/zh-hant.json
new file mode 100644
index 00000000..aa8e6dee
--- /dev/null
+++ b/apps/docs/messages/zh-hant.json
@@ -0,0 +1,97 @@
+{
+ "baseOptions": {
+ "title": "Next.js 繁體中文",
+ "doc": "文件"
+ },
+ "meta": {
+ "title": "Next.js - 繁體中文",
+ "description": "生產級 React 應用,具備卓越擴展能力。全球領先企業都在用 Next.js by Vercel 構建靜態和動態網站及 Web 應用。"
+ },
+ "sidebar": {
+ "app": {
+ "title": "使用 App 路由器",
+ "description": "/app 中可用的功能"
+ },
+ "pages": {
+ "title": "使用 Pages 路由器",
+ "description": "/pages 中可用的功能"
+ },
+ "version": {
+ "latest": {
+ "title": "使用最新版本"
+ },
+ "v14": {
+ "title": "使用 14 版"
+ },
+ "v13": {
+ "title": "使用 13 版"
+ }
+ }
+ },
+ "HomePage": {
+ "title": "React 框架,面向 Web",
+ "subtitle": "被全球領先企業採用,Next.js 讓你可以用 React 元件的力量構建 高品質 Web 應用。",
+ "getStarted": "快速開始",
+ "learn": "學習 Next.js",
+ "copyCommand": "▲ ~ npx create-next-app@latest",
+ "featuresTitle": "Next.js 有什麼?",
+ "featuresSubtitle": "構建卓越 Web 產品所需的一切。",
+ "features": [
+ {
+ "title": "內建最佳化",
+ "desc": "自動圖片、字型和腳本最佳化,提升用戶體驗和核心 Web 指標。",
+ "href": "/docs/app/building-your-application/optimizing/images"
+ },
+ {
+ "title": "資料獲取",
+ "desc": "讓你的 React 元件支援 async/await。Next.js 支援伺服器端和客戶端資料獲取。",
+ "href": "/docs/app/building-your-application/data-fetching"
+ },
+ {
+ "title": "伺服器端操作",
+ "desc": "透過呼叫函式直接執行伺服器端程式碼,無需 API。輕鬆重新驗證快取並在一次網路往返中更新 UI。",
+ "href": "/docs/app/building-your-application/data-fetching/forms-and-mutations"
+ },
+ {
+ "title": "進階路由與巢狀路由",
+ "desc": "透過檔案系統建立路由,支援更進階的路由模式和 UI 佈局。",
+ "href": "/docs/app/building-your-application/routing"
+ },
+ {
+ "title": "動態 HTML 串流渲染",
+ "desc": "從伺服器即時串流渲染 UI,整合 App Router 和 React Suspense。",
+ "href": "/docs/app/building-your-application/routing/loading-ui-and-streaming"
+ },
+ {
+ "title": "CSS 支援",
+ "desc": "用你喜歡的工具為應用添加樣式,支援 CSS Modules、Tailwind CSS 及主流社群庫。",
+ "href": "/docs/app/building-your-application/styling"
+ },
+ {
+ "title": "路由處理器",
+ "desc": "構建 API 端點,安全連接第三方服務,處理認證或監聽 Webhook。",
+ "href": "/docs/app/building-your-application/routing/router-handlers"
+ },
+ {
+ "title": "中介軟體",
+ "desc": "靈活控制請求入口。用程式碼定義路由和存取規則,實現認證、實驗和國際化。",
+ "href": "/docs/app/building-your-application/routing/middleware"
+ },
+ {
+ "title": "React 伺服器端元件",
+ "desc": "無需傳送額外客戶端 JS 即可添加元件,基於最新 React 特性。",
+ "href": "/docs/app/building-your-application/rendering/server-components"
+ },
+ {
+ "title": "客戶端與伺服器端渲染",
+ "desc": "靈活的渲染與快取選項,包括每頁級別的 ISR(增量靜態再生)。",
+ "href": "/docs/app/building-your-application/rendering"
+ },
+ {
+ "title": "Next.js 15",
+ "desc": "全端能力賦能前端。閱讀發佈說明。",
+ "href": "/blog/next-15"
+ }
+ ]
+ }
+}
diff --git a/apps/docs/scripts/update-orama-index.mts b/apps/docs/scripts/update-orama-index.mts
index 08cc7478..5527e93f 100644
--- a/apps/docs/scripts/update-orama-index.mts
+++ b/apps/docs/scripts/update-orama-index.mts
@@ -7,10 +7,17 @@ import type { Locale } from 'next-intl';
import { sync } from '../src/lib/orama/orama-cloud';
export async function updateSearchIndexes(): Promise {
- const { locale, privateKey, index } =
- ORAMA_CONFIGS_MAP[process.env.LOCALE as Locale];
+ if (!process.env.ORAMA_PRIVATE_API_KEY) {
+ console.warn(
+ 'ORAMA_PRIVATE_API_KEY is not set. Skipping Orama index update.',
+ );
+ return;
+ }
+ const { locale, index } = ORAMA_CONFIGS_MAP[process.env.LOCALE as Locale];
- const manager = new CloudManager({ api_key: privateKey });
+ const manager = new CloudManager({
+ api_key: process.env.ORAMA_PRIVATE_API_KEY || '',
+ });
// Get all .body files in the static directory
const staticDir = path.join('.next/server/app/static');
let allRecords: OramaDocument[] = [];
diff --git a/apps/docs/scripts/update-search-index.mts b/apps/docs/scripts/update-search-index.mts
index c7fef9af..b6399e3b 100644
--- a/apps/docs/scripts/update-search-index.mts
+++ b/apps/docs/scripts/update-search-index.mts
@@ -1,6 +1,8 @@
import env from '@next/env';
env.loadEnvConfig(process.cwd());
+console.log(process.env);
+
import { updateSearchIndexes } from './update-orama-index.mjs';
async function main() {
diff --git a/apps/docs/src/lib/orama/config.ts b/apps/docs/src/lib/orama/config.ts
index 63ebafe6..70cf7f6d 100644
--- a/apps/docs/src/lib/orama/config.ts
+++ b/apps/docs/src/lib/orama/config.ts
@@ -2,7 +2,6 @@ import type { Locale } from 'next-intl';
const ORAMA_EN_CONFIG = {
locale: 'en',
- privateKey: process.env.ORAMA_PRIVATE_API_KEY_EN || '',
apiKey: '4DujbZrvGuklBRFcZBtegX3fV1lzNXnU',
index: 'vuywlowcbl1w3s2jtvq5ysxl',
endpoint: 'https://cloud.orama.run/v1/indexes/en-ai00ky',
@@ -12,15 +11,22 @@ type ORAMA_EN_CONFIG = typeof ORAMA_EN_CONFIG;
const OORAMA_ZH_HANS_CONFIG = {
locale: 'zh-hans',
- privateKey: process.env.ORAMA_PRIVATE_API_KEY_ZH_HANS || '',
apiKey: '6nEUS4tyXiajWxZ8qMEQMzzLoOYTuLSk',
index: 'vcwl00bwd64h3pa8yq8x107y',
endpoint: 'https://cloud.orama.run/v1/indexes/zh-hans-js5ujm',
};
+const OORAMA_ZH_HANT_CONFIG = {
+ locale: 'zh-hant',
+ apiKey: 'm2Wdhf6R37fKAhXNDufzbegTuQdz6aqf',
+ index: 'l4wtdj6zo3gpv432pmf4s98g',
+ endpoint: 'https://cloud.orama.run/v1/indexes/zh-hant-nvys3a',
+};
+
export const ORAMA_CONFIGS = [ORAMA_EN_CONFIG, OORAMA_ZH_HANS_CONFIG] as const;
export const ORAMA_CONFIGS_MAP: Record = {
en: ORAMA_EN_CONFIG,
'zh-hans': OORAMA_ZH_HANS_CONFIG,
+ 'zh-hant': OORAMA_ZH_HANT_CONFIG,
} as const;
diff --git a/apps/docs/translation.config.mjs b/apps/docs/translation.config.mjs
index 9b61df8a..3b0056aa 100644
--- a/apps/docs/translation.config.mjs
+++ b/apps/docs/translation.config.mjs
@@ -1,6 +1,6 @@
export default {
langs: {
- 'zh-Hans': {
+ 'zh-hans': {
name: 'Simplified Chinese',
// 翻译规则和指南
guide: `
@@ -13,19 +13,19 @@ export default {
// 格式: 'English term': '中文翻译'
terms: {},
},
- // 'zh-Hant': {
- // name: 'Traditional Chinese',
- // // 翻譯規則和指南
- // guide: `
- // - For technical terms that should not be fully translated, use the format: "繁體中文翻譯 (English term)"
- // Example: "伺服器渲染 (SSR)" instead of just "SSR" or just "伺服器渲染"
- // - Add a space between Chinese characters and English words/symbols to improve readability
- // - Maintain consistent translations for common terms across the entire document
- // `,
- // // 常見技術術語翻譯詞典
- // // 格式: 'English term': '繁體中文翻譯'
- // terms: {},
- // },
+ 'zh-hant': {
+ name: 'Traditional Chinese',
+ // 翻譯規則和指南
+ guide: `
+ - For technical terms that should not be fully translated, use the format: "繁體中文翻譯 (English term)"
+ Example: "伺服器渲染 (SSR)" instead of just "SSR" or just "伺服器渲染"
+ - Add a space between Chinese characters and English words/symbols to improve readability
+ - Maintain consistent translations for common terms across the entire document
+ `,
+ // 常見技術術語翻譯詞典
+ // 格式: 'English term': '繁體中文翻譯'
+ terms: {},
+ },
// ja: {
// name: 'Japanese',
// guide: `