Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix i18next configuration not taking effect #295

Merged
merged 1 commit into from
Aug 30, 2023
Merged

fix i18next configuration not taking effect #295

merged 1 commit into from
Aug 30, 2023

Conversation

JohnsonMao
Copy link
Contributor

Why need this change? / Root cause:

  • 修正 Production 版 i18n 設定檔未生效問題

Changes made:

Test Scope / Change impact:

Issue

@JohnsonMao JohnsonMao self-assigned this Aug 30, 2023
@vercel
Copy link

vercel bot commented Aug 30, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
game-lobby-web ✅ Ready (Inspect) Visit Preview 💬 Add feedback Aug 30, 2023 9:35am

@github-actions github-actions bot added the bug Fix something in main label Aug 30, 2023
@sonarqubecloud
Copy link

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
0.0% 0.0% Duplication

@GaaSBot
Copy link

GaaSBot commented Aug 30, 2023

Knip Scan Result for f47135c

Unused files (10)
Unused files (10)
.bundlewatch.config.js
components/shared/Chat/ChatContent.tsx
components/shared/Chat/ChatMessage.tsx
components/shared/Chat/index.tsx
components/shared/Icon/group/news.tsx
configs/i18nConfigs.ts
lighthouserc.js
reset.d.ts
scripts/knipScanReporter.js
scripts/lhciScanReporter.js
Unused dependencies (2)
Unused dependencies (2)
@svgr/webpack package.json
sharp package.json
Unused devDependencies (5)
Unused devDependencies (5)
@actions/github package.json
@octokit/core package.json
@storybook/blocks package.json
@storybook/testing-library package.json
@total-typescript/ts-reset package.json
Configuration issues (1)
Configuration issues (1)
Unused item in ignoreDependencies: @next/bundle-analyzer

@GaaSBot
Copy link

GaaSBot commented Aug 30, 2023

🤖 Lighthouse Scan Result for f47135c

/rooms
Metric Value
Performance 56
Seo 80
Accessibility 79
HTML Report for LHCI Scan Report Link
/rooms/abc
Metric Value
Performance 73
Seo 80
Accessibility 69
HTML Report for LHCI Scan Report Link
/login
Metric Value
Performance 50
Seo 80
Accessibility 97
HTML Report for LHCI Scan Report Link

@JohnsonMao JohnsonMao merged commit fe6cf7f into main Aug 30, 2023
@JohnsonMao JohnsonMao deleted the fix/i18n branch August 30, 2023 09:38
@ttpss930141011
Copy link
Contributor

Hello @JohnsonMao

合進去了似乎問題沒有解決!為了方便找蟲子顧暫時沒有 revert。

我在分支這邊嘗試了把 Startup 註解,繞過登入驗證過後可以正常在 Preview 測試了!

如圖:

image

@JohnsonMao
Copy link
Contributor Author

Hello~ @ttpss930141011 @Yuwen-ctw
感謝你提供本地端 Preview 的測試方式
現在遇到的問題點是因為我們透過 docker 打包
其中有透過 dockerfile 來移動 public 資料夾位置
所以就找不到 public 資料夾
目前 next-i18next.config.js 似乎不是在根目錄
所以造成路徑上找不到檔案
image

以上是我目前觀察到的結果,至於如何解決我可能要研究一下 docker 打包後的結構長怎樣
如果有想法知道如何解決~歡迎接手 👍

@Yuwen-ctw
Copy link
Contributor

Hello @JohnsonMao @ttpss930141011
個人目前的想法是,./public 應該是有在根目錄的,原因有以下幾點:

  1. ./public 裡面尚有其他檔案 (如登入頁面背景圖),因此假如 ./public 整層不見,那在產品端應該看不到背景圖。
  2. 嘗試在 dev mode 移除或更名 ./public/locales/zh-tw 資料夾,啟動專案後會發現直接出現錯誤,因此推測產品端的 i18n 找不到指定資料夾也會出錯。
  3. 觀察 Dockerfile 的結構,./public 移動的目的地應該也是根目錄沒錯,而剛剛在本機容器化本專案的 Production,產出容器後使用複製的指令,嘗試將容器內的專案根目錄的 ./public 資料夾移出到本機,結果也是可行的,具體流程如下:
     (1) 本地專案根目錄新增 .env 檔案,並輸入 NODE_ENV=production(設定待會建立的 Image 是根據 Dockerfile.production)
     (2) CLI docker compose build 產製 Image
     (3) CLI docker compose up 根據 Image 產製並啟動 Container(到這邊雖然啟動容器會失敗,但容器確實已經建立,因此可以在下個步驟訪問容器)
     (4)CLI docker cp game-lobby-web-app-1:/app/public ./abc ,嘗試將容器 (game-lobby-web-app-1) 內專案根目錄 (/app) 的 public 資料夾複製到本機專案根目錄的 abc 資料夾
     (5)打開 ./abc/locales/zh-tw/rooms.json 確實有對應的資料
    上述步驟也可以改成嘗試取出容器內專案根目錄的 next-i18next.config.js,也可以成功。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Fix something in main sprint 9
Projects
None yet
Development

Successfully merging this pull request may close these issues.

fix: i18n Not Working in Production
4 participants