GitHub Connector Overview
The GitHub Connector is not compatible with self hosted GitHub (GitHub Enterprise) repositories. For options, consult the Options for Automation With Source Repositories article.
If your localization resource files are in a GitHub repository, the Smartling GitHub connector may be the ideal option for automating the process of sending source files to Smartling, and getting translations into your repository, where you need them. The Smartling hosted GitHub connector is designed to work well with standard development practices. It’s important to understand how and when files will move between the repository and your Smartling project.
We rely on your team, using pull requests, to start this process. The Smartling GitHub connector:
- Acts like a phantom developer focused on getting your resource files translated.
- Monitors all pull requests. Based on your configuration, if a pull request has files that require translation, it will jump into action, and flag that pull request.
- Uploads the original language files that require translation to your Smartling project, packaged as a job. They're uploaded to the Smartling project using a URI that includes the branch name they are being uploaded from.
- Will commit the translated versions of the files into a new branch in your repository when this translation job is complete in Smartling.
- Will make a pull request so that you can review and properly merge these changes.
Create a GitHub User
We recommend that you create a GitHub user specifically for use with Smartling. This user will be used to authenticate Smartling’s access to your repo when configuring the Smartling project, and will provide access to the repository. It will also be the user who is associated with the branches, commits, and pull requests that are made in your repository. (If you feel that this process may not be compatible with your development process, see Options for Automation with Source Repositories for an overview of other options.)
Once you allow Smartling to access your GitHub account, via the OAuth flow, there may be an additional authorization required by your GitHub admin. For example, your GitHub account may have been set up by a third-party application where authorization must be performed by an "owner".
If this is the case:
- Go to your GitHub Settings > Applications > Authorized OAuth Apps.
- Select Smartling GitHub Connector and then select request access. Until an owner grants access, the status will show as "Access request pending". During this time, the connector will fail to connect.
Flow for Resource File Translation with Smartling GitHub Connector
- Create branches to work on changes to your source code. In those branches, make edits to the original source language versions of your repositories’ localization resource files. This includes adding new files or modifying existing files.
- Make pull requests to merge the changes to your main (master) branch.
- If there are changes in the pull request to the resource files that require localization, the Smartling GitHub Connector will flag it.
- The Smartling GitHub Connector will create a job in your Smartling project. This job will be configured with the original language resource files, which will be uploaded using their branch’s name in the Smartling file URI.
- Translation happens according to your Smartling translation workflow which will include:
- The Job is Authorized for translation. (By default, automatically authorizing a job is disabled. To enable the feature, log in to Smartling and go to Project Settings > GitHub Settings then select Automatically Authorize All Jobs. This feature is only available for Enterprise customers.)
- The translation work is performed using workflows that can contain multiple steps.
- When all translations in the job have been published, the job is automatically updated to the completed state.
- The Smartling GitHub Connector will create a new “localization” branch from the branch where the pull request originated.
- The Smartling GitHub Connector will download the translated versions of the files from Smartling, and commit them to the “localization branch”, one commit per file, per language (locale).
- A pull request is made by the Smartling GitHub Connector for the localization branch that includes just the translated versions of the localization resource files.
- The location and file names of these translated files will depend on your configuration.
- Review, accept, and merge the localization branch pull request.
- The original branch is now “fully translated”.
- The original branch’s pull request is unflagged.
- The original branch’s pull request can now be accepted and merged with the main branch.