-
Notifications
You must be signed in to change notification settings - Fork 565
[OneLoc] Localize Microsoft.Android.Templates #7248
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Context: #6677 The `Microsoft.Android.Templates` project has been onboarded to the new template localization system. Local template builds will now use `Microsoft.TemplateEngine.Tasks` to generate `templatestrings.*.json` files used for localization. The new `update-locproject.ps1` script runs as part of the `OneLocBuild` job in CI. This script will copy each english `templatestrings.en.json` file to `templatestrings.json`, and add it as a new translation source file entry to `LocProject.json`. This update to `LocProject.json` will tell the `OneLocBuild` task to process our templates. This script borrows heavily from the [generate-locproject.ps1][0] script found in dotnet/arcade. Description from PR 6677: Template engine (dotnet new) added support for template localizations in .NET 6.0. This new system replaces the old way of localizing templates that only worked on Visual Studio and works on both .NET CLI as well as Visual Studio. This PR introduces changes to switch to the new template localization system. Summary of the changes: * Adds `<LocalizeTemplates>true</>` to project containing templates. * Include PackageReference for `Microsoft.TemplateEngine.Tasks` to project containing templates. * Generates localization files to be translated by loc team Every time there is a change to one of the templates: * The dev making the change should build the modified template project. This will update the loc files on the local working copy, * Push the loc files together with the template modifications. Review & merge. * OneLocBuild integration will automatically pick up the changes and will send them for translation. * You will receive a PR containing the translated template loc files when they are ready. Review & merge. [0]: https://github.com/dotnet/arcade/blob/e771d68edea1cfcd4a49e160093a4f32df8a6288/eng/common/generate-locproject.ps1
|
Tested this with https://devdiv.visualstudio.com/DevDiv/_build/results?buildId=6540194&view=logs&j=b0d940c4-07db-5357-83ba-1a4207a17644&t=f6fbc6c3-6cd9-5e85-c68a-d9367c5fa9a7&l=170. The updated LocProject and OneLocBuild task output look good as far as I can tell, we'll now need to wait for translations for these: |
| @@ -0,0 +1,28 @@ | |||
| param ($SourcesDirectory, $LocProjectPath) | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- Should this use a shebang and be
+xon Unix? - If we do use a shebang, then this file needs to be Unix formatted.
- If this file needs to be Unix formatted, then we should update
.gitattributesaccordingly.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would lean towards no as I don't anticipate us needing to invoke this script much (if ever) outside of CI, and running the script with a pwsh prefix in those cases doesn't feel like too much overhead. I will make these changes if you would prefer though?
Context: https://github.com/dotnet/templating/blob/6ecea73aad1ce3444dbf28fc340e5f464f6278df/docs/Localization.md
The `dotnet new` template engine supports localization as of .NET 6.
Update the `Microsoft.Android.Templates` project to use the new
localization system. Local template builds now use
`Microsoft.TemplateEngine.Tasks` teo generate the
`templatestrings.*.json` files used for localization.
The new `update-locproject.ps1` script runs as part of the
`OneLocBuild` job in CI (fa9629db). This script will copy each
english `templatestrings.en.json` file to `templatestrings.json`, and
add it as a new translation source file entry to `LocProject.json`.
This update to `LocProject.json` will tell the `OneLocBuild` task to
process our templates.
This script borrows heavily from the [generate-locproject.ps1][0]
script found in dotnet/arcade.
Every time there is a change to one of the templates:
1. The dev making the change should build the modified template
project. This will update the loc files on the local working copy,
dotnet build src/Microsoft.Android.Templates/Microsoft.Android.Templates.csproj
# -or-
dotnet build Xamarin.Android.sln
2. Push the loc files together with the template modifications.
Review & merge.
3. OneLocBuild integration will automatically pick up the changes
and will send them for translation.
4. You will receive a PR containing the translated template loc
files when they are ready. Review & merge.
[0]: https://github.com/dotnet/arcade/blob/e771d68edea1cfcd4a49e160093a4f32df8a6288/eng/common/generate-locproject.ps1 |
Context: #6677
The
Microsoft.Android.Templatesproject has been onboarded to the newtemplate localization system. Local template builds will now use
Microsoft.TemplateEngine.Tasksto generatetemplatestrings.*.jsonfiles used for localization.
The new
update-locproject.ps1script runs as part of theOneLocBuildjob in CI. This script will copy each english
templatestrings.en.jsonfile to
templatestrings.json, and add it as a new translation sourcefile entry to
LocProject.json. This update toLocProject.jsonwilltell the
OneLocBuildtask to process our templates.This script borrows heavily from the generate-locproject.ps1 script
found in dotnet/arcade.
Description from PR 6677:
Template engine (dotnet new) added support for template localizations in
.NET 6.0. This new system replaces the old way of localizing templates
that only worked on Visual Studio and works on both .NET CLI as well as
Visual Studio.
This PR introduces changes to switch to the new template localization system.
Summary of the changes:
<LocalizeTemplates>true</>to project containing templates.Microsoft.TemplateEngine.Tasksto project containing templates.Every time there is a change to one of the templates: