tldr-pages / tldr-python-client

:snake: Python command-line client for tldr pages 📚
https://pypi.org/project/tldr/
MIT License
599 stars 95 forks source link

"Documentation is not available." for all commands #121

Closed carlosneves0 closed 4 years ago

carlosneves0 commented 4 years ago

I installed this CLI using pacman, and recently it's not finding any documentation for any command.

$ tldr ls
`ls` documentation is not available. Consider contributing Pull Request to https://github.com/tldr-pages/tldr
 $ tldr tar
`tar` documentation is not available. Consider contributing Pull Request to https://github.com/tldr-pages/tldr

How can we fix this?

zlatanvasovic commented 4 years ago

Does https://github.com/tldr-pages/tldr-python-client/issues/119 help? It's an issue with language set, most likely.

carlosneves0 commented 4 years ago

That was it! I'm gonna try making an alias env LANG=en_US.UTF-8 tldr. Thank you.

MasterOdin commented 4 years ago

You can also do export TLDR_LANGUAGE=en to achieve the same result.

Porrumentzio commented 4 years ago

This helped! I was having this issue for months and I didn't manage to solve it. Does export TLDR_LANGUAGE=en solve this problem at a level of session, user or system?

Additionally, it would be great if it's possible to solve this problem, accepting all locales from the code itself!

homocomputeris commented 4 years ago

Shouldn't there be a fallback if LANG is not set? Somehow it worked.

carlosneves0 commented 4 years ago

Perhaps the error message could be improved?

No pages were found for ls in your current language "$LANG"
1 page was found in english. Run `tldr --language en ls` to see it
MasterOdin commented 4 years ago

Improvements to the language handling are a definite thing I'd like to do, but are on hold to think about until tldr-pages/tldr#4101 is merged. It alone brings in that we will always fallback to english as a language to try, which nicely fixes this whole thing.

Porrumentzio commented 4 years ago

I don't know if I understand well all what you said, but what I would do would be:

  1. Improve the error message, as said in https://github.com/tldr-pages/tldr-python-client/issues/121#issuecomment-652557294, until there's another solution.
  2. As said in https://github.com/tldr-pages/tldr-python-client/issues/121#issuecomment-652596346, improve all this issue about languages. For that I would, as it is done with almost all localizations, fallback to english only if there's no pages for the users language. For that, with a pythonish example, I would create some kind of this structure:
    if $LANG not in langs_on_tldr_list:
    fallback_to_english_function()

Maybe it could be great to be able to choose which language to use.