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

Locale inconsistency on macOS #90

Closed
jhenahan opened this issue Jun 23, 2017 · 4 comments
Closed

Locale inconsistency on macOS #90

jhenahan opened this issue Jun 23, 2017 · 4 comments

Comments

@jhenahan
Copy link

jhenahan commented Jun 23, 2017

OS: macOS 10.12.6 Beta (16G16b)

In iTerm 2 and Terminal.app, locale reports

LANG="en_US.UTF-8"
LC_COLLATE="en_US.UTF-8"
LC_CTYPE="en_US.UTF-8"
LC_MESSAGES="en_US.UTF-8"
LC_MONETARY="en_US.UTF-8"
LC_NUMERIC="en_US.UTF-8"
LC_TIME="en_US.UTF-8"
LC_ALL=

In Kitty, locale reports

LANG=
LC_COLLATE="C"
LC_CTYPE="en_US.UTF-8"
LC_MESSAGES="C"
LC_MONETARY="C"
LC_NUMERIC="C"
LC_TIME="C"
LC_ALL=

I don't have the variables set explicitly in my shell config, so that may be normal. The weird part is that kitty seems to silently default the locale to ru_RU, leading to (for instance) git status reporting

Kitty:

На ветке master
Ваша ветка обновлена в соответствии с «origin/master».
нечего коммитить, нет изменений в рабочем каталоге

iTerm and Terminal.app:

On branch master
Your branch is up-to-date with 'origin/master'.
nothing to commit, working tree clean

English is set to my primary system language in OS X preferences, though I do also have Russian as a secondary language. Removing the secondary language or explicitly setting the LC_MESSAGES variable to anything other than the empty string resolves the issue, but it does seem a bit mysterious.

@jhenahan jhenahan changed the title Locale inconsistency Locale inconsistency on macOS Jun 23, 2017
@kovidgoyal
Copy link
Owner

Hmm, I'm not really familiar with how locale() works on macOS. The only locale related thing kitty does is call locale.setlocale(locale.LC_ALL, '') in main.py at startup. I'm not sure what, if anything, it could be doing differently.

@kovidgoyal
Copy link
Owner

kovidgoyal commented Jun 24, 2017

So if you dont have the locale env vars set in your environment, I assume the other terminals are setting it explicitly. For example in iTerm2: https://github.com/gnachman/iTerm2/blob/faf3b633cee9d8749ca2f02a5b3226af4f93411f/sources/PTYSession.m#L1656

It seems wrong to me that a terminal emulator should set locale environment variables, that should be the job of the OS

@jhenahan
Copy link
Author

Yeah, that seems sensible, it just seems odd that the unset variables are defaulting to a secondary language rather than the primary language. It seems to suggest that macOS is setting LANG according to the secondary language, but then Terminal.app has the primary language, which seems bizarre.

@kovidgoyal
Copy link
Owner

Maybe the solution is, on macOS, to check if the LANG env var is set and if not set it based on the OS language preferences.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants