-
-
Notifications
You must be signed in to change notification settings - Fork 109
Add support for other languages #83
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
Conversation
|
ping @waldyrious ! Can you review this, please? Thanks! |
|
This PR is very interesting. When I have a bit of time I could review it, but I can't promise it, @lucasoshiro. |
|
@ivanhercaz ok, thanks! |
|
@lucasoshiro I wasn't active much when you proposed this, so it seems I missed this PR. This has some merge conflicts with the recently merged PRs that changed the way page requests operate. Are you still interested in working on this, to check if those recent changes work along with your proposed change? Thank you for the valuable contribution nevertheless. |
Add --language option, for getting page in another language. If the page in the specified language is not available, download it in the default language. Signed-off-by: Lucas Oshiro <[email protected]>
Detect the current system language, and use it as the default language for downloading pages. Signed-off-by: Lucas Oshiro <[email protected]>
|
@zdroid I rebased this PR with master and solved the conflitcts, I think it's ok now. Thanks for the review! |
|
What do you think about adding another |
|
The client specification already includes words on how to support language environment variables: https://github.com/tldr-pages/tldr/blob/master/CLIENT-SPECIFICATION.md#language. |
MasterOdin
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The load_page_from_cache and store_page_to_cache methods should be made language aware or else you'll have issues opening pages that exist in multiple languages when specifying the non-default language. For example, assume we have cd in fr and en and I default to fr. First usage will grab the fr page and store it to the cache as cd_common.md. Next time, I do --language en and it will display the cached fr page.
|
@MasterOdin I decided to merge #101 first because else we'd be making too many redundant changes. But we can move on to complete this one now. I've resolved the merge conflicts. What's left is to fix the way |
Hi!
Although the https://github.com/tldr-pages/tldr repository has pages in other languages than English, the only way to read a page in another language was changing the page source with
-sor--source.This PR makes
tldrdetect the system language and use it to download the page in that language if it's available. Otherwise, it will download in English instead. It's also possible to provide the language with-lor--language.