Skip to content
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

Set locale variables automatically for the integrated terminal #7301

Closed
ibratoev opened this issue Jun 7, 2016 · 9 comments
Closed

Set locale variables automatically for the integrated terminal #7301

ibratoev opened this issue Jun 7, 2016 · 9 comments
Assignees
Labels
bug Issue identified by VS Code Team member as probable bug *duplicate Issue identified as a duplicate of another issue(s) macos Issues with VS Code on MAC/OS X terminal Integrated terminal issues

Comments

@ibratoev
Copy link

ibratoev commented Jun 7, 2016

  • VSCode Version: 1.2.0
  • OS Version: OSX 10.11.5

Steps to Reproduce:

  1. I use ZSH for shell.
  2. Open Integrated Terminal and run locale.
  3. Locale is not set properly. Here is my result:
LANG=
LC_COLLATE="C"
LC_CTYPE="C"
LC_MESSAGES="C"
LC_MONETARY="C"
LC_NUMERIC="C"
LC_TIME="C"
LC_ALL=

Expected:

An optional similar to the default Terminal app in OSX. It makes sense to have it ON by default.
Option from Terminal settings:
screen shot 2016-06-07 at 10 11 48 am

Workaround:

Add the following to your profile (~/.zhrc for ZSH):

export LC_ALL=en_US.UTF-8
export LANG=en_US.UTF-8
@Tyriar
Copy link
Member

Tyriar commented Jun 7, 2016

This might be OS X-specific, seems fine in Linux (vscode/bash left, gnome-terminal/bash right)

image

@Tyriar Tyriar added bug Issue identified by VS Code Team member as probable bug macos Issues with VS Code on MAC/OS X terminal Integrated terminal issues labels Jun 7, 2016
@Tyriar Tyriar added the help wanted Issues identified as good community contribution opportunities label Jul 5, 2016
@Tyriar
Copy link
Member

Tyriar commented Jul 5, 2016

If anyone has insight on how locale works on Mac it would be appreciated, PRs welcome.

chrmarti added a commit to chrmarti/vscode that referenced this issue Jul 8, 2016
chrmarti added a commit to chrmarti/vscode that referenced this issue Jul 9, 2016
chrmarti added a commit to chrmarti/vscode that referenced this issue Jul 11, 2016
chrmarti added a commit to chrmarti/vscode that referenced this issue Jul 11, 2016
@satokaz
Copy link
Contributor

satokaz commented Jul 12, 2016

VSCode Version: 1.4.0 Insiders (commit 217e0b5
OS Version: OS X 10.11.5(15F34)

Shell: /bin/bash,
LANG variable is not explicitly set. It is automatically set by the system.
following is a result of running the locale command on the OS X Terminal (not vscode terminal).

Kazuyuki-no-MacBook-Pro:~ satokaz$ locale
LANG="ja_JP.UTF-8"
LC_COLLATE="ja_JP.UTF-8"
LC_CTYPE="ja_JP.UTF-8"
LC_MESSAGES="ja_JP.UTF-8"
LC_MONETARY="ja_JP.UTF-8"
LC_NUMERIC="ja_JP.UTF-8"
LC_TIME="ja_JP.UTF-8"
LC_ALL=

Please tell me the behavior of expected "terminal.integrated.setLocaleVariables" setting.

In the Japanese locale, it will be set as follows.
"terminal.integrated.setLocaleVariables":true (default) :

bash-3.2$ locale
LANG="ja.UTF-8"
LC_COLLATE="C"
LC_CTYPE="C"
LC_MESSAGES="C"
LC_MONETARY="C"
LC_NUMERIC="C"
LC_TIME="C"
LC_ALL=

"Ja.UTF-8" is not correct.
"Ja_JP.UTF-8" is correct.

"terminal.integrated.setLocaleVariables": true

2016-07-13 6 18 28

"terminal.integrated.setLocaleVariables": false

This is the value you expected Looks.

2016-07-13 6 19 44

It looks like when the "terminal.integrated.setLocaleVariables":false is set to the correct value has been set.

@Tyriar Tyriar reopened this Jul 12, 2016
@Tyriar
Copy link
Member

Tyriar commented Jul 12, 2016

Ping @chrmarti, sometimes vscode's locale is only the language, not dialect eg. "ja". This is likely why it's set to ja, not ja_JP. As for why it's working on this version of OS X, I have no idea?

@chrmarti
Copy link
Contributor

We use electron's app.getLocale() to read the locale, which limits it's values to those electron has translations for, that includes 'ja', but not 'ja_JP': http://electron.atom.io/docs/api/app-locales/

We could use some other means to get at the full locale identifier (like https://www.npmjs.com/package/os-locale).

@chrmarti
Copy link
Contributor

chrmarti commented Jul 13, 2016

@dbaeumer, would it make sense to make platform.locale be the full OS's locale rather than just what electron supports? Having that will make sense for other (than shells) external processes that support more locales than electron too. (The change would be in main.js I think.)

@satokaz
Copy link
Contributor

satokaz commented Jul 13, 2016

Thank you for the details.

It is considered to be difficult to derive the OS loclae from Electron's app.getLocale().
short locale is also not supported.
In addition, can not care of the LC_* environment variables.

It is desirable to be automatic in the locale setting, but this implementation is thought that only lead to confusion.

Currently, That prompt the user to set the export LANG="" environment variable to the configuration file of the shell (.zprofile, .zshrc, .bash_profile, .bashrc ...) to use, I think it is good to describe to the FAQ.

Microsoft/vscode project is great.

Thanks,
Kazuyuki

@Tyriar
Copy link
Member

Tyriar commented Feb 27, 2017

This should be fixed in 1.10

@Tyriar Tyriar closed this as completed Feb 27, 2017
@Tyriar Tyriar added *duplicate Issue identified as a duplicate of another issue(s) and removed help wanted Issues identified as good community contribution opportunities labels Feb 27, 2017
@dbaeumer
Copy link
Member

@chrmarti I decided against this since the npm modules I looked at when implementing this all spawn processes and this is on the critical start up path and we can't load any code without knowing which locale to use. IMO if someone really needs the real OS locale then they can use a corresponding npm module.

@vscodebot vscodebot bot locked and limited conversation to collaborators Nov 18, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Issue identified by VS Code Team member as probable bug *duplicate Issue identified as a duplicate of another issue(s) macos Issues with VS Code on MAC/OS X terminal Integrated terminal issues
Projects
None yet
Development

No branches or pull requests

5 participants