Microsoft Co-Op Translator 是一款強大的工具,可以無縫翻譯 Markdown 文件。此指南將協助你排解使用過程中常見的問題。
問題: 翻譯後的 Markdown 文件頂部出現 markdown 標籤,導致顯示異常。
解決方法: 只需刪除文件頂部的 markdown 標籤,Markdown 文件就能正常顯示。
步驟:
.md) 文件。markdown 標籤。問題: 內嵌圖片的 URL 與語言地區不符,導致圖片顯示錯誤或缺失。
解決方法: 檢查圖片的 URL,確保與語言地區一致。所有圖片都存放在 translated_images 資料夾,每張圖片檔名都包含語言地區標籤。
步驟:
問題: 翻譯內容不夠準確或需要進一步編輯。
解決方法: 仔細檢查翻譯文件,必要時進行修改以提升準確度和可讀性。
步驟:
如果圖片或文字未正確翻譯,並且在 -d debug 模式下出現 401 錯誤,這通常是認證失敗——可能是金鑰無效、過期,或未連結至正確的端點地區。
請用 -d debug 參數 執行 co-op translator 以深入了解根本原因。
Access denied due to invalid subscription key or wrong API endpoint.資源類型
Azure AI services → Vision。隨著新選擇性翻譯系統上線,Co-op Translator 現在會明確顯示所需服務未設定時的錯誤訊息。
問題: 你要求圖片翻譯(-img 參數),但 Azure AI Service 未正確設定。
錯誤訊息:
Error: Image translation requested but Azure AI Service is not configured.
Please add AZURE_AI_SERVICE_API_KEY and AZURE_AI_SERVICE_ENDPOINT to your .env file.
Check Azure AI Service availability and configuration.
解決方法:
.env 文件中加入 AZURE_AI_SERVICE_API_KEY.env 文件中加入 AZURE_AI_SERVICE_ENDPOINT# Instead of: translate -l "ko" -img
# Use: translate -l "ko" -md
問題: 缺少必要的 LLM 設定。
錯誤訊息:
Error: No language model configuration found.
Please configure either Azure OpenAI or OpenAI in your .env file.
解決方法:
.env 文件至少有以下其中一種 LLM 設定:
AZURE_OPENAI_API_KEY 和 AZURE_OPENAI_ENDPOINTOPENAI_API_KEY只需設定 Azure OpenAI 或 OpenAI 其中一種,不需同時設定。
問題: 指令執行成功但沒有任何文件被翻譯。
可能原因:
-md, -img, -nb)錯誤解決方法:
translate -l "ko" -md -d
# For markdown files
find . -name "*.md" -not -path "./translations/*"
# For notebooks
find . -name "*.ipynb" -not -path "./translations/*"
# For images
find . -name "*.png" -o -name "*.jpg" -o -name "*.jpeg" -not -path "./translations/*"
# Translate everything (default)
translate -l "ko"
# Translate specific types
translate -l "ko" -md -img
問題: 依賴自動 markdown-only 回退的指令不再如預期運作。
舊行為:
# This used to automatically switch to markdown-only mode
translate -l "ko" # (when Azure AI Vision was not configured)
新行為:
# This now produces an error if image translation is requested but not configured
translate -l "ko" -img
解決方法:
translate -l "ko" -md # Only markdown
translate -l "ko" -md -img # Markdown and images
translate -l "ko" # Everything (if all services configured)
問題: 翻譯後文件中的連結指向非預期位置。
原因: 連結處理方式會根據選擇的檔案類型動態改變。
解決方法:
-nb:Notebook 連結指向翻譯後版本-nb:Notebook 連結指向原始檔案-img:圖片連結指向翻譯後版本-img:圖片連結指向原始檔案# All internal links point to translated versions
translate -l "ko" -md -img -nb
# Only markdown translated, other links point to originals
translate -l "ko" -md
現象: peter-evans/create-pull-request 的 workflow 日誌顯示:
Branch ‘update-translations’ is not ahead of base ‘main’ and will not be created
可能原因:
.gitignore 排除了你預期提交的檔案(如 *.ipynb, translations/, translated_images/)。如何修正/驗證:
translations/ 和/或 translated_images/ 內的新/變更檔案。
.ipynb 檔案確實寫入 translations/<lang>/...。.gitignore: 不要忽略產生的輸出。確保沒有忽略:
translations/translated_images/*.ipynb(如有翻譯 notebook)with:
add-paths: |
translations/
translated_images/
with:
commit-empty: true
-d,可顯示發現及寫入了哪些檔案。permissions:
contents: write
pull-requests: write
排查翻譯問題時:
-d 參數,查看詳細日誌-md, -img, -nb 是否符合你的需求.env 文件是否有必要的金鑰-md,再逐步加入其他類型如需更多指令及參數說明,請參閱 指令參考。
免責聲明: 本文件經由 AI 翻譯服務 Co-op Translator 翻譯。雖然我們致力於確保準確性,但請注意自動翻譯可能會包含錯誤或不準確之處。原始語言的文件應被視為具權威性的來源。對於重要資訊,建議使用專業人工翻譯。我們不會對因使用本翻譯而產生的任何誤解或錯誤詮釋承擔責任。