Azure DevOps repos

Learn how to integrate Lokalise projects with Azure DevOps repos.

Ilya Krukowski avatar
Written by Ilya Krukowski
Updated over a week ago

Please note that currently this feature does not support self-hosted versions.

Azure Repos is a private Git repository cloud hosting that supports Team Foundation Version Control (TFVC).

Configuration

Open your Azure DevOps project and open Project settings in the bottom left corner.

Find Azure DevOps services section and enable the Repos service.

Now after refreshing the page, you should see the Repos tab in the left menu. Here you can add your project source code as usual.

Open your organization settings, proceed to Policies (under Security section) and enable the Third-party application access via OAuth option.

Now proceed to Lokalise, open your translation project and proceed to Apps. Open Azure Repos app and click Install. Click Connect and then Authorize. Sign in with your Microsoft account and allow access. If you'd like to use a personal access token from a different account, please follow the steps listed below.

Now enter your repository name (prefixed with your organization name, and project name, Organization/Project/Repo) and a branch to use. Provide one or more platforms to include in exports.

Also decide whether you would like the filenames to include a full path. It is not needed in most cases, as you can configure the directory structure prefix at the pull request creation (export) step. However, when you have similar files in different subfolders, e.g. admin/locale.json and frontend/locale.json, you have to enable the Include path in the filenames option. Keep in mind that if you already have files uploaded to the project, including a path in the filenames at this step would mean that you are uploading different files.

Click Select files to pull.

Choose one or more translation files and adjust the detected languages as needed. Once you are ready, click Confirm.

As we recommend keeping all platform files within the same project, you may want to set up other repositories that apply to the same project. Click Add another repo to add more repositories.

Pulling files

Manual pull

Click Pull now to import translation files from your repo to Lokalise. Clicking this button will add the pull to the system queue to be executed in the background. You can check the process status by clicking More > Activity:

Alternatively, click Logs on the Azure app page:

If you need to adjust the options, click Pull options on the app page:

These options are similar to the ones presented on the Upload page.

Auto-pull

When you are satisfied with the initial pull results, it is a good idea to set up a webhook which automates pulling the changes to Lokalise as you push to your Azure repo.

To set up the auto-pull feature, open your Azure DevOps project and click Project settings in the bottom left corner. Then proceed to Service hooks and click Create subscription:

Choose Web Hooks from the list and click Next:

  • Choose Code pushed as a trigger event.

  • Choose your repository from the list.

  • Optionally, specify a desired branch and a group.

Click Next and provide the following:

  • URL — insert the Auto-pull URL from app settings on Lokalise. Please note that currently we are in the process of migrating all auto-pull URLs from app.lokalise.com to api.lokalise.com subdomain. Thus, on the app's page you may still see app.lokalise.com specified for the auto-pull URL but it is very much recommended to change it to api.lokalise.com when pasting to Azure.

  • HTTP header — be X-Lokalise-Secret:{secret} , where {secret} is the Auto-pull secret from app settings on Lokalise.

  • Provide other optional settings as needed.

  • Click Test to make sure your webhook works and then hit Finish to complete the setup.

Pull requests

To export translation files from Lokalise to the Azure repo, you have to create a new pull request. To achieve that, proceed to the Download page, adjust export options as needed and make sure to enable the Azure Repos trigger:

Optionally, choose one or more repositories from the Filter repositories dropdown and provide a custom Commit message. It is a good idea to use the Preview button first, so you can see the resulting file/folder structure before triggering the creation of a pull request.

To actually create a pull request on Azure, you should press Build only (this way you won't download a translation bundle to your local PC). To check the status of the pull request creation, return to the Azure repos app page and click the Logs button.

Here is what happens after you trigger a new PR:

  1. A new branch is created from the last revision of the branch you chose in the app setup. The branch name would look like this: lokalise-2018-03-12_15-14-13 .

  2. A commit with all the files is created in the new branch.

  3. A pull request from the new branch to the previously chosen branch is created.

You may then review and merge a new pull request on Azure.

Special notes

Using token from a different account

If you need to use a different personal access token from Azure when setting up integration on Lokalise, please perform the following steps:

  1. Make sure you log out from Azure first. If you don't do this, Lokalise will automatically fetch the personal access token of the currently logged in user.

    1. If you are using Microsoft SSO on Lokalise, Azure will try to use the token of the SSO user. To overcome this problem you should log out from Microsoft after you've successfully logged into Lokalise.

  2. Proceed to installing the Azure app on Lokalise as usual. Lokalise should redirect you to the Microsoft login page where you can choose any account on whose behalf you’d like to connect the Azure repo. In other words, you should see the following screen:

Did this answer your question?