TacoTranslate
/
文件說明價格
 
  1. 介紹
  2. 入門指南
  3. 設定與配置
  4. 使用 TacoTranslate
  5. 伺服器端渲染
  6. 進階用法
  7. 最佳實踐
  8. 錯誤處理與除錯
  9. 支援的語言

錯誤處理與除錯

除錯提示

在整合和使用 TacoTranslate 時,您可能會遇到一些問題。需要注意的是,TacoTranslate 的預設行為是在發生錯誤時僅顯示初始文本。不會拋出錯誤或以其他方式中斷您的應用程式。

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

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

檢查網路請求
透過 tacotranslate 篩選請求,並檢查它們的輸出。

使用錯誤物件

TacoTranslate 透過 useTacoTranslate 鉤子提供一個錯誤物件,幫助您處理和除錯錯誤。此物件包含在翻譯過程中發生的任何錯誤資訊,讓您能在應用程式中做出適當回應。

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 的產品挪威製造