adds given `rule` pluralizer for given `locales` into `storage`
542880
function add(locales, rule) {
  var i;

  rule.c = rule.c ? rule.c.map(unpack) : [ 'other' ];
  rule.o = rule.o ? rule.o.map(unpack) : [ 'other' ];

  for (i = 0; i < locales.length; i++) {
    s[locales[i]] = rule;
  }
}
237442
def localized_scope
      langs = ::I18n.available_locales.join('|')
      scope '(:locale)', locale: Regexp.new(langs) do
        yield
      end
    end
655381
function compile(self, str, locale) {
  var nodes, buf, key, strict_exec, forms_exec, plurals_cache;

  // Quick check to avoid parse in most cases :)
  if (!CAN_HAVE_DIRECTIVES_RE.test(str)) { return str; }

  nodes = parser.parse(str);

  if (nodes.length === 1 && nodes[0].type === 'literal') {
    return nodes[0].text;
  }

  // init cache instance for plural parts, if not exists yet.
  if (!self._plurals_cache[locale]) {
    self._plurals_cache[locale] = new BabelFish(locale);
  }
  plurals_cache = self._plurals_cache[locale];

  buf = [];
  buf.push([ 'var str = "", strict, strict_exec, forms, forms_exec, plrl, cache, loc, loc_plzr, anchor;' ]);
  buf.push('params = flatten(params);');

  forEach(nodes, function (node) {
    if (node.type === 'literal') {
      buf.push(format('str += %j;', node.text));
      return;
    }

    if (node.type === 'variable') {
      key = node.anchor;
      buf.push(format(
        'str += ("undefined" === typeof (params[%j])) ? "[missed variable: %s]" : params[%j];',
        key, key, key
      ));
      return;
    }

    // should never happen
    /*istanbul ignore next*/
    if (node.type !== 'plural') { throw new Error('Unknown node type'); }

    //
    // Compile plural
    //

    key = node.anchor;
    // check if plural parts are plain strings or executable,
    // and add executable to "cache" instance of babelfish
    // plural part text will be used as translation key
    strict_exec = {};
    forEach(node.strict, function (text, k) {
      var parsed = parser.parse(text);
      if (parsed.length === 1 && parsed[0].type === 'literal') {
        strict_exec[k] = false;
        // patch with unescaped value for direct extract
        node.strict[k] = parsed[0].text;
        return;
      }

      strict_exec[k] = true;
      if (!plurals_cache.hasPhrase(locale, text, true)) {
        plurals_cache.addPhrase(locale, text, text);
      }
    });

    forms_exec = {};
    forEach(node.forms, function (text, idx) {
      var parsed = parser.parse(text), unescaped;
      if (parsed.length === 1 && parsed[0].type === 'literal') {
        // patch with unescaped value for direct extract
        unescaped = parsed[0].text;
        node.forms[idx] = unescaped;
        forms_exec[unescaped] = false;
        return;
      }

      forms_exec[text] = true;
      if (!plurals_cache.hasPhrase(locale, text, true)) {
        plurals_cache.addPhrase(locale, text, text);
      }
    });
    /*eslint-disable space-in-parens*/
    buf.push(format('loc = %j;', locale));
    buf.push(format('loc_plzr = %j;', locale.split(/[-_]/)[0]));
    buf.push(format('anchor = params[%j];', key));
    buf.push(format('cache = this._plurals_cache[loc];'));
    buf.push(format('strict = %j;', node.strict));
    buf.push(format('strict_exec = %j;', strict_exec));
    buf.push(format('forms = %j;', node.forms));
    buf.push(format('forms_exec = %j;', forms_exec));
    buf.push(       'if (+(anchor) != anchor) {');
    buf.push(format('  str += "[invalid plurals amount: %s(" + anchor + ")]";', key));
    buf.push(       '} else {');
    buf.push(       '  if (strict[anchor] !== undefined) {');
    buf.push(       '    plrl = strict[anchor];');
    buf.push(       '    str += strict_exec[anchor] ? cache.t(loc, plrl, params) : plrl;');
    buf.push(       '  } else {');
    buf.push(       '    plrl = pluralizer(loc_plzr, +anchor, forms);');
    buf.push(       '    str += forms_exec[plrl] ? cache.t(loc, plrl, params) : plrl;');
    buf.push(       '  }');
    buf.push(       '}');
    return;
  });

  buf.push('return str;');

  /*eslint-disable no-new-func*/
  return new Function('params', 'flatten', 'pluralizer', buf.join('\n'));
}
318217
function choosePluralForm(text, locale, count){
    var ret, texts, chosenText;
    if (count != null && text) {
      texts = text.split(delimeter);
      chosenText = texts[pluralTypeIndex(locale, count)] || texts[0];
      ret = trim(chosenText);
    } else {
      ret = text;
    }
    return ret;
  }
1156350
def pluralize(item):
        
        assert isinstance(item, (int, list))
        if isinstance(item, int):
            return 's' if item > 1 else ''
        if isinstance(item, list):
            return 's' if len(item) > 1 else ''
        return ''
1187721
public static void addPlural(String match, String rule, boolean insensitive){
        plurals.add(0, new Replacer(match, rule, insensitive));
    }
946512
function resolveLocale(locales) {
	const localesFingerprint = locales.toString()
	if (resolvedLocales[localesFingerprint]) {
		return resolvedLocales[localesFingerprint] 
	}
	return resolvedLocales[localesFingerprint] = intlDateTimeFormatSupportedLocale(locales)
}
649430
def _Pluralize(value, unused_context, args):
    """"""
    
    if len(args) == 0:
        s, p = '', 's'
    elif len(args) == 1:
        s, p = '', args[0]
    elif len(args) == 2:
        s, p = args
    else:
        # Should have been checked at compile time
        raise AssertionError
    
    if value > 1:
        return p
    else:
        return s
32576
function validate(cldr, pluralize) {
  pluralize.formats.forEach(function(key) {
    if (!cldr[key]) throw new Error('translation object missing required key "' + key + '"');
  });
}
263135
function collect(node, options, context, variables={}) {
    for (let rule of node.rules) {
        if (rule.isRuleset)
            collect(rule, options, context, variables);
        else if (rule.importedFilename)
            collect(rule.root, options, context, variables);
        else if (rule.variable === true) {
            const name = rule.name.substring(1);
            const value = rule.value.eval(context);

            // save under all aliases
            for (let fn of options.rename) {
                variables[ fn(name) ] = toJS(value, options, context);
            }
        }
    }

    return variables;
}
1032387
def prepare_translations!
      stash.each do |locale, attrs|
        if attrs.any?
          translation = record.translations.find_by_locale(locale)
          translation ||= record.translations.build(:locale => locale)
          attrs.each{ |name, value| translation[name] = value }
        end
      end
      reset
    end
221158
function localesToPairs(localeFiles) {
    return all(localeFiles.map(localeFile => fs.readFileAsync(localeFile, 'utf-8')
        .then(JSON.parse)
        .then(json => [localeByFile(localeFile), json])));
}
1265659
def pluralize(word):
    
    if not word or word.lower() in UNCOUNTABLES:
        return word
    else:
        for rule, replacement in PLURALS:
            if re.search(rule, word):
                return re.sub(rule, replacement, word)
        return word
1168873
def pluralize(count, item_type):
  
  def pluralize_string(x):
    if x.endswith('s'):
      return x + 'es'
    else:
      return x + 's'

  text = '{} {}'.format(count, item_type if count == 1 else pluralize_string(item_type))
  return text
273210
function  {
  var defaultLocaleBundle, localeBundle, merged;
  var aux = {};

  init();

  // Load i18n content.
  loadCldr(defaultLocale);
  loadCldr(locale);

  defaultLocaleBundle = new Globalize(defaultLocale).cldr.attributes.bundle;
  localeBundle = new Globalize(locale).cldr.attributes.bundle;

  assertLocale(locale);
  assert(typeof translation === "object", "missing or invalid `translation` argument, JSON expected (e.g., {\"en\": ...})");
  assert(typeof defaultLocale === "string", "missing or invalid `defaultLocale` argument, String expected (e.g., \"en\")");

  aux[localeBundle] = generateDefaultTranslation(defaultLocale)[defaultLocaleBundle];
  merged = merge({}, aux, translation);
  if (orderedStringify(translation) !== orderedStringify(merged)) {
    return merged;
  }
}
980647
function translateInLanguageFilter(key, locale) {
    for (var _len = arguments.length, args = new Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) {
      args[_key - 2] = arguments[_key];
    }

    return translateInLanguage.apply(void 0, [locale, key].concat(args));
  }
521591
function replaceLocale(locale, translations) {
    return store.dispatch({
      type: "".concat(moduleName, "/replaceLocale"),
      locale: locale,
      translations: translations
    });
  }