• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

dotnet/xliff-tasks: MSBuild tasks and targets which allow the localization of st ...

原作者: [db:作者] 来自: 网络 收藏 邀请

开源软件名称(OpenSource Name):

dotnet/xliff-tasks

开源软件地址(OpenSource Url):

https://github.com/dotnet/xliff-tasks

开源编程语言(OpenSource Language):

PowerShell 38.7%

开源软件介绍(OpenSource Introduction):

xliff-tasks

A set of MSBuild tasks and targets to automatically update xliff (.xlf) files for localizable resources, and to build satellite assemblies from those xliff files.

Build Status

Windows x64
Build Status

Installing

If you're using the Arcade Toolset then the Microsoft.DotNet.XliffTasks package is already pulled in, and enabled by default.

Otherwise, you'll need to add the Azure DevOps feed https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-eng/nuget/v3/index.json (browse) to your NuGet.config file, and then add a PackageReference for the XliffTasks package, like so:

<PackageReference Include="Microsoft.DotNet.XliffTasks" Version="1.0.0-beta.19253.1" PrivateAssets="all" />

The PrivateAssets metadata is needed to prevent dotnet pack or msbuild /t:pack from listing Microsoft.DotNet.XliffTasks as one of your package's dependencies.

Using Microsoft.DotNet.XliffTasks

Updating .xlf files

Once Microsoft.DotNet.XliffTasks is installed building a project will automatically build satellite assemblies from .xlf files. To update .xlf files to bring them in line with the source .resx/.vsct/.xaml files you need to run the UpdateXlf target, like so:

msbuild /t:UpdateXlf

This will only update the .xlf files. Alternatively, run a normal build with the UpdateXlfOnBuild property set:

msbuild /p:UpdateXlfOnBuild=true

By default, XliffTasks will produce an error during build if it detects that the .xlf files are out of data with the source .resx/.vsct/.xaml files.

Many teams using XliffTasks default UpdateXlfOnBuild to true for local developer builds, but leave it off for CI builds. This way the .xlf files are automatically updated as the developer works, and the CI build will fail if the developer forgets to include the changes to the .xlf files as part of their PR. This way the .xlf files are always in sync with the source files, and can be handed off to a localization team at any time.

Other workflows are possible by changing the XliffTasks properties (see below)

Sorting .xlf files

XliffTasks attempts to keep .xlf files sorted when inserting new items. This doesn't matter for the generation of satellite assemblies, but can reduce merge conflicts when localizable resources are being added in multiple branches (as opposed to always adding new items at the end, which more or less guarantees merge conflicts).

Note XliffTasks does not force the items into a sorted order if they are not already sorted. You can do that manually by running msbuild /t:SortXlf.

Project Properties

EnableXlfLocalization - The "master switch" for turning locallization with XliffTasks on or off completely. When set to false, .xlf files will not be updated and satellite assemblies will not be generated from the .xlf files, regardless of the other properties. Defaults to true, but it is useful to set it to false for any project that does not need to produce localized resources (unit test projects, packaging projects, etc.).

UpdateXlfOnBuild - When set to true, .xlf files will automatically be brought in sync with the source .resx/.vsct/.xaml files. This may involve adding or removing items from the .xlf files, or creating new .xlf files. Defaults to false.

ErrorOnOutOfDateXlf - When set to true the build will produce an error if the .xlf files are out-of-date with respect to the source files. Defaults to true.

XlfLanguages - The set of locales to which the project is localized. Defaults to the thirteen locales supported by Visual Studio: cs;de;es;fr;it;ja;ko;pl;pt-BR;ru;tr;zh-Hans;zh-Hant.

Source File Properties

XlfInput - Set this to false to opt out of .xlf file generation for a specific source file that would otherwise be included by default.

Contact

For more information, contact @dotnet/dnceng on GitHub, or file an issue.




鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap