arcade icon indicating copy to clipboard operation
arcade copied to clipboard

Feature request: Add support for translating VS Extensibility resources

Open tmat opened this issue 6 months ago • 4 comments

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.

tmat avatar Dec 08 '23 23:12 tmat

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

ViktorHofer avatar Dec 09 '23 09:12 ViktorHofer

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

Yes, internal teams. Like anything in Arcade?

tmat avatar Dec 13 '23 17:12 tmat

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

Cosifne avatar Jan 05 '24 21:01 Cosifne

@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.

tmat avatar Jan 18 '24 19:01 tmat

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

Cosifne avatar Apr 08 '24 19:04 Cosifne