[go: up one dir, main page]

Skip to content

Latest commit

 

History

History

transifex

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 
 
 

Transifex

Transifex is used to support multiple languages. The scripts in this folder assist with pushing data for translators to Transifex and retrieving translated information.

Install required packages

Install the sphinx-intl utility.

pip install sphinx-intl==2.1.0

Also install the Transifex CLI client as described in the repository's README.

curl -o- https://raw.githubusercontent.com/transifex/cli/master/install.sh | bash

Set webhook variables

The build.sh script requires Transifex webhook token and URL values. These should be defined in a .env file. See .env.example for an example of the format.

Usage

Using the scripts requires adding a Transifex API token to an account that has access to the project as mention in the Transifex client documentation.

It is also necessary to add authorization information in a .transifexrc file as shown in this example:

[https://www.transifex.com]
api_hostname = https://api.transifex.com
hostname = https://www.transifex.com
password = <enter password generated on https://www.transifex.com/user/settings/api/ here>
username = api

To upload to Transifex

Run the following from the root of the project to upload to Transifex:

./transifex/pushtx.sh

To retrieve from Transifex

Next run the following to retrieve the translation updates:

./transifex/pulltx.sh

To build localized sites

Make sure the webhook variables are accessible. Run the following in the folder containing your .env file:

source .env

Next run the following to trigger builds for each language on ReadTheDocs:

./transifex/build.sh

To check build status for localized sites

Make sure the token variable is accessible. Run the following in the folder containing your .env file:

source .env

Next run the following to check build status for each language on ReadTheDocs:

./transifex/build-status-check.sh

Building localized sites locally

To test localized sites offline, use sphinx-build with the language parameter set to one of the language codes (see the locale folder for available languages):

sphinx-build -b html -D language='zh_CN' . _build/html/zh_CN