dotnet / winforms

Windows Forms is a .NET UI framework for building Windows desktop applications.
MIT License
4.44k stars 988 forks source link

[Loc]With net6 preview 7 installed on locale OS, some template names are unlocalized after runing "dotnet new --list" in CLI . #5249

Closed vdanche closed 3 years ago

vdanche commented 3 years ago
  1. Install net 6 preview 7 SDK[6.0.100-preview.7.21364.30(runtime:6.0.0-preview.7.21360.10)] from https://github.com/dotnet/installer
  2. Install it on locale OS
  3. Run “dotnet new --list” in CLI
  4. Check if output contents are localized well. Actual Result: Some template names are not localized.

e.g SC: image

DE: image

Note: It has been localized well in VS 17.0 preview 3 e,g SC: image

dreddy-work commented 3 years ago

@KlausLoeffelmann , any idea where and how these localized?

RussKie commented 3 years ago

I personally don't think it is correct to loc "Windows Forms", as it is the name of the tech stack.

@crsuzukimsft assigning to you as you own the locs.

KlausLoeffelmann commented 3 years ago

I agree partly, however I can only speak for German. It should be: "Windows Forms App" (No translation here, please! "App" is common German. We want people to understand, so we need to accommodate (to) the tech lingo that is actually spoken in the various communities and tech departments of the German IT companies and households in the (German speaking) world. And sometimes we need to go against a minor group of language theorists who may argue from a language scientific perspective, why it should be for example "Produktrückstandselement" and not "Backlog Item" - the latter being definitely not German; the first one, though, NOONE in Germany really understands! We MUST put understanding, accessibility, discoverability, approachability before technical-theoretical language correctness - which in the end is often discussable, questionable and often enough subject to change by the Duden anyway. See "gedownloadet" and "heruntergeladen" for reference - the first being a Duden-enabled German-English lean word...)

It should be though:

"Windows Forms Klassenbibliothek" "Windows Forms Steuerelementebibliothek"

We recently changed the templates, but never their description or LOC. So, no, I have not really an idea what is going on.

KlausLoeffelmann commented 3 years ago

@Olina-Zhang:

In Addition what I wrote: What concerns me more is the effect on GB18030 for the Chinese Certification. Are tests effected by this, Olina? That's, @crsuzukimsft, why we should address this on really short notice!

Olina-Zhang commented 3 years ago

@KlausLoeffelmann I don't think this will have any impact on the test, this issue is just for display in SDK by CLI. And it also no affect in Visual Studio. Cannot be checked or tested on Chinese GB18030.

cristianosuzuki77 commented 3 years ago

Where is the source of these strings? https://github.com/dotnet/winforms/tree/main/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/ ?

KlausLoeffelmann commented 3 years ago

Not sure what you mean exactly. The localize strings are here: https://github.com/dotnet/winforms/tree/main/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsApplication-CSharp/.template.config

(As an example for the C# WinForms App template.)

cristianosuzuki77 commented 3 years ago

The .json files from there for zh-Hans and de have the translations.

KlausLoeffelmann commented 3 years ago

That's what I thought. The question now is, why aren't they surfacing in the product? @merriemcgaw, @Pilchie: Just FYI, this could become too time-critical if we put it off for too long and I want to avoid doing this again at the last minute, so I plan to spend a bit time on the side investigating this on a German VM.

Also: @phenning - any idea, what might go wrong here? @KathleenDollard FYI for the VB templates.

phenning commented 3 years ago

@vlada-shubina and @DavidKarlas would be able to better explain how "dotnet new" localization the templates in the CLI. This is a relatively new feature- if you notice the only localized templates are those that are coming from the dotnet/templating repo which is also owned by the template engine. I believe there is some work that needs to be done in order to use the new localization mechanism for .NET 6 templates.

The existing strings.json mechanism was for Visual Studio only, and we will be also implementing the new mechanism from the NET 6 template engine, hopefully in time for 17.0 GA. One thing I'd like to point out is that there seem to be both folders with two letter locales (de) as well as the de-DE format. Visual Studio will first try to use de-DE if it exists, then will fallback to using de. It looks like the most recent checkins your repo was to the two character locale, which would not be the first one that VS will use. I'd suggest removing the xx-XX versions folders from the templates after verifying that it is the correct content.

bekir-ozturk commented 3 years ago

Thanks for clarifying Phil. I would like to add a few things.

Localization of template metadata was not supported by template engine until .NET 6.0. Visual Studio had a workaround for this missing feature via strings.json files.

With .NET 6.0, we have added support for this into template engine. This means that there is now a single mechanism to localize template metadata in both dotnet CLI and Visual Studio (not yet integrated as Phil also mentioned).

This new mechanism has a new format for localization files. As an example, please see the templates in template engine repo: https://github.com/dotnet/templating/tree/main/template_feed/Microsoft.DotNet.Common.ProjectTemplates.6.0/content/ClassLibrary-CSharp/.template.config/localize

The "localize" folder you can see in the example above as well as the templatestrings.xx.json files for each supported language can be automatically created by our "Template Localizer" tool.

dotnet tool install --global Microsoft.TemplateEngine.TemplateLocalizer --version 6.0.100-preview.7.21378.11
dotnet template-localizer export "C:/root/of/your/templates" -r

If you run this tool on your templates and commit/push the changes, arcade will automatically send them for translation and the translated versions will appear in your repo as a PR. If you need further clarification on this, feel free to ping me.

We did these steps to localize the templates we own, but our availability didn't allow for promoting this to other teams during .NET 6.0 timeframe. We plan to automate the procedure for all the arcade based repos for .NET 7.0.

RussKie commented 3 years ago

So am I correct in understanding that we should delete all currently localised content, and then run the tool to generate a new content that will flow via the OneLocBuild task to the Loc team?

bekir-ozturk commented 3 years ago

You shouldn't delete the current content. That would break Visual Studio locs since it hasn't yet switched to the new way. For the time being, localized content for both mechanisms should exist together. You are correct about the rest though.

phenning commented 3 years ago

@RussKie You should probably still delete the "xx-XX" versions of the current localized content though, since it looks like the "xx" versions are the latest. As explained above, VIsual Studio would try to use the xx-XX versions first if they are present.

image

phenning commented 3 years ago

I'd verify first though that the automated check-in has the correct translations for each language.

KlausLoeffelmann commented 3 years ago

@bekir-ozturk, @phenning: Thanks for clarifying!

RussKie commented 3 years ago

@bekir-ozturk I'm getting errors while running the script. I tried a few different ways, but each time the error is the same:

PS C:\Development\winforms> dotnet template-localizer export .\pkg\Microsoft.Dotnet.WinForms.ProjectTemplates\content -r
PS C:\Development\winforms> Get-ChildItem .\pkg\Microsoft.Dotnet.WinForms.ProjectTemplates\content  | foreach { dotnet template-localizer export "$($_.FullName)\.template.config" -r }

image

What am I missing?

DavidKarlas commented 3 years ago

Short version: You need to add "id" attribute to post actions, see example in bellow screenshot: image

Long version: Since postactions are defined as array, if we decided to match localisation by indexes in array user could re-order them or delete 1 or add 1 at beginning of array and all localisations would be wrong, hence we require "id" attribute to be added so we avoid indexes problems.

RussKie commented 3 years ago

@DavidKarlas thank you, that did the trick

Ashley-Li commented 3 years ago

@RussKie @KlausLoeffelmann Verified this issue with .Net 6.0.100-rc.1.21417.19 from Release/6.0.1XX+ \trinlab2\BAQAFiles\Winforms\v-zheshi\Core\PrivateDll\8.19\Main_branch + \trinlab2\BAQAFiles\Winforms\v-zheshi\Core\PrivateDll\8.19\zh-Hans, it is still repro on OS(CHS) , winforms template names are unlocalized after runing "dotnet new --list" in CLI, please see below results.Whether this is expected? image

RussKie commented 3 years ago

@Ashley-Li my PR has enabled the translations infra for the templates. I don't believe any translations have been done and/or merged. @dreddy-work and @cristianosuzuki77 can provide more information on where we're at with those.

Ashley-Li commented 3 years ago

@RussKie We built binaries from main branch under dotnet/winforms repo, it is empty under ..\source\repos\winforms\artifacts\bin\Microsoft.Dotnet.Winforms.ProjectTemplates, no dll generated. So we cannot verify this accurately. Do you have any ideas?

merriemcgaw commented 3 years ago

I think you will just need to wait a while until the localization has completed. @dreddy-work /@russkie do you know when that might be?

RussKie commented 3 years ago

@Ashley-Li tl;dr - the templates don't have any binaries. The test procedures are described in https://github.com/dotnet/winforms/tree/main/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates.

Microsoft.Dotnet.WinForms.ProjectTemplates and Microsoft.Private.Winforms are what we call "transport packages", and those are NuGet packages that are referenced by other repos (such as the SDK). The transport packages are created during the packaging stage, i.e. .\build.cmd -pack.

RussKie commented 3 years ago

I don't think you need to spend any time on testing because we still haven't got any translations, e.g. https://github.com/dotnet/winforms/blob/main/pkg/Microsoft.Dotnet.WinForms.ProjectTemplates/content/WinFormsApplication-CSharp/.template.config/localize/templatestrings.de.json

@cristianosuzuki77 will know when translations are available, and @dreddy-work will know when those are merged.

dreddy-work commented 3 years ago

That is correct. We supposed to get translated PRs after @cristianosuzuki77 re-enabled for this repo. Wait on validations until @cristianosuzuki77 or me update you on this.

dreddy-work commented 3 years ago

Had a follow-up conversation with @cristianosuzuki77 this morning. It seems they are seeing some timeout failures in their pipeline across the repos that prevented the expect PR into our repo from last Friday. He will be manually triggering this and monitor the progress. We may need to wait until we get that notification. Once everything goes smooth, we might want to do something explicit to get those updates for release branch.

Marie-Shi commented 3 years ago

@RussKie @dreddy-work Verified the issue with 6.0.100-rc.1.21424.1 build from .Net 6 RC1 TP, it still repro, winforms template names are unlocalized after runing "dotnet new --list" in CLI. But the pull_5429 Milestone is 6.0 rc1, whether the fix is inserted into 6.0 rc1? If not, do we need to change this issue's Milestone to rc2?

dreddy-work commented 3 years ago

@Marie-Shi , actual localization commit is in this PR. It went into main /7.0. It will go into RC2 but towards end of the release. Please keep an eye on RC2 release timeline and validate this change then.

Marie-Shi commented 3 years ago

@dreddy-work Thanks for your confirmation! We will keep an eye on RC2 release and validate it again.

Marie-Shi commented 3 years ago

Verified this issue with .Net 6.0.100-rc.2.21473.26 from 6.0 RC2 Test Pass, it is fixed. Now Winforms template names are localized after runing "dotnet new --list" in CLI. ewe