i18next-http-backend
i18next-http-backend copied to clipboard
Possibility to add timeout to the setup
🚀 Feature Proposal
Add the possibility to add timeout for fetching i18n resource like the axios config timeout
. (See example here for timeout:
https://axios-http.com/docs/req_config and search for timeout)
Motivation
When fetching i18n resource it would be really good to specify for how long a request is acceptable to wait for before fallbacking to fetching i18n resources from somewhere else.
Example
https://axios-http.com/docs/req_config and search for timeout
...i18n config
backend: {
backends: [HttpBackend, resourcesToBackend(config.resources)],
backendOptions: [
{
loadPath: <URL_TO_FETCH>,
crossDomain: true,
timeout: 2000, // Will fallback to fetch i18n resources from file if request take more than 2 sec
},
],
},
You can already do so by specifying your own fetch/request function: https://github.com/i18next/i18next-http-backend#backend-options
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.