Transifex

  • Documentation
  • GitHub
  • Link Transifex with GitHub

Link Transifex with GitHub

Note

In order to find more information about the differences between Tx CLI client and a direct integration with GitHub, you can check the FAQ section here.

Simply point, click and update resources directly from Github with no coding. With the new GitHub Integration you will be able to connect a localization project in Transifex with a specific repository in GitHub using only the Transifex user interface.

Use our traditional GitHub integration tools described here to communicate with GitHub Enterprise. In this manner access is not given to an external service for something so important internally.

To begin you require two basic steps:

  • Choose to link to GitHub

    • Visit your Transifex Organization settings  
    • From the Left Hand Side Menu that appears, select Manage Integrations
    • Click on the Install the Transifex App link.
    • Select the GitHub Organization you wish to install the Transifex App to.
  • Connect the GitHub account with your localization organization in Transifex.

    • Return back to the Manage Integrations Page in Transifex and click on the Authorize Transifex Link.
    • Authenticate to GitHub and choose one or more repositories to make visible in Transifex. Authentication and repository selection on Github should be done by an owner (admin) of the account.

    ZVnGiEX8Hk0VAZ0ahRJDF21802fYQFmm1TTms2Pwal8TyKsps4TYFbDxO_iX4C9AvTWnH1ysq5CCH733K7QIeKHgheK6qNHwer2py-v5IxCCMM1xdzUEb34rMURu1gtG1LhuvGbP

    • When you are done with this process, you have authorized the selected GitHub repositories to be able to link to your organization’s localization projects.

Linking a specific project with a GitHub repository

Navigate to the project of your choice or create a new project and visit the Project settings page. In there, you will see a tab reading “Integrations”.

72vgumMkGeHfk3kz0IhvWTv0UfG23QvzTUSYQ9VClUzi5r80p9e-aCf0114ZoBVO0OASRKfOfnGQR3vDV0-55btW5KifUqu-gYg1prqCbQedkhffrMpWf4-eaN3gAJsA8Uy0nXr5

If the integration is set up as described in the previous step, you will see the GitHub option along with a button to Link Repository. Clicking on that button, the GitHub Integration wizard will pop up to manage the setup.

On the first step of the wizard, select the GitHub repository and branch to sync with the project.

GoN_BbnMFtW14x7qwStNrVrnKlSe70b66Q5AHIwZlNDcI1tWf6TO7fpo2NkTT0Y8Yb95FBLuKrfogIoYIcRj6gcNZA-n_Zd0heLQKUCHvzffo4u1OMbGM7-IPqmQmLkkQuXqzJYl

Available repositories listed are the ones you authorized when you installed the Transifex app on the Github account you used for the integration. Also, at this point the GitHub integration works on top of a single branch.

When you are done with this step, hit Next to setup the repository files that are related to localization. In this step, you define which files you want to localize along with some extra information that are required for the integration to work. The extra information required is:

  • filter_type: This specifies a directory or file
  • source_file: This points to the location of the source file. In case a directory is being used, then the field "source_file_dir" must be used instead.
  • file_format: This sets the type of the resources in your project, e.g. to PO. See the File formats section for details about the i18n type of each format available.
  • source_file_extension: This field is required in case a directory is being used
  • source_language: This is the source language of your project, such as en for English. This is the language you selected when you created your project.
  • translation_files_expression: A path expression which reflects the file/directory structure of your translation files. The expression must contain the <lang> keyword, denoting where the file paths differentiate per language, e.g. translations/po/<lang>.po.
  • language_mapping: If you use language codes other than the standard ISO ones, the integration lets you set up custom one-to-one language mappings. You'll just need to add a language_mapping section to the YAML configuration file.

The configuration follows a YAML syntax, and users can define a list of individual files or use regular expressions to match multiple files at once. Illustrated examples can be found below:

  • filter_type: file

github_file_yml_config.png#asset:5658



  • filter_type: dir

GitHub_directory.png#asset:5603


Clicking the Next button navigates to the final step of the setup, where you will define how the syncing between Transifex and GitHub will happen.

Y635_uW5b2BGDpZRgchawQmIkcRb82CkYIvsjBatFzm3sWqr3W_lqJszkkbIkXcbkjrW-qhgLTUJWnG-uMoM6ghDfZ3XKFUGJnusyC0k8dmp-6tAzd4YkZmPsKAU6gUeVqpjj0cE

7sH-XvQw-QpNTT2GOaidra5x5bAFDx956pu-mxUHpvkqI2lqQt4KrrDmViWFsOzbUotkiLNP-szqbAY-PkMok_jg8BH9X3__splf60U_1B-3jGrDZ7zgD_fx21SwClsv6qZ6V9fs

Pulling content from the designated GitHub repository and branch happens automatically upon changes on that branch.

To push localized content from Transifex back to GitHub you have the following options:

  • Upon 100% translated, reviewed or proofread content.

  • Push content via a Pull Request on that branch, which will create a new branch with the localized content and open a Pull Request on the branch, that you can later merge directly from GitHub.

  • Push content via a commit back to the selected branch.

When you are done with this setup you can click Save & Sync to start syncing content from GitHub to Transifex.

Syncing Existing Resources with GitHub

In case your localization process is already in progress, and your projects/resources have already been created in Transifex, you can still use the GitHub integration syncing your existing content stored in Transifex with your files hosted in GitHub. All you need to do is to execute the steps indicated in the previous section.

Once the process is completed, you will notice that the slug of your TX resources are updated following the schema: slug = "filename-extension--<branch name>" where filename is the name of the file stored in GitHub, extension is the extension of the file, and <branch name> is the name of the GitHub branch you've selected while setting this integration up.

Example:

  • Let's assume that the source file with the filename android.xml is stored in GitHub and you have already uploaded it to Transifex.
  • Once the TX resource is created, Transifex automatically generates a resource slug of the format: androidxml
  • When you sync this resource with GitHub, the system will locate the correct TX resource and then it will change the resource slug from androidxml to android-xml--master as you can see below:


slug_resource_github1.png#asset:5901

- Before syncing, ensure that the slug of the resources in Transifex follows the schema "filenameextension".

- Do not manually change the resource slug to "filename-extension--<branch name>".

filters:
- filter_type: file
  file_format: PO
  source_file: locale/example.po
  source_language: en
  translation_files_expression: 'Translations/<lang>/'
  • Synching Multiple Files of a Single File Type
filters:
- filter_type: dir
  file_format: STRINGS
  source_file_extension: strings
  source_language: en
  source_file_dir: locale/DirTest
  translation_files_expression: 'Translations/<lang>'
  • Synching Multiple Files of Different File Types
filters:
- filter_type: dir
  file_format: STRINGS
  source_file_extension: strings
  source_language: en
  source_file_dir: locale/DirTest
  translation_files_expression: 'Translations/<lang>'

- filter_type: dir
  file_format: KEYVALUEJSON
  source_file_extension: json
  source_language: en
  source_file_dir: locale/DirTest
  translation_files_expression: 'Translations/<lang>'

Manual sync

There is an option to send localised content to GitHub manually, without waiting for a resource to be 100% translated or reviewed. There is a "Sync Manually" option available on the Projects settings > Integrations tab in the GitHub card.

manualsync-view.png#asset:6248


By Clicking on "Sync Manually" a modal will appear requesting for the threshold localisation percentage that Transifex will check on all your project's resources.

manualsync-modalsettings.png#asset:6249


All target languages that are localised above that threshold will be synced with GitHub using the Sync content options you have setup for the integration. For example, if you had setup GitHub integration to Sync 100% translated resources by creating a commit to the selected branch, the manual process will identify all target languages whose translation percentage is equal or above the threshold percentage you set on the modal, thereby creating a commit for each target language.

Syncing content from GitHub

Syncing content from GitHub to Transifex happens either upon saving or updating the integration settings on the project level or automatically whenever new content is found on GitHub (after a commit on the branch that is associated with the integration).

When a syncing process is initiated, you will be able to see that syncing is in process in your Project settings > integrations tab under GitHub. This process could take some time, depending on the number and size of the files that are syncing.

On Project settings > integrations tab you will also be able to see details about the latest syncing with GitHub, so that you can detect any possible issues with specific files that either failed to be synced or weren’t found so that you can take some action to fix them.

Editing the Project-GitHub link

As your project evolves, you might end up in situations that you want to either extend the files you are syncing from GitHub or change the workflow of pushing localized content back on GitHub. To edit your options visit your Projects settings > integrations tab and click on the button in the GitHub integration. The interface to make the changes is the same as the one of the initial setup, but you will only be able to:

  • Update the detected files in the GitHub repository, by changing the YAML configuration.

  • Change options on how updates from Transifex are sent back to GitHub.

Please note that if you remove an already synced file or directory from the YAML configuration, the associated resource(s) will no longer be synced with the corresponding file(s) in GitHub.

Commit and PR messages from Transifex on GitHub

Any commits or PRs that are opening due to the integration are happening from a GitHub user called Transifex-localization-platform[bot].