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

Using locize backend as the backup for a resourcesToBackend primary #33

Open
davidemerritt opened this issue Sep 14, 2023 · 1 comment

Comments

@davidemerritt
Copy link

🚀 Feature Proposal

I would like to use the LocizeBackend CDN backend as the cache backup for the local resource backend (resourcesToBackend). We are deploying these on a mobile app - and it isn't appropriate to use a suspense loading fallback for the >100ms of time waiting for the locize CDN on initial app load.

Motivation

We need immediate load of translation files (our mobile app is used in a lot of low service areas so a network request blocking translations is a non-starter), but we love the flexibility that your hosted CDN provides, so ideally we load from disk (bundled files) and then at some frequency ping for new translation values from the CDN.

Maybe this is already possible to use with the ChainedBackend, ResourcesToBackend and LocizeBackend but I could not get it to run. Because there are local files for the ResourcesToBackend, it never tries to read from the LocizeBackend, with the
`cacheHitMode: 'refreshAndUpdateStore' attribute set.

Example

@davidemerritt davidemerritt changed the title Using locize backend as the backup for a resourceToBackend Using locize backend as the backup for a resourcesToBackend primary Sep 14, 2023
@adrai
Copy link
Member

adrai commented Sep 15, 2023

resourcesToBackend is not a valid caching backend (it has no save function).
i18next-fs-backend for example can be used as caching backend, like here: https://github.com/locize/i18next-locize-backend/blob/master/example/updatable-cache/index.js

And on mobile (react-native etc...) you could use i18next-async-storage-backend it also has a save function.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants