Microsoft Co-Op Translator 是一款強大的工具,能夠無縫翻譯 Markdown 文件。本指南將協助你排解在使用此工具時常見的問題。
問題: 翻譯後的 Markdown 文件頂部出現 markdown 標籤,導致渲染異常。
解決方法: 只需刪除文件頂部的 markdown 標籤,即可讓 Markdown 文件正確顯示。
步驟:
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 服務未正確設定。
錯誤訊息:
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:筆記本連結指向翻譯後版本-nb:筆記本連結指向原始檔案-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(若有翻譯筆記本)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 進行翻譯。雖然我們力求準確,但請注意,自動翻譯可能包含錯誤或不精確之處。原始語言的文件應視為最具權威性的來源。對於重要資訊,建議採用專業人工翻譯。因使用本翻譯而產生的任何誤解或誤釋,我們概不負責。