Skip to Content
TranslateSheet now in beta 🎉
Installation and Setup

Installation & Setup

This section will guide you through installing TranslateSheet, setting up peer dependencies, and configuring your project to start using TranslateSheet in your React or React Native app.

Installation

Install the translate-sheet package from npm:

Peer Dependencies

TranslateSheet relies on i18next for runtime translations. You need to install i18next as a peer dependency:

Configuration

To get started, you need to create a TranslateSheet configuration file at the root of your project. This file defines essential options like your API key, primary language, output directory, and more.

Example Configuration File

Create a file named translateSheetConfig.js in the root of your project:

const translateSheetConfig = { apiKey: "your-api-key-here", output: "./i18n", primaryLanguage: "en", fileExtension: ".ts", languages: ["es", "fr", "de", "ja"], generatePrimaryLanguageFile: false, }; module.exports = translateSheetConfig;

Configuration Options

OptionTypeRequiredDefaultDescription
apiKeystringfalsenullThe API key used for authenticating with the TranslateSheet backend.
outputstringfalse"./i18n"The directory where the generated translation files will be saved.
primaryLanguagestringfalse"en"The primary language of the project (e.g., “en” for English).
fileExtension".ts", ".js", ".json"false".ts"The file extension for the generated translation files.
languagesstring[]false[]An array of target languages for translation (e.g., [“es”, “ru”, “ja”]).
generatePrimaryLanguageFilebooleanfalsefalseOptionally generate a consolidated file for your primary language

Note: Without a valid API key, AI translations will not be available when running the generate command.

Generating an API Key

To use TranslateSheet’s AI-powered translation feature, you need an API key. Follow these steps to generate your API key:

  1. Go to the TranslateSheet Dashboard .
  2. Sign up or log in with your account.
  3. Create a new project
  4. Navigate to the API Keys section of your newly created project.
  5. Copy the generated API key and add it to your translateSheetConfig.js file under the apiKey option

Next Steps

Once you have installed TranslateSheet, set up your configuration file, and generated an API key, you’re ready to start using it in your components. Head over to the Usage section to learn how to define translations and run the gen-translations command.

Last updated on