Setup Django SDK
In this article, you will find all the information regarding setting up your Transifex project to leverage the 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 Native project from within the Transifex application.
Installation
Transifex Native supports the following versions:
- Python 2.7, 3.5+
- Django 1.11+
To install the SDK to your project use this command:
$ pip install transifex-python
You can also find the toolkit in PyPi: Transifex Python toolkit
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 communicate 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 Transifexproject_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 Django project.
Configuration
Add the following entries in the settings file of your Django project.
INSTALLED_APPS = [
...,
'transifex.native.django',
]
LANGUAGE_CODE = 'en-us' # replace with your project's source language
USE_I18N = True
USE_L10N = True
# Replace with the proper values for the Transifex project token and secret,
# as found in the Transifex UI under your project
TRANSIFEX_TOKEN = <project_token> # used for pulling translations from Transifex
TRANSIFEX_SECRET = <project_secret> # used for pushing source content to Transifex
TRANSIFEX_SYNC_INTERVAL = <seconds> # used for defining the daemon running interval in seconds
A list of supported language codes is available here and should be declared in the ll-cc
format, compatible with the Accept-Language
HTTP header specification, for example pt-br
instead of pt_BR
.
Updated almost 3 years ago