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
May you please add a spec/scenario that fail the current implementation. As far as sails hook implementation is concern and regardless of the number request all request will be processed to obtain their locale.
Is it bad idea is attaching locale to a request object?. If so am open for the correct implementation.
rishabhmhjn
changed the title
Thing about alternative to sails.config.i18n.requestLocale
Think about alternative to sails.config.i18n.requestLocale
Jan 30, 2016
@rishabhmhjn I don't see how you proposition fixes anything. You set a property on a global. The before hook can be called numerous times before you access the requestLocale in the validateCustom function anyway.
I can't think of a way of fixing the problem without a reference to the request in the validateCustom function.
Using
sails.config.i18n.requestLocale = request.getLocale();
is a bad idea!It assumes that all the requests are processed serially and so, parallel requests will fail to get the correct locale!
https://github.com/lykmapipo/sails-hook-validation/blob/master/index.js#L73
The text was updated successfully, but these errors were encountered: