tldr-pages / tldr-node-client

Node.js command-line client for tldr pages
https://www.npmjs.com/package/tldr
MIT License
431 stars 71 forks source link

Fetch individual translation archives for cache based on the environment variable configuration #419

Closed kbdharun closed 10 months ago

kbdharun commented 12 months ago

As specified in Client Specification 2.0

"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."

So, we need to update the client behaviour to work with fetching only the specified language's archive when fetching based on configuration, we can include English by default as a fallback.

vivekjoshi556 commented 11 months ago

I would like to work on this. Can you please assign it to me?

kbdharun commented 11 months ago

I would like to work on this. Can you please assign it to me?

Sure, feel free to refer to this comment https://github.com/tldr-pages/tldr-python-client/issues/217#issuecomment-1742032161 for additional details.