Skip to content

Think about alternative to sails.config.i18n.requestLocale #34

@rishabhmhjn

Description

@rishabhmhjn

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

    return {
        //intercent all request and current grab request locale
        routes: {
            before: {
                'all /*': function grabLocale(request, response, next) {
                    //configure i18n current request locale
                    sails.config.i18n.requestLocale = request.getLocale();

                    //continue
                    next();
                }
            }
        },

...

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions