How to use the @node-red/util.i18n.i function in @node-red/util

To help you get started, we’ve selected a few @node-red/util examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github node-red / node-red / packages / node_modules / @node-red / editor-api / lib / editor / locales.js View on Github external
get: function(req,res) {
        var namespace = req.params[0];
        var lngs = req.query.lng;
        namespace = namespace.replace(/\.json$/,"");
        var lang = req.query.lng || i18n.defaultLang; //apiUtil.determineLangFromHeaders(req.acceptsLanguages() || []);
        var prevLang = i18n.i.language;
        // Trigger a load from disk of the language if it is not the default
        i18n.i.changeLanguage(lang, function(){
            var catalog = loadResource(lang, namespace);
            res.json(catalog||{});
        });
        i18n.i.changeLanguage(prevLang);
    }
}
github node-red / node-red / packages / node_modules / @node-red / editor-api / lib / editor / locales.js View on Github external
get: function(req,res) {
        var namespace = req.params[0];
        var lngs = req.query.lng;
        namespace = namespace.replace(/\.json$/,"");
        var lang = req.query.lng || i18n.defaultLang; //apiUtil.determineLangFromHeaders(req.acceptsLanguages() || []);
        var prevLang = i18n.i.language;
        // Trigger a load from disk of the language if it is not the default
        i18n.i.changeLanguage(lang, function(){
            var catalog = loadResource(lang, namespace);
            res.json(catalog||{});
        });
        i18n.i.changeLanguage(prevLang);
    }
}