i18next-xhr-backend: missing files prevent i18next from doing graceful language fallback

Can we reopen this? (#261)

I’m trying to implement use i18next init with a promise that will resolve once it’s completely initialized (so that parts of the app can know the i18next object is initialized- not just immediately after the callback, but also well after). But currently with this issue, it will immediately reject(), even before XHR backend tries out fall back languages.

How can I know when init() has really, truly failed (particularly the backend not being able to find any files)? Currently, if I instead just let it resolve (or use a try/catch) when no appropriate json file could be found, it returns the string keys as fallback for the t() function, and keeps going. On the other hand, if i reject, there’s no graceful fallback as described in #261

}, (err, t) => { 
   //init callback
   if (err){
      console.error(err);
      reject('i18next init promise reject');
   }
   resolve('i18next init promise resolve');
});

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Comments: 23 (13 by maintainers)

Most upvoted comments

alright, I see. Thanks for clarifying things then. I will try to do that.

I’ll close the issue and see if it works out.