$ mope tx [push|pull]
(e.g. mope tx push
): Pushes new and updated content to Transifex for translation
(e.g. mope tx pull <resource>
): Pulls translated content from Transifex resource and appends to po files
Note: These options are only available for push
right now.
(e.g. mope tx push --project=master
): Pushes translated content from local repo into Transifex master resource
(e.g. mope tx push --all
): Pushes translated content from local repo into Transifex all_translations resource
Transifex is used to translate our content. Each step in the process is an
interaction between Transifex and the codebase. We use .po
files to store trn
content locally and on Transifex.
-
push
- Each time a PR is created or updated a Transifexresource
(named after the branch) is created or updated, assuming trn content is created or changed. This is run via Travis.push
parses the codebase, extracting trn content withbabel-plugin-react-intl
. It loads content from the${txProject}-master
transifex project which is used as a point of comparison for a diff. The results of the diff (if any) are put in a new resource inmup-web
on transifex. -
push --project=master
- Updates the master resource - the canonical copy of translated content. The main usage is for diffing against when examining a new / updated PR. This is run whenever there's an update to the master branch. This pushes all languages. -
push --all
- Updates the all_translations resource - the editable copy of all translations content in a given repo. The main usage is for updating translation content through Transifex without developer intervention. This is run whenever there's an update to the master branch, so it is always in sync with master. -
pull <resource>
- should be run while on a fresh branch frommaster
, separate from other code changes. It will download translated content from the current project's resources in order of most-recently-updated. Merges pulled content intosrc/trns/po/{localeCode}.po
files. Run for each resource you wish to pull down, usually resources where translation is complete. Commit result, create PR, and merge PR after Travis build has passed. -
pullAll
- should be run while on a fresh branch frommaster
, separate from other code changes. It will download translated content from all resources for the project it is run in in last updated resource order. As each resource is pulled, and then merges pulled content into the associated by localesrc/trns/po/{localeCode}.po
files.- If you'd like to have a history of each change based on resource add a flag of
-c
and it will create a unique commit for each resource that has a change to commit. - Please note that if your project has a
all_translations
resource for translators to be able to edit any key that is in the master project, this resource will be pulled first then all other resources will be downloaded after and applied on top of it.
Commit result, create PR, and merge PR after Travis build has passed.
- If you'd like to have a history of each change based on resource add a flag of
-
Adding new locales / languages - First make sure that the language has been added to the project in Transifex. Create a new
.po
file insrc/trns/po
, copying the first three lines (headers) from another.po
file. Add the locale tosrc/util/locales.js
and https://github.com/meetup/meetup-web-platform/blob/master/src/util/localizationUtils.js