def _add_solr_language_info(res, obj):
    """
    :param res: Solr document, i.e. a dict to which new keys will be added.
    :param obj: object which is searched for language information.
    :return: mutated dict res
    """
    if getattr(obj, 'language', None):
        res['language_t'] = obj.language.name
        obj = obj.language

    for attr in ['iso_code', 'glottocode']:
        value = getattr(obj, attr, None)
        if value:
            res.update({attr + '_s': value})
    return res