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

快速開始

安裝

To install TacoTranslate in your application, open your terminal and navigate to the root directory of your project. Then, run the following command to install with npm:

npm install tacotranslate

This assumes you already have an application set up. See examples for more information.

基本用法

以下範例示範如何建立 TacoTranslate 用戶端,使用 TacoTranslate 提供者包裹您的應用程式,並使用 Translate 元件來顯示已翻譯的字串。

import createTacoTranslateClient from 'tacotranslate';
import {TacoTranslate, Translate} from 'tacotranslate/react';

const tacoTranslateClient = createTacoTranslateClient({apiKey: 'YOUR_API_KEY'});

function Page() {
	return <Translate string="Hello, world!" />;
}

export default function App() {
  return (
    <TacoTranslate client={tacoTranslateClient} locale="es">
      <Page />
    </TacoTranslate>
  );
}

範例設定為使用西班牙語(locale="es"),因此 Translate 元件會輸出「¡Hola, mundo!」。

建立 API 金鑰

範例

前往 我們的 GitHub 範例資料夾 以了解更多如何為您的使用情境設定 TacoTranslate,例如搭配 Next.js App Router 或使用 Create React App。

我們也已為你設置一個 CodeSandbox,你可以 在這裡查看

設定與組態

來自 Nattskiftet 的產品挪威製造