Transifex

  • Documentation
  • Transifex Native Integrations
  • Bitbucket

Bitbucket

Note

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

To begin you require three basic steps:

  • Authorize your Transifex organization with your Bitbucket account.

    Navigate to Organization settings > Manage Integrations and click "Authorize Transifex app" under the Bitbucket widget. Then you’ll be able to see something like this:

    Bitbucket-Authorized.png#asset:6017


  • Link your Transifex project with a specific Bitbucket repository

    Navigate to your Transifex project of choice and click Settings, then navigate to Integrations tab.

    Bitbucket-project-link.png#asset:6018

    Click the Link Repository in the Bitbucket Integration widget and fillup the required details in the modal that pops up (See images below for each Link step)

    bitbucket3.jpg#asset:5960bitbucket-4.jpg#asset:5961

    When done hit Save & Sync to link your Transifex project to your Bitbucket repository and branch.

    Modal options are exactly the same as GitHub options, here for details.

  • Checking Bitbucket integration link status

    Having the Bitbucket integration active, navigate to your project Settings > Integration tab. There you will be able to see the sync status for the integration, displaying the last time the integration synced data from Bitbucket to Transifex.

    Bitbucket-linkstatus.png#asset:6019

Syncing existing resources with Bitbucket

In case your localization process is already in progress, and your projects/resources have already been created in Transifex, you can still use the Bitbucket integration syncing your existing content stored in Transifex with your files hosted in Bitbucket. 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 Bitbucket, extension is the extension of the file, and <branch name> is the name of the Bitbucket 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 Bitbucket 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 Bitbucket, 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:

bitbucket-10.jpg#asset:5969


- 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>".

YAML Configuration Parameter Descriptions:

The following are the parameters that are used for the YAML Configuration:

  • 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 in the sections to follow.

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>'

Synching Content from Bitbucket

Syncing content from Bitbucket to Transifex happens either upon saving or updating the integration settings on the project level or automatically whenever new content is found on Bitbucket (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 Bitbucket. 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 Bitbucket, 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-Bitbucket Link

As your project evolves, you might end up in situations that you want to either extend the files you are syncing from Bitbucket or change the workflow of pushing localized content back on Bitbucket. To edit your options visit your Projects settings > integrations tab and click on the button in the Bitbucket 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 Bitbucket repository, by changing the YAML configuration.
  • Change options on how updates from Transifex are sent back to Bitbucket.

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

Commit and PR Messages from Transifex on Bitbucket

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