Azure Repos 集成允许您在 Azure Repos 仓库和 Crowdin 项目之间同步文件。
在基于文件的项目中,有两种 Azure Repos 集成模式可供选择:
在上述任一模式下,所有已翻译和批准的文件都将作为合并请求自动推送到 Azure Repos 仓库中的 l10n
分支。
In case the repository you need is private, and you have limited or no access to it, please ask the repository owner to provide you with an access token. 然后,点击 使用个人访问令牌 并将令牌填入 令牌 输入框中,然后点击 Set Up Integration。
在出现的对话框中,选择您的仓库和需要翻译的分支。 建议将重复字符串切换为 在版本分支内显示,这样相同的字符串将被隐藏在分支之间。 如果您的源文件包含具有明显标识符(键)的字符串,最好使用此选项的严格版本。 在其他情况下,请随意使用常规版本。
详细了解 重复字符串。
在 目标文件包模式 中使用 Azure Repos 集成时,集成将从您的 Crowdin 项目发送完成的译文,而无需从您的仓库中提取源代码。 因此,在选择应翻译的仓库和分支时,您可以指定集成应将生成的带有翻译的包放在何处。
详细了解配置 VCS 集成的目标文件包。
当您使用私有集成(例如,与自托管 VCS 集成)时,您需要将专用的 Crowdin IP 地址添加到白名单中,以确保其正常运行并保持安全。
阅读更多有关 IP 地址 的信息。
When translations are finished and your languages are ready to go live, Crowdin sends the pull request with translations to your version control system. For every branch that is under localization, Crowdin creates an additional service branch with translations. We don’t commit directly to the master branch so that you can verify translations first.
默认情况下,已在创建的服务分支名称中添加了 l10n_。 If necessary, you can easily change it.
要从仓库导入现有翻译,请选择以下选项之一:
默认情况下,选择第一个选项仅导入翻译一次。 或者,如果您不想从仓库导入翻译,则可以清除这两个选项。
By default, sources are not pushed to the repo with translations. Although, if you perform a source text review in your Crowdin project and would like to push the changes made to your source files on Crowdin back to your repo, click Edit, select Push Sources in the integration settings, and click Save.
There are cases when it’s necessary to disable translations from being pushed to the repo temporarily. 在这种情况下,单击 编辑,清除集成设置中的 同步计划,然后单击 保存。 准备好将译文与仓库同步时,选择 同步计划,然后单击 保存。
The synchronization is processed every hour automatically. If necessary, you can change the update interval in the integration settings. To configure the synchronization schedule – click Edit, scroll down to the Sync Schedule, set the preferred interval, and click Save.
不依赖于同步设置,仓库上的源文件的更改仍将与 Crowdin 持续同步。
When you set up the integration, you select existing repository branches to be added to the Crowdin project. 要将未来的分支从 Azure Repos 自动添加到 Crowdin,请在集成设置中为分支名称创建一个模式。
例如,您在 Azure Repos 集成设置中添加一个模式 *功能。 In this case, the future branches that contain this word at the end of the title will be added to the project.
To add a pattern for branch names, follow these steps:
crowdin.yml
is the default file name that is used for automatically synchronized branches. To change the default settings, click Edit, specify the preferred name in the Default configuration file name field in the integration settings, and click Save.
如果您没有为自动同步的分支指定自定义配置文件名,并且集成在分支的根目录中找不到默认名称为 crowdin.yml
的配置文件,则这些分支将在集成设置中用红色图标标记,并带有感叹号,表示“未准备好。 Check the configuration”.
为了使集成工作,您需要指定应翻译哪些源文件以及 Crowdin 应如何在您的仓库中构建翻译文件。 If you see a red icon with an exclamation mark next to the service branch name, it means that you haven’t selected any content for synchronization.
There are two ways you can specify content for synchronization:
This procedure is the same for all integrations with version control systems (VCS). Check VCS Integrations: Configuring Online to get to know how to select content for synchronization online.
配置文件 crowdin.yml
应与您要翻译的每个单独分支一起存储在 Azure Repos 仓库中,以便 Crowdin 知道应该发送哪些文件进行翻译。
它应该具有与 CLI 所需的相同结构,但出于安全原因,项目的凭据不应存储在文件头中。
阅读更多关于 创建配置文件 的信息。
如果您正在使用具有适用于不同操作系统版本的多平台产品,则可能需要连接包含每个操作系统源文件的多个仓库。 In this case, localization resources (e.g., TMs, Glossaries) and translations could be used more efficiently, reducing the time needed for project localization.
To add another repository, follow these steps:
集成设置完成后,所有相关信息都存储在“集成”选项卡 > Azure Repos 部分中。
集成连接后,只有配置集成的项目成员才能更新设置。 除配置集成的人员外,所有项目管理员都将看到 编辑 按钮被禁用,并在鼠标悬停在按钮上时显示以下消息:集成由 {全名} ({用户名}) 配置
。
默认情况下,每小时自动进行一次同步。 如果您需要立即启动同步 – 单击 立即同步。
或者,如果您只需要单独同步一个分支,请在所需分支上单击 ,然后选择 同步分支。
默认情况下,存储在 仓库中的译文仅在第一次同步期间上传到 Crowdin。 要手动将译文上传到 Crowdin,请单击 立即同步 按钮上的下拉切换按钮,然后单击 上传译文。 The integration will upload existing translations to your Crowdin project.
问:我有一个配置为每次提交都触发的应用程序构建。 由于 Crowdin 在单独的提交中提交每个翻译文件,我该如何避免由 Crowdin 的提交触发的不必要的应用程序构建? 答:由于 Crowdin 中的 VCS 集成使用 API 提交文件而不是 Git,因此每个文件都是单独提交的。
以下是一些可能有助于解决类似情况的建议:
export_languages
选项跳过您还不感兴趣的语言的提交。 详细了解 导出 VCS 集成的语言参数。