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 language from LC_MESSAGES, not LC_CTYPE #383

Merged

Conversation

creideiki
Copy link
Contributor

Calling locale.getlocale() checks LC_CTYPE, which is not meant for UI strings. Change the call to check LC_MESSAGES instead.

Also call locale.setlocale() first to import the locale settings from the environment. This is not needed for LC_CTYPE due to https://bugs.python.org/issue6203 but is required for LC_MESSAGES.

This Works For Me™, but I have only tested it on Gentoo Linux with the following locale settings:

LANG=
LC_CTYPE=sv_SE.utf8
LC_NUMERIC=sv_SE.utf8
LC_TIME=sv_SE.utf8
LC_COLLATE=POSIX
LC_MONETARY=sv_SE.utf8
LC_MESSAGES=POSIX
LC_PAPER=sv_SE.utf8
LC_NAME=sv_SE.utf8
LC_ADDRESS=sv_SE.utf8
LC_TELEPHONE=sv_SE.utf8
LC_MEASUREMENT=sv_SE.utf8
LC_IDENTIFICATION=sv_SE.utf8
LC_ALL=

Closes #361

@rogers0
Copy link
Contributor

rogers0 commented Aug 24, 2019

Actually it's just also debian bug:

The fix is just to revert b828bdf
I already did this in my debian package since 0.3.1-2

It's also related to #323 and #351

@rogers0
Copy link
Contributor

rogers0 commented Apr 25, 2020

Sorry, my previous comment was not correct.
I confirm this pull request is valid.

@rogers0
Copy link
Contributor

rogers0 commented Apr 27, 2020

I uploaded 0.3.2-10 to debian, which included this patch.

If you use debian, you can install it from backports.

Calling `locale.getlocale()` checks LC_CTYPE, which is not meant for
UI strings. Change the call to check LC_MESSAGES instead.

Also call `locale.setlocale()` first to import the locale settings
from the environment. This is not needed for LC_CTYPE due to
https://bugs.python.org/issue6203 but is required for LC_MESSAGES.

Closes torproject#361
@creideiki creideiki force-pushed the set-language-from-LC_MESSAGES branch from cd8edcd to 5206d46 Compare October 12, 2020 16:18
@creideiki
Copy link
Contributor Author

Rebased the patch onto release 0.3.3.

@micahflee micahflee merged commit 103573d into torproject:master Jun 18, 2021
@AsciiWolf
Copy link
Collaborator

AsciiWolf commented Jun 19, 2021

Thanks! This will hopefully fix flathub/org.torproject.torbrowser-launcher#2.

edit: It partially fixed it - Tor Browser is correctly translated now, however the Tor Browser Launcher itself is still in English.

@creideiki creideiki deleted the set-language-from-LC_MESSAGES branch June 27, 2021 20:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
4 participants