TacoTranslate
/
說明文件價格
 
  1. 簡介
  2. 開始使用
  3. 設定與組態
  4. 使用 TacoTranslate
  5. 伺服器端渲染
  6. 進階用法
  7. 最佳實務
  8. 錯誤處理與偵錯
  9. 支援的語言

錯誤處理與偵錯

除錯提示

在整合與使用 TacoTranslate 時,您可能會遇到問題。值得注意的是,TacoTranslate 的預設行為是在發生錯誤時僅顯示初始文字。不會丟出錯誤或以其他方式中斷您的應用程式。

通常這些問題都很容易解決。以下是一些有用的除錯提示:

檢查主控台日誌
當發生錯誤時,TacoTranslate 會輸出除錯資訊。

檢查網路請求
tacotranslate 篩選請求並檢視其輸出。

使用錯誤物件

TacoTranslate 會透過 useTacoTranslate hook 提供一個錯誤物件,協助您處理與偵錯錯誤。該物件包含翻譯過程中發生的任何錯誤的相關資訊,讓您能在應用程式中做出適當的回應。

import {useTacoTranslate, Translate} from 'tacotranslate/react';

function Page() {
  const {error} = useTacoTranslate();

  return (
    <div>
      {error ? <div>Error: {error.message}</div> : null}
      <Translate string="Hello, world!" />
    </div>
  );
}
支援的語言

來自 Nattskiftet 的產品挪威製造