Detects an ICU-formatted plural or select message. Any placeholders occurring inside these
messages must be rewritten in ICU format.
174696
static boolean isStartOfIcuMessage(String part) {
    // ICU messages start with a '{' followed by an identifier, followed by a ',' and then 'plural'
    // or 'select' follows by another comma.
    // the 'startsWith' check is redundant but should allow us to skip using the matcher
    if (!part.startsWith("{")) {
      return false;
    }
    int commaIndex = part.indexOf(',', 1);
    // if commaIndex == 1 that means the identifier is empty, which isn't allowed.
    if (commaIndex <= 1) {
      return false;
    }
    int nextBracketIndex = part.indexOf('{', 1);
    return (nextBracketIndex == -1 || nextBracketIndex > commaIndex)
        && (part.startsWith("plural,", commaIndex + 1)
            || part.startsWith("select,", commaIndex + 1));
  }
1361443
private <V> boolean onCheckMapAttribute(PluralAttribute<? super X, ?, ?> pluralAttribute, Class<V> valueClazz)
    {
        if (pluralAttribute != null)
        {
            if (isMapAttribute(pluralAttribute) && isBindable(pluralAttribute, valueClazz))
            {
                return true;
            }

        }

        return false;
    }
543834
def plural(random=random, *args, **kwargs):
    
    return inflectify.plural(random.choice(nouns))
214737
private <E> boolean onCheckListAttribute(PluralAttribute<? super X, ?, ?> pluralAttribute, Class<E> paramClass)
    {
        if (pluralAttribute != null)
        {
            if (isListAttribute(pluralAttribute) && isBindable(pluralAttribute, paramClass))
            {
                return true;
            }

        }

        return false;
    }
77615
private void prependMessage( String s )
    {
        if ( s == null )
            return;

        if ( message == null )
            message = s;
        else
            message = s + " : "+ message;
    }
626346
public function ngettext($single, $plural, $number, &$num) {
        if ($this->short_circuit) {
            if ($number != 1)
                return $plural;
            else
                return $single;
        }

        // find out the appropriate form
        $select = $this->select_string($number);

        // this should contains all strings separated by NULLs
        $key = $single . chr(0) . $plural;


        if ($this->enable_cache) {
            if (!array_key_exists($key, $this->cache_translations)) {
                return ($number != 1) ? $plural : $single;
            }
            else {
                $result = $this->cache_translations[$key];
                $list = explode(chr(0), $result);
                return $list[$select];
            }
        }
        else {
            $num = $this->find_string($key);
            if ($num == -1) {
                return ($number != 1) ? $plural : $single;
            }
            else {
                $result = $this->get_translation_string($num);
                $list = explode(chr(0), $result);
                return $list[$select];
            }
        }
    }
235721
function errMessageFormat (showDiff, pos, title, msg, stack) {
  if (showDiff) {
    return format.red('  ' + pos + ') ' + title + ':\n' + msg) + format.gray('\n' + stack + '\n')
  }
  return format.red('  ' + pos + ') ' + title + ':\n') +
    format.white('     ' + msg) +
    format.white('\n' + stack + '\n')
}
858537
def get_kind_name_plural(kind):
        ""
        if kind in ['comedy', 'cinema', 'dance', 'theatre']:
            return kind.title()
        elif kind == 'museum':
            return 'Galleries/Museums'
        else:
            return '{}s'.format(Event.get_kind_name(kind))
548961
public static String formatMessage(TraceComponent tc, Enumeration<Locale> locales, String msgKey, Object... objs) {
        return formatMessage(tc, (locales == null) ? null : Collections.list(locales), msgKey, objs);
    }
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
241091
function (domain) {
        var pluralForms = [];
        var normalizedDomain = gt._normalizeDomain(domain, true);
        var poPluralsInfo = plurals[normalizedDomain];
        if (typeof poPluralsInfo === 'undefined') {
            // default to 'en' in this case
            normalizedDomain = 'en';
            poPluralsInfo = plurals['en'];
        }
        var icuPluralsFunction = IntlMessageFormat.prototype._findPluralRuleFunction(normalizedDomain);

        poPluralsInfo.examples.forEach(function (plural) {
            pluralForms.push({
                icuPlural: icuPluralsFunction(plural.sample),
                poPlural: plural.plural});
        });
        return pluralForms;
    }
290942
def _ReformatMessageString(self, message_string):
    
    def _PlaceHolderSpecifierReplacer(match_object):
      """Replaces message string place holders into Python format() style."""
      expanded_groups = []
      for group in match_object.groups():
        try:
          place_holder_number = int(group, 10) - 1
          expanded_group = '{{{0:d}:s}}'.format(place_holder_number)
        except ValueError:
          expanded_group = group

        expanded_groups.append(expanded_group)

      return ''.join(expanded_groups)

    if not message_string:
      return None

    message_string = self._WHITE_SPACE_SPECIFIER_RE.sub(r'', message_string)
    message_string = self._TEXT_SPECIFIER_RE.sub(r'\\\1', message_string)
    message_string = self._CURLY_BRACKETS.sub(r'\1\1', message_string)
    return self._PLACE_HOLDER_SPECIFIER_RE.sub(
        _PlaceHolderSpecifierReplacer, message_string)
423513
def formatted_message( severity, msg )
      msg = String === msg ? msg : msg.inspect

      if args = _matched( msg )
        args.first.call msg, args.last
      elsif proc = configuration[:severities][severity]
        proc.call msg
      else
        msg
      end
    end
1279911
private static String getPluralCaseOpenString(SoyMsgPluralCaseSpec pluralCaseSpec) {
    String icuCaseName =
        (pluralCaseSpec.getType() == SoyMsgPluralCaseSpec.Type.EXPLICIT)
            ? "=" + pluralCaseSpec.getExplicitValue()
            : pluralCaseSpec.getType().name().toLowerCase();
    return icuCaseName + "{";
  }
125812
private void updateEndCountText() {
        final String END_COUNT_MARKER = "%d";
        String endString = mResources.getQuantityString(R.plurals.recurrence_end_count,
                mModel.endCount);
        int markerStart = endString.indexOf(END_COUNT_MARKER);

        if (markerStart != -1) {
            if (markerStart == 0) {
                Log.e(TAG, "No text to put in to recurrence's end spinner.");
            } else {
                int postTextStart = markerStart + END_COUNT_MARKER.length();
                mPostEndCount.setText(endString.substring(postTextStart,
                        endString.length()).trim());
            }
        }
    }
206658
function (d, msgctxt, msgid, msgid_plural, n, category) {
        if (! msgid) {
            return '';
        }

        var msg_ctxt_id = msgctxt ? msgctxt + this.context_glue + msgid : msgid;

        var domainname = d || this.domain || 'messages';
        var lang = this.lang;

        // category is always LC_MESSAGES. We ignore all else
        var category_name = 'LC_MESSAGES';
        category = 5;

        var locale_data = [];
        if (typeof(this.data[lang]) != 'undefined' &&
            this.data[lang][domainname]) {
                locale_data.push(this.data[lang][domainname] );

        } else if (typeof(this.data[lang]) != 'undefined') {
            // didn't find domain we're looking for. Search all of them.
            for (var dom in this.data[lang]) {
                locale_data.push(this.data[lang][dom] );
            }
        }

        var trans = [];
        var found = false;
        var domain_used; // so we can find plural-forms if needed
        if (locale_data.length) {
            for (var i=0; i<locale_data.length; i++) {
                var locale = locale_data[i];
                if (locale.msgs[msg_ctxt_id]) {
                    var msg_ctxt_str = locale.msgs[msg_ctxt_id].msgstr;
                    trans = msg_ctxt_str.concat(trans.slice(msg_ctxt_str.length));
                    domain_used = locale;
                    found = true;
                    // only break if found translation actually has a translation.
                    if ( trans.length > 0 && trans[0].length !== 0 ) {
                        break;
                    }
                }
            }
        }

        // default to english if we lack a match, or match has zero length
        if ( trans.length === 0 || trans[0].length === 0 ) {
            trans = [ msgid, msgid_plural ];
        }

        var translation = trans[0];
        if (msgid_plural) {
            var p;
            if (found && domain_used.head.plural_func) {
                var rv = domain_used.head.plural_func(n);
                if (! rv.plural) {
                    rv.plural = 0;
                }
                if (! rv.nplural) {
                    rv.nplural = 0;
                }
                // if plurals returned is out of bound for total plural forms
                if (rv.nplural <= rv.plural) {
                    rv.plural = 0;
                }
                p = rv.plural;
            } else {
                p = (n != 1) ? 1 : 0;
            }
            if (trans[p]) {
                translation = trans[p];
            }
        }

        return translation;
    }
940752
def _AddUnicodeMethod(unused_message_descriptor, cls):
  """"""

  def __unicode__(self):
    return text_format.MessageToString(self, as_utf8=True).decode('utf-8')
  cls.__unicode__ = __unicode__