parameters: (message)
return_statement: return ''.join(lines)
docstring: Compiles ICU plural syntax to the body of an Android <plurals> element.
  
    1. In a .grd file, we can write a plural string like this:
  
      <message name="IDS_THINGS">
        {NUM_THINGS, plural,
        =1 {1 thing}
        other {# things}}
      </message>
  
    2. The Android equivalent looks like this:
  
      <plurals name="things">
        <item quantity="one">1 thing</item>
        <item quantity="other">%d things</item>
      </plurals>
  
    This method takes the body of (1) and converts it to the body of (2).
  
    If the message is *not* a plural string, this function returns `None`.
    If the message includes quantities without an equivalent format in Android,
    it raises an exception.
docstring_summary: Compiles ICU plural syntax to the body of an Android <plurals> element.
docstring_tokens: Compiles ICU plural syntax to the body of an Android <plurals > element .
function: def _FormatPluralMessage(message):
    """Compiles ICU plural syntax to the body of an Android <plurals> element.
  
    1. In a .grd file, we can write a plural string like this:
  
      <message name="IDS_THINGS">
        {NUM_THINGS, plural,
        =1 {1 thing}
        other {# things}}
      </message>
  
    2. The Android equivalent looks like this:
  
      <plurals name="things">
        <item quantity="one">1 thing</item>
        <item quantity="other">%d things</item>
      </plurals>
  
    This method takes the body of (1) and converts it to the body of (2).
  
    If the message is *not* a plural string, this function returns `None`.
    If the message includes quantities without an equivalent format in Android,
    it raises an exception.
    """
    ret = {}
    plural_match = _PLURALS_PATTERN.match(message)
    if not plural_match:
      return None
    body_in = plural_match.group('items').strip()
    lines = []
    for item_match in _PLURALS_ITEM_PATTERN.finditer(body_in):
      quantity_in = item_match.group('quantity')
      quantity_out = _PLURALS_QUANTITY_MAP.get(quantity_in)
      value_in = item_match.group('value')
      value_out = '"' + value_in.replace('#', '%d') + '"'
      if quantity_out:
        lines.append(_PLURALS_ITEM_TEMPLATE % (quantity_out, value_out))
      else:
        raise Exception('Unsupported plural quantity for android '
                        'strings.xml: %s' % quantity_in)
    return ''.join(lines)
function_tokens: def _FormatPluralMessage ( message ) : ret = { } plural_match = _PLURALS_PATTERN . match ( message ) if not plural_match : return None body_in = plural_match . group ( 'items' ) . strip ( ) lines = [ ] for item_match in _PLURALS_ITEM_PATTERN . finditer ( body_in ) : quantity_in = item_match . group ( 'quantity' ) quantity_out = _PLURALS_QUANTITY_MAP . get ( quantity_in ) value_in = item_match . group ( 'value' ) value_out = '"' + value_in . replace ( '#' , '%d' ) + '"' if quantity_out : lines . append ( _PLURALS_ITEM_TEMPLATE % ( quantity_out , value_out ) ) else : raise Exception ( 'Unsupported plural quantity for android ' 'strings.xml: %s' % quantity_in ) return '' . join ( lines )