Skip to content

Display language doesn't persist in code-server v3.11.0 running in Docker container when installing from CLI #3372

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

Closed
aleleba opened this issue May 12, 2021 · 28 comments
Labels
upstream:vscode Needs to be fixed upstream in VSCode

Comments

@aleleba
Copy link

aleleba commented May 12, 2021

OS/Web Information

  • Web Browser:
  • Local OS:
  • Remote OS:
  • Remote Architecture:
  • code-server --version:
    Version 3.11.0 of Code-Server

Steps to Reproduce

  1. Add file "argv.json" to "/home/coder/.local/share/code-server/User/"
  2. Reload window
  3. Languague change
  4. Code of argv.json:
{
    "locale": "es"
}

Expected

Change Languague Display

Actual

Not Change Language Display

Logs

Screenshot

Notes

This issue can be reproduced in VS Code: Yes/No

@jsjoeio jsjoeio changed the title Languague display not working in Version 3.10.0 of Code-Server Can't change display language in code-server v3.10.0 May 12, 2021
@jsjoeio jsjoeio added the bug Something isn't working label May 12, 2021
@jsjoeio jsjoeio added this to the On Deck milestone May 12, 2021
@jsjoeio
Copy link
Contributor

jsjoeio commented May 12, 2021

I was able to successfully reproduce this on macOS + Chrome and code-server 3.10.0

image

@jsjoeio
Copy link
Contributor

jsjoeio commented May 12, 2021

However, you can change the display language if you do the following:

  1. Open Command Palette
  2. Search for "Configure Display Language"
  3. Click "Install additional Languages"
  4. Select language pack
  5. Reload

Screenshot

image

And, if you restart code-server the language pack is installed and we set the locale in argsv.json so it persists!

image

@aleleba can you please double-check that you have the language pack extension installed?

@jsjoeio jsjoeio added waiting-for-info Waiting for more information from submitter and removed bug Something isn't working labels May 12, 2021
@aleleba
Copy link
Author

aleleba commented May 13, 2021

@jsjoeio, Yes I can confirm that I install the language pack. Currently I install the Spanish Language package directly with a command in my Dockerfile.

What happens in the previous versions of code-server is that when entering for the first time it already opened the Spanish language by default.

I just tried uninstalling and installing the package again, restarted the window and changed the language.

In the same way, I would like the language to be preloaded as before, so that if the Docker container falls, it takes the language configuration at once.

I am attaching the docker docker command I use in the Dockerfile:

RUN code-server --extensions-dir ~/.local/share/code-server/extensions/ --install-extension ms-ceintl.vscode-language-pack-es

I really appreciate the follow-up and the help.

@jsjoeio
Copy link
Contributor

jsjoeio commented May 13, 2021

Ah okay, thank you for all the details. So here's a screenshot of my running that command locally (not using Docker):
image

Hmm...now this is interesting... When I look inside /Users/jp/.local/share/code-server/User, I see an argsv.json and argv.json 🤔

image

I'll keep both and restart code-server.

It's in Spanish, as expected.
image

According to VS Code's docs, argv.json is the expected filename to keep the locale.

Let's delete the argsv.json, restart code-server and see what happens. Still in Spanish so that wasn't an issue. (probably a typo from me)

image

Well, I'm a bit stumped. It feels like this is specific to how code-server is loading/running in your Docker environment. Maybe @code-asher has some insight.

@jsjoeio jsjoeio added needs-investigation This issue needs to be further investigated and removed waiting-for-info Waiting for more information from submitter labels May 13, 2021
@jsjoeio jsjoeio changed the title Can't change display language in code-server v3.10.0 Display language doesn't persist in code-server v3.10.0 running in Docker container May 13, 2021
@aleleba
Copy link
Author

aleleba commented May 13, 2021

@jsjoeio, @code-asher, I started to see the changes from version 3.9.3 to version 3.10.0, to see if I can help to find the error and I could observe this change: https://github.com/cdr/code-server/pull/3250/files

I think instead of placing:

yarn gulp compile-build compile-extensions-build

You have to place:

yarn gulp compile-build && yarn gulp compile-extensions-build

To stand in a line.

I don't use yarn and gulp, and I'm not an expert in bash, so I don't really know if that is the case.

I hope to help a little

@jsjoeio
Copy link
Contributor

jsjoeio commented May 13, 2021

Maybe @oxy might have some insight too.

@code-asher
Copy link
Member

I was able to replicate with:

$ rm ~/.local/share/code-server -r
$ code-server --install-extension ms-ceintl.vscode-language-pack-es
$ echo '{"locale":"es"}' > ~/.local/share/code-server/User/argv.json
$ code-server # Browse to localhost:8080

Strangely, I don't get the option to select es from the command palette either even though the extension is installed.

If I uninstall the extension and re-install then refresh everything works.

I think there is some language bundle generation that happens somewhere that isn't running when doing things in the CLI but is running when doing things through the UI.

@aleleba
Copy link
Author

aleleba commented May 14, 2021

I just noticed another weird behavior in code-server.

When deactivating an extension and reloading the window, this extension is not deactivated.

I think this bug may be linked to that behavior in this version.

@humbinal
Copy link

$ code-server --install-extension ms-ceintl.vscode-language-pack-es
$ ll ~/.local/share/code-server/
total 4
drwxr-xr-x 2 root root 59 May 28 22:28 CachedExtensionVSIXs
drwxr-xr-x 2 root root 66 May 28 22:27 coder-logs
drwxr-xr-x 3 root root 59 May 28 22:28 extensions
drwxr-xr-x 3 root root 29 May 28 22:27 logs
-rw-r--r-- 1 root root 36 May 28 22:27 machineid
drwxr-xr-x 2 root root  6 May 28 22:27 User

no languagepacks.json found, It's what causes it not to work !!!

when install language pack manually by UI,the languagepacks.json file auto generated at ~/.local/share/code-server/ , and language pack works.

generate languagepacks.json file when exec code-server --install-extension ... will works, but I don't know how to realize...

@ifduyue
Copy link

ifduyue commented Jun 18, 2021

Same here, languagepacks.json is missing after installing language pack in command line.

@aleleba
Copy link
Author

aleleba commented Jul 5, 2021

I would like to follow up on this error. I would like to know what I can do to help solve it, I really like code-server, but I had to stay in version 3.9.3, where these errors do not occur, how can I help to solve this problem. A pleasure to greet the entire team.

@jsjoeio
Copy link
Contributor

jsjoeio commented Jul 6, 2021

Thanks for offering to help @aleleba!

I think there is some language bundle generation that happens somewhere that isn't running when doing things in the CLI but is running when doing things through the UI.

I think this would be the first place to start. Use the latest version of code-server and see if you can confirm this theory (i.e. can this issue be reproduced when doing things via the CLI and also through the UI?)

@aleleba
Copy link
Author

aleleba commented Jul 31, 2021

I confirm this theory, when I installed the language from CLI no languagepacks.json found and when doing from IU it works

@aleleba aleleba changed the title Display language doesn't persist in code-server v3.10.0 running in Docker container Display language doesn't persist in code-server v3.11.0 running in Docker container Jul 31, 2021
@aleleba aleleba changed the title Display language doesn't persist in code-server v3.11.0 running in Docker container Display language doesn't persist in code-server v3.11.0 running in Docker container when installing from CLI Jul 31, 2021
@jsjoeio
Copy link
Contributor

jsjoeio commented Aug 2, 2021

Nice work! 🎉

Okay since this only happens with the CLI, my guess is we need to investigate there. Maybe we can write a function that checks if the extension to download is a language and if it is, add the languagepacks.json.

Let's double-check with @code-asher though first

P.S. - thanks for updating the title too!

@jsjoeio jsjoeio modified the milestones: On Deck, 3.12.0 Aug 2, 2021
@jsjoeio jsjoeio added bug Something isn't working and removed needs-investigation This issue needs to be further investigated labels Aug 2, 2021
@code-asher
Copy link
Member

code-asher commented Aug 2, 2021 via email

@jsjoeio jsjoeio removed this from the 3.12.0 milestone Aug 11, 2021
@dgadelha
Copy link

dgadelha commented Feb 3, 2022

@jsjoeio, do think you can add that to 4.0.3 milestone?

The function you mentioned already exists in VS Code API, it's LocalizationsService.postInstallExtension(), which then calls LanguagePacksCache.update(), who manipulates languagepacks.json.

For what I've seen, seems that LocalizationsService isn't registered on CLI mode when installing on extension, that'd explain why postInstallExtension isn't called.

@jsjoeio
Copy link
Contributor

jsjoeio commented Feb 3, 2022

@dgadelha unfortunately not since I'm at max bandwidth for that sprint, but I can add it as a high priority item.

PRs are also welcome. Thanks for posting those notes! That will definitely speed things up when we get to this.

@alanhe421
Copy link

which old version is ok? Or was it an existing BUG all along?

@jsjoeio
Copy link
Contributor

jsjoeio commented Oct 14, 2022

I'm not sure 🤔 @code-asher might know if it previously worked

@code-asher
Copy link
Member

I think it never worked.

@aleleba
Copy link
Author

aleleba commented Dec 14, 2022

Can we make some following up @code-asher ? , If you need any help, it should be a pleasure to help.

@jsjoeio
Copy link
Contributor

jsjoeio commented Dec 14, 2022

@aleleba can you try reproducing this with the latest version of code-server?

@aleleba
Copy link
Author

aleleba commented Dec 14, 2022

Yes@jsjoeio, I already try and the behavior is the same.

@jsjoeio
Copy link
Contributor

jsjoeio commented Dec 14, 2022

Thank you! If you want to dig in, I'd start here: #3372 (comment)

@code-asher
Copy link
Member

I tried this with desktop VS Code (--install-extension, edit argv.json, then launch) and it did not change my language so this seems to be an upstream issue.

@jsjoeio jsjoeio added upstream:vscode Needs to be fixed upstream in VSCode and removed bug Something isn't working labels Dec 19, 2022
@repo-ranger
Copy link
Contributor

repo-ranger bot commented Dec 19, 2022

This issue has been marked as 'upstream:vscode'. Please file this upstream: link to open issue
This issue will automatically close in 5 seconds.

1 similar comment
@repo-ranger
Copy link
Contributor

repo-ranger bot commented Dec 19, 2022

This issue has been marked as 'upstream:vscode'. Please file this upstream: link to open issue
This issue will automatically close in 5 seconds.

@repo-ranger repo-ranger bot closed this as completed Dec 19, 2022
@Anyexyz
Copy link

Anyexyz commented Apr 20, 2025

我确认了这个理论,当我从 CLI 安装语言时没有找到 languagepacks.json,而从 IU 安装时它可以工作

I was able to replicate with:

$ rm ~/.local/share/code-server -r
$ code-server --install-extension ms-ceintl.vscode-language-pack-es
$ echo '{"locale":"es"}' > ~/.local/share/code-server/User/argv.json
$ code-server # Browse to localhost:8080

Strangely, I don't get the option to select es from the command palette either even though the extension is installed.

If I uninstall the extension and re-install then refresh everything works.

I think there is some language bundle generation that happens somewhere that isn't running when doing things in the CLI but is running when doing things through the UI.

I was able to replicate with:

$ rm ~/.local/share/code-server -r
$ code-server --install-extension ms-ceintl.vscode-language-pack-es
$ echo '{"locale":"es"}' > ~/.local/share/code-server/User/argv.json
$ code-server # Browse to localhost:8080

Strangely, I don't get the option to select es from the command palette either even though the extension is installed.

If I uninstall the extension and re-install then refresh everything works.

I think there is some language bundle generation that happens somewhere that isn't running when doing things in the CLI but is running when doing things through the UI.

Thank you for your suggestion! Based on your idea, I wrote a Bash script to automatically generate the languagepacks.json file.
You can check it here:

With this setup, the languagepacks.json file will be automatically generated after installing a single language pack, making it easier to switch languages.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
upstream:vscode Needs to be fixed upstream in VSCode
Projects
None yet
Development

No branches or pull requests

8 participants