How to use the translate.param.missing function in translate

To help you get started, we’ve selected a few translate 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 nuzzio / grunt-strip-code / tasks / strip_code.js View on Github external
var translate = function () {

            if (arguments.length === 0) {
                grunt.warn(strings[options.locale]['translate.param.missing']);
            }

            var key = arguments[0];

            if (!(key in strings[options.locale])) {
                grunt.warn(strings[options.locale]['string.key.missing'] + ': ' + key);
            }

            var string = strings[options.locale][key];

            for (var i = 1; i < arguments.length; i++) {
                var replacementKey = '%' + i;
                string = string.replace(replacementKey, arguments[i]);
            }

            return string;

translate

Translate text to different languages on node.js and the browser

MIT
Latest version published 2 months ago

Package Health Score

73 / 100
Full package analysis