-
-
Notifications
You must be signed in to change notification settings - Fork 101
Fetch individual translation archives for cache (#217) #218
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
…ent variable configuration (tldr-pages#217)
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.
LGTM, Thanks for your contribution.
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.
This works, but it downloads only the language set in LANG
or TLDR_LANGUAGE
- LANGUAGE
is ignored. Also, it doesn't always download English, and that causes the client to download a single page from GitHub when a translation is not available. Is this expected?
Hi @SaurabhDRao, Any updates on this? |
I am extremely sorry, as I don't remember seeing these comments earlier. Anyways, from what I checked, And also if a translation is unavailable for a language that is set in any of the language variables, we need to go ahead and download the data for English anyways ? |
No issues, thanks for your work.
Yes, fetching only the languages specified in the environment variable, if a translated page isn't available display (fallback to) the English page with a warning that a translated page doesn't exist for the command in their language. Additionally, the language flag when called with a language not set in the environment variable, we could add a check that says language should be set there or if it's done already, then refresh the cache using the update command. |
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.
Kinda curious, shouldn't lines 28-31 be updated for the same, instead of fetching the entire archive?
Reference:
DOWNLOAD_CACHE_LOCATION = os.environ.get(
'TLDR_DOWNLOAD_CACHE_LOCATION',
'https://tldr-pages.github.io/assets/tldr.zip'
)
Actually, I don't think that is required. If you have a look at line number 382 cache_location = f"{DOWNLOAD_CACHE_LOCATION[:-4]}-pages.{language}.zip" you can see that the cache location will dynamically get updated as And since there is a call to But one thing to note is that if the cache is being pulled from a different location, set in |
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.
Seems like linter is set to accept only 88 characters per line, feel free to update line 400, 401 for the same.
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.
LGTM, thanks for your contribution!
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.
Works as expected.
Fetch individual translation archives for cache based on the environment variable configuration (#217)