Closed rschluesselbauer closed 2 years ago
why not simply define supportedLngs and prevent all 404?
That is a good point. However, in my case an admin can upload translation files in any language, therefore I do not know
If I want to allow partial translation (translating only some namespaces), then this does not work.
Then you may need to create your own chained-backend logic.
Ok if this doesn't make any sense in the context of this cache, I'll close the issue. Thank you for your feedback!
🚀 Feature Proposal
Add option to cache translations of the fallback language for the originally requested language.
Motivation
If translations for a language do not exist and the fallback language is used, it would make sense to cache that result for the requested language to avoid multiple requests that always result in a 404.
If translations in the requested language do not exist, we make a bunch of 404 requests with the HTTP backend. Then the fallback language is used and the translations are cached for the fallback language. If the user reloads the page, they have to go through the 404 requests again before falling back to the cache. This could be avoided
Example
Imagine a setup with a localstorage-backend before a http-backend:
Whenever the page is reloaded the 404ing requests would be repeated.