How to use the intl-messageformat.prototype function in intl-messageformat

To help you get started, we’ve selected a few intl-messageformat 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 formatjs / react-intl / src / plural.js View on Github external
function resolveLocale(locales) {
  // IntlMessageFormat#_resolveLocale() does not depend on `this`.
  return IntlMessageFormat.prototype._resolveLocale(locales);
}
github formatjs / react-intl / src / plural.js View on Github external
function findPluralFunction(locale) {
  // IntlMessageFormat#_findPluralFunction() does not depend on `this`.
  return IntlMessageFormat.prototype._findPluralRuleFunction(locale);
}
github diplomatiegouvfr / hornet-js / hornet-js-utils / src / i18n-utils.ts View on Github external
* hornet-js-utils - Partie commune et utilitaire à tous les composants hornet-js
 *
 * @author MEAE - Ministère de l'Europe et des Affaires étrangères
 * @version v5.4.1
 * @link git+https://github.com/diplomatiegouvfr/hornet-js.git
 * @license CECILL-2.1
 */

import { Utils } from "src/index";

//////////////////////////////////////////////////////////////////////////////////////////////////////////////
//                patch intl-messageformat afin de ne pas échouer si un paramètre est manquant              //
//////////////////////////////////////////////////////////////////////////////////////////////////////////////
const src$utils$$ = require("intl-messageformat/lib/utils");
const IntlMessageFormat = require("intl-messageformat");
IntlMessageFormat.prototype._format = function (pattern, values) {
    let result = "";
    let i;
    let len;
    let part;
    let id;
    let value;

    for (i = 0, len = pattern.length; i < len; i += 1) {
        part = pattern[ i ];

        // Exist early for string parts.
        if (typeof part === "string") {
            result += part;
            continue;
        }

intl-messageformat

Formats ICU Message strings with number, date, plural, and select placeholders to create localized messages.

BSD-3-Clause
Latest version published 4 days ago

Package Health Score

100 / 100
Full package analysis