dotnet / arcade

Tools that provide common build infrastructure for multiple .NET Foundation projects.
MIT License
663 stars 340 forks source link

Feature request: Add support for translating VS Extensibility resources #14275

Closed tmat closed 5 months ago

tmat commented 9 months ago

VS Extensibility stores string resources in .vsextension\string-resources.json. See https://learn.microsoft.com/en-us/visualstudio/extensibility/visualstudio.extensibility/command/localize-metadata?view=vs-2022. The strings in this file need to be translated. The ask is to add support for the translation to Microsoft.DotNet.XliffTasks.

ViktorHofer commented 9 months ago

XliffTasks isn't publicly shipping. Who would benefit from such a feature? Is it just internal teams?

tmat commented 9 months ago

XliffTasks isn't publicly shipping. Who would benefit from such a feature? Is it just internal teams?

Yes, internal teams. Like anything in Arcade?

Cosifne commented 8 months ago

Trying to investigate the plan here. The goal here would be, we should be able to localize strings under .vsextension//string-resources.json

It's similar to the VSCode l10n model. In vscode, it is done in this way.

  1. vscode l10n would generate bundle.l10.json. This is done by scanning the whole extension code. The scanning process is not interesting here.
  2. From bundle.l10.json, it would be converted to xlf file by using the generate-xlf in l10n.
  3. These xlf file could later be translated by the LOC team.
  4. Translated xlf file, can be converted back to json file by using import-xlf.

Note VS code only provide l10n and l10-dev packages function via npm, so developer needs to set up the pipeline themself to work with the LOC side.

So in short, vscode path is x.json -> x.xlf -> Translated by LOC team -> x.xlf (translated) -> x.json

In VS, it seems like we need to support LOC from both the json file and the legacy xlf file. For each extension, it seems like xliff-tasks should support

  1. Convert the string-resources.json to string-resources.xlf.
  2. Expand string-resources.xlf to all the supported language version.
  3. Convert <lang>/string-resources.xlf back to <lang>/string-resources.json

(I guess there should be only one string-ressources.xlf per extension) Arcade might add other support to feed the results of Step 2 to LOC side so they can generated the real LOC content. It might not needed in xliff-tasks

I am unfamiliar with arcade repo and xliff-tasks. Is this a good plan? Do I need to get someone's review before start working on this? Tag @tmat and @ViktorHofer

tmat commented 8 months ago

@Cosifne Yes, that's how it would work. xliff-tasks already implements everything. It just needs to understand the additional string-resources.json items. Seems like adding it is straightforward. I'll give it a shot since it's blocking me now.

Cosifne commented 5 months ago

I think it's done now in the linked PR.