TacoTranslate
/
DocumentationPricing
 
  1. Introduction
  2. Getting started
  3. Setup and configuration
  4. Using TacoTranslate
  5. Server-side rendering
  6. Advanced usage
  7. Best practices
  8. Error handling and debugging
  9. Supported languages

Getting started

Installation

To install TacoTranslate in your project, 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 a project set up. See examples for more information.

Basic usage

The below example demonstrates how to create a TacoTranslate client, wrap your application with the TacoTranslate provider, and use the Translate component to display translated strings.

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>
  );
}

The example is set to use Spanish (locale="es"), so the Translate component will output "¡Hola, mundo!".

Create an API key

Examples

Head on over to our GitHub examples folder to learn more about how to set up TacoTranslate specifically for your use case, such as with the Next.js App Router, or using Create React App.

We also have a CodeSandbox set up that you can check out here.

Setup and configuration

A product from Nattskiftet