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

improve handling of different languages #112

Merged
merged 1 commit into from
May 16, 2020
Merged

Conversation

MasterOdin
Copy link
Collaborator

The current implementation of languages is a bit simplistic and makes it hard for foreign users to actually use tldr. To start, if LANG was set, it's probable that the user would not want to set this just for the sake of tldr. Additionally, there was no support for LANGUAGES which goes against the spec.

Anyway, this improves things (imo) to be a bit nicer on the user.

Some examples and full resolution pattern (ignoring platform):

TLDR_LANGUAGE=ja python3 tldr.py cd
# checks ja

TLDR_LANGUAGE=fr LANG=es python3 tldr.py cd
# checks fr

LANGUAGES=fr:en TLDR_LANGUAGE=ja LANG=es python3 tldr.py cd
# checks ja, then fr, then en

LANGUAGES=fr:en LANG=C python3 tldr.py cd
# ignores C, checks fr, then en

The change to how the page itself was rendered was that setting your LANG=en would cause my system to attempt the page in ascii regardless of the resolved language, which would throw an error if printing out non-en pages.

Signed-off-by: Matthew Peveler <matt.peveler@gmail.com>
@zlatanvasovic
Copy link
Contributor

Perfect!

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

Successfully merging this pull request may close these issues.

2 participants