How to use the numeral.language function in numeral

To help you get started, we’ve selected a few numeral 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 tarlepp / Taskboard / config / express.js View on Github external
app.use(function(req, res, next) {
            if (req.user && req.user.language) {
                // Change moment language
                moment.lang(req.user.language);

                try {
                    // Change numeral language
                    numeral.language(req.user.language, require("../node_modules/numeral/languages/" + req.user.language + ".js"));
                    numeral.language(req.user.language);
                } catch (error) {
                    // Just silently ignore this error...
                }
            }

            // Set data to response locals, so those are accessible by any view
            res.locals.currentUser = req.user;
            res.locals.moment = moment;
            res.locals.numeral = numeral;
            res.locals.packageJson = JSON.parse(fs.readFileSync("package.json", "utf8"));
            res.locals.inspect = require("util").inspect;

            next();
        });
    }
github CBIConsulting / ProperTable / src / js / config / settings.js View on Github external
setLang(lang = "en", msgs = {}) {
		let newmsgs = {};

		if (typeof langs[lang] !== 'undefined') {
			newmsgs = $.extend(true, this.messages, langs[lang]);
		}

		if (!_.isEmpty(msgs)) {
			newmsgs = $.extend(true, newmsgs, msgs);
		}

		this.settings.language = lang;
		try {
			numeral.language(lang);
		} catch (err) {
			console.warn('unable to set numeral language to '+lang);
		}

		this.messages = newmsgs;
	}
github gengojs / gengojs / gengo.js View on Github external
}

                if (override) {
                    try {
                        var localenumeral = require('numeral');
                        //if for some reason our locale is English
                        if (localemap.numeral[override] === 'en') {
                            //set numeral's language
                            localenumeral.language('en');
                            return localenumeral;
                        } else {
                            //load the language

                            localenumeral.language(localemap.numeral[override], require('numeral/languages/' + localemap.numeral[override] + '.js'));
                            //set the language
                            localenumeral.language(localemap.numeral[override]);
                            return localenumeral;
                        }

                    } catch (error) {
                        cout("fn: lib , fn: numeral" + error.toString().replace("Error: ", " ")).error();
                    }
                }
            }
        };
github gengojs / gengojs / sample / public / javascripts / gengo.js View on Github external
function loadNumeral(locale) {
        if (locale === 'en') {
            numeral.language('en');
        } else {
            numeral.language(locale, require(NUMERALPATH + locale));
            numeral.language(locale);
        }
        debug(numeral.language(), 'fn: loadNumeral, Current numeral language');
        debug(numeral(10000).format('$0,0.00'), 'fn: loadNumeral, Current numeral: I don\'t have');
    }
github gengojs / gengojs / sample / public / javascripts / gengo.js View on Github external
function loadNumeral(locale) {
        if (locale === 'en') {
            numeral.language('en');
        } else {
            numeral.language(locale, require(NUMERALPATH + locale));
            numeral.language(locale);
        }
        debug(numeral.language(), 'fn: loadNumeral, Current numeral language');
        debug(numeral(10000).format('$0,0.00'), 'fn: loadNumeral, Current numeral: I don\'t have');
    }
github gengojs / gengojs / sample / public / javascripts / gengo.js View on Github external
function loadNumeral(locale) {
        if (locale === 'en') {
            numeral.language('en');
        } else {
            numeral.language(locale, require(NUMERALPATH + locale));
            numeral.language(locale);
        }
        debug(numeral.language(), 'fn: loadNumeral, Current numeral language');
        debug(numeral(10000).format('$0,0.00'), 'fn: loadNumeral, Current numeral: I don\'t have');
    }
github lemonCMS / redux-form-generator / example / src / utils / numeral.js View on Github external
import numeral from 'numeral';
const obj = require('numeral/languages/nl-nl');

numeral.language('nl-nl', obj);
numeral.language('nl-nl');
export default numeral;
github danielwippermann / resol-vbus / src / i18n.js View on Github external
'en': {
        moment: 'en',
        numeral: 'en',
    },
};



const resources = {
    dev: { translation: require('./locales/dev.json') },
    de: { translation: require('./locales/de.json') },
};



numeral.language('de', require('numeral/languages/de'));



const I18N = extend(null, /** @lends I18N# */ {

    language: null,

    languageData: null,

    timezone: null,

    /**
     * Creates a new I18N instance for the given language code.
     *
     * @constructs
     * @param {string} [language='en'] Language code (ISO 639-1)