Transifex

  • Documentation
  • Javascript SDK
  • Setup Javascript SDK

Setup Javascript SDK

Note

Transifex Native is currently in BETA. To learn more about the solution or to have a hands on experience get in touch with us.

In this article you will find all the information regarding setting up your Transifex project to leverage Transifex Native SDK.

To get started with a Transifex Native setup you will need to have:

  • A Transifex account, either create a new account or sign in if you are an existing user.
  • Create a new Transifex project from within the Transifex application.

Installation

Transifex Native supports node.js 10.x.x versions and above.

To install the SDK to your project use this command:

$ npm install @transifex/native @transifex/cli --save


Authentication

To be able to authenticate you will need a set of credentials for the specific Transifex project you want to set up Transifex Native on.

Transifex Native SDK communicates with Transifex through the Transifex Content Delivery Service and requires the following credentials:

  • project_secret, related to your Transifex project and used for pushing source content to Transifex
  • project_token, again related to your Transifex project and used for pulling translations from Transifex

Once you have those two credentials you can proceed to configuring your project.

Before using Transifex Native you need to initialize it using the following snippet:

import { tx } from '@transifex/native';

tx.init({
  // Public project token, defaults to empty string
  token: 'project_token',

  // Source language locale code
  sourceLocale: 'en',

  // Optional list of enabled locales codes for translation
  appLocales: ['fr', 'de', 'pt_BR'],
});


A list of supported language codes is available here.

Note

If you are interested in testing Transifex Native on one of your Transifex projects, please get in touch with us to guide you through the process.