You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Incompatible code between i18next v22.1.0 and i18next-fs-backend v2.1.0, causing saveMissing to report error with the callback function.
The following commit introduced a problem with the saveMissing function when using i18next-fs-backend: 40db211
The i18next-fs-backend has a create function defined with arguments:
(languages,namespace,key,fallbackValue,callback)
The new code introduced in v22.1.0 in the commit referenced above has different expectations for the backend's create function and end up passing the options object in place of the callback to the backend. This causes an error since the expected callback object is not a function.
The above referenced commit expects that the backend's create function contain 6 arguments in order to pass a callback to the backend. If the backend's create function contains fewer than 6 arguments, then it will not pass a callback to the backend and instead pass the opts object for the 5th argument.
varfc=this.backend.create.bind(this.backend);if(fc.length<6){try{varr;if(fc.length===5){r=fc(languages,namespace,key,fallbackValue,opts);// <-- for i18next-fs-backend this ends up being called}else{r=fc(languages,namespace,key,fallbackValue);}if(r&&typeofr.then==='function'){r.then(function(data){returnclb(null,data);})["catch"](clb);}else{clb(null,r);}}catch(err){clb(err);}}else{fc(languages,namespace,key,fallbackValue,clb,opts);}
To Reproduce
enable saveMissing with the default i18next-fs-backend configured
馃悰 Bug Report
Incompatible code between i18next v22.1.0 and i18next-fs-backend v2.1.0, causing saveMissing to report error with the callback function.
The following commit introduced a problem with the saveMissing function when using i18next-fs-backend: 40db211
The i18next-fs-backend has a create function defined with arguments:
The new code introduced in v22.1.0 in the commit referenced above has different expectations for the backend's create function and end up passing the options object in place of the callback to the backend. This causes an error since the expected callback object is not a function.
The above referenced commit expects that the backend's create function contain 6 arguments in order to pass a callback to the backend. If the backend's create function contains fewer than 6 arguments, then it will not pass a callback to the backend and instead pass the opts object for the 5th argument.
To Reproduce
enable saveMissing with the default i18next-fs-backend configured
Expected behavior
No errors reported when saveMissing is enabled.
Your Environment
The text was updated successfully, but these errors were encountered: