vscode icon indicating copy to clipboard operation
vscode copied to clipboard

fix: missing translations of remote built-in extensions

Open hyrious opened this issue 7 months ago • 1 comments

@BlackHole1 noticed that some translations are missing when develop in remote mode. After digging a bit, we found that only built-in extensions' NLS messages are missing. For example, the Source Control view (contributed by the built-in 'Git' extension) and built-in extensions' configurations are in English.

Despite that the remote server will download and install the corresponding language pack extension, it does not pick the language pack up because of 2 problems:

  1. There's no nls.keys.json in the server build, causing clp/{hash}.{lang}/* failed to generate.
  2. When scanning built-in extensions, the UI language was not passed correctly to the backend.

This PR fixes the 2 problems.

Note about problem 1: The original code Promise.all([mkdir, read keys, read messages]) will fail when the keys file is missing, but the mkdir task would succeed and leave an empty folder which prevents it regenerate in the next calling. So I changed the testing logic from the folder to the file in it.

hyrious avatar May 21 '25 08:05 hyrious

@microsoft-github-policy-service agree

hyrious avatar May 21 '25 08:05 hyrious

Can you please share more information here - what is the bug? Are there steps to reproduce? Any screenshots would be helpful. Before that please file an issue first with all this information. Thanks

sandy081 avatar Jun 03 '25 15:06 sandy081

@sandy081 Hi thanks for showing up. I have created an issue linked to this PR: https://github.com/microsoft/vscode/issues/250579

hyrious avatar Jun 04 '25 03:06 hyrious

@hyrious how did you test this change, because I just tested it (by building a local build of VS Code) and it sadly does not work (I'm using a pseudolanguage pack since I know only English)

image

TylerLeonhardt avatar Jun 11 '25 19:06 TylerLeonhardt

@sandy081 your guidance would be nice here. The steps are easy to reproduce:

  • Install a language pack
  • Do any Remote connection (like Dev Containers)
  • Check the source control view for localization

These strings are localized in the manifest so I'm not sure why, when there's a remote, the manifest strings would stick to English.

TylerLeonhardt avatar Jun 11 '25 20:06 TylerLeonhardt

@TylerLeonhardt A little tricky to test because the remote host should also be built by yourself. If you're using the official reh build in the remote host it wouldn't work.

I actually tested it by manually port changes to the code-server. You may have a try:

  1. Find the code server's source code in the remote OS, it should be inside ~/.vscode-server.
  2. Copy the nls.keys.json from your local vscode to the same folder as nls.messages.json in the remote OS.
  3. Delete the clp folder from the remote OS if it was generated before.
  4. Port changes to the server's source code. If you're just lazy, you can hard code a language option in the scan extensions method (see this pr's diff).
  5. Reconnect to it, this means a full restart of the code-server process. The client should have been modified to send correct IPC messages. Note that in this step, you have to make sure the local commit does not change otherwise the server may refuse to connect.

hyrious avatar Jun 11 '25 23:06 hyrious

Delete the clp folder from the remote OS if it was generated before.

clp location: ~/.vscode-server-insiders/data/clp

BlackHole1 avatar Jun 12 '25 02:06 BlackHole1

I built an Insiders build off of this branch and can confirm that this fixes the problem :)

TylerLeonhardt avatar Jun 12 '25 19:06 TylerLeonhardt

@sandy081 I defer to you for final approval

TylerLeonhardt avatar Jun 14 '25 00:06 TylerLeonhardt

@TylerLeonhardt Approved from my side. Should we merge?

sandy081 avatar Jun 27 '25 12:06 sandy081

@hyrious this fix is going to make a lot of devs happy. Thank you for contributing!

TylerLeonhardt avatar Jun 27 '25 13:06 TylerLeonhardt