def convert_translations_to_dict(js_translations):
 (plural, n_plural) = _get_plural_forms(js_translations)
 translations_dict = {'plural': plural, 'catalog': {}, 'fallback': None}
 if (js_translations._fallback is not None):
  translations_dict['fallback'] = convert_translations_to_dict(js_translations._fallback)
 for (key, value) in js_translations._catalog.items():
  if (key == ''):
   continue
  if (type(key) in (str, unicode)):
   translations_dict['catalog'][key] = value
  elif (type(key) == tuple):
   if (key[0] not in translations_dict['catalog']):
    translations_dict['catalog'][key[0]] = ([''] * n_plural)
   translations_dict['catalog'][key[0]][int(key[1])] = value
 return translations_dict

def convert_translations_to_dict ( js_translations ) : ( plural , n_plural ) = _get_plural_forms ( js_translations ) translations_dict = { 'plural' : plural , 'catalog' : { } , 'fallback' : None } if ( js_translations . _fallback is not None ) : translations_dict [ 'fallback' ] = convert_translations_to_dict ( js_translations . _fallback ) for ( key , value ) in js_translations . _catalog . items ( ) : if ( key == '' ) : continue if ( type ( key ) in ( str , unicode ) ) : translations_dict [ 'catalog' ] [ key ] = value elif ( type ( key ) == tuple ) : if ( key [ 0 ] not in translations_dict [ 'catalog' ] ) : translations_dict [ 'catalog' ] [ key [ 0 ] ] = ( [ '' ] * n_plural ) translations_dict [ 'catalog' ] [ key [ 0 ] ] [ int ( key [ 1 ] ) ] = value return translations_dict
convert a gnutranslations object into a dict for jsonifying .