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

How to cache a single language? #3860

Closed
stevemao opened this issue Feb 16, 2020 · 5 comments
Closed

How to cache a single language? #3860

stevemao opened this issue Feb 16, 2020 · 5 comments
Assignees
Labels
clients Issues pertaining to a particular client or the clients as whole.

Comments

@stevemao
Copy link

The spec says

Caching SHOULD be done according to the user's language configuration (if any), as to not waste unneeded space for unneeded languages.

But the only asset you can download is tldr.zip, which is an entire archive. Is there anything I miss here?

@zlatanvasovic zlatanvasovic added the clients Issues pertaining to a particular client or the clients as whole. label Feb 16, 2020
@sbrl
Copy link
Member

sbrl commented Feb 17, 2020

Hey there, @stevemao! Hrm, that's an interesting one. Looking at the git blame, think it was @mebeim and myself who appear to have added that to the specification.

You raise a good point.

I suppose you could download the whole thing, but only extract the bits you're interested in for now?

It might be worth doing something about this actually - especially since we're growing both the number of different translations and the number of translated pages.

@mebeim
Copy link
Member

mebeim commented Feb 17, 2020

The current intended way is indeed downloading the whole archive and extracting only the languages of interest. That "should" clause is not really necessary to comply with, it's just an indication of the expected good behavior for a client.

@schneiderl
Copy link
Collaborator

schneiderl commented Feb 17, 2020

I agree with @sbrl when she says we could do something about this.
Maybe making available an asset for each language and another one for the full archive so that the clients can cache the way they prefer.

@zlatanvasovic
Copy link
Contributor

@schneiderl's idea is good. It'd also allow us to keep an old archive in the same place, giving clients the time to comply with the new page structure (which we've been discussing for a long time).

@kbdharun
Copy link
Member

@stevemao I have some good news for you. Since v2.0 (#10555) we support caching for individual languages.

This is the updated caching spec

If appropriate, it is RECOMMENDED that clients implement a cache of pages. If implemented, clients MUST download the entire archive either as a whole from https://tldr.sh/assets/tldr.zip (Which redirects to https://raw.githubusercontent.com/tldr-pages/tldr-pages.github.io/main/assets/tldr.zip) or download language-specific translation archives in the format https://tldr.sh/assets/tldr-pages.{{language-code}}.zip (Which redirects to https://raw.githubusercontent.com/tldr-pages/tldr-pages.github.io/main/assets/tldr-pages.{{language-code}}.zip), along with the archive for English from https://tldr.sh/assets/tldr-pages.zip (It redirects to https://raw.githubusercontent.com/tldr-pages/tldr-pages.github.io/main/assets/tldr-pages.zip).

Caching SHOULD be done according to the user's language configuration (if any), to not waste unneeded space for unused languages. Additionally, clients MAY automatically update the cache regularly.

@kbdharun kbdharun added this to Roadmap Sep 12, 2023
@kbdharun kbdharun moved this to Done in Roadmap Sep 12, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
clients Issues pertaining to a particular client or the clients as whole.
Projects
Status: Done
Development

No branches or pull requests

6 participants