(lang, **kwargs)
return translator
Utility method to get a valid translator object from a language
    name
Utility method to get a valid translator object from a language
    name
Utility method to get a valid translator object from a language name
def _get_translator(lang, **kwargs):
    """Utility method to get a valid translator object from a language
    name"""
    if not lang:
        return NullTranslations()
    if 'pylons_config' in kwargs:
        conf = kwargs.pop('pylons_config')
    else:
        conf = pylons.config.current_conf()
    localedir = os.path.join(conf['pylons.paths']['root'], 'i18n')
    if not isinstance(lang, list):
        lang = [lang]
    try:
        translator = translation(conf['pylons.package'], localedir,
                                 languages=lang, **kwargs)
    except IOError, ioe:
        raise LanguageError('IOError: %s' % ioe)
    translator.pylons_lang = lang
    return translator
def _get_translator ( lang , * * kwargs ) : if not lang : return NullTranslations ( ) if 'pylons_config' in kwargs : conf = kwargs . pop ( 'pylons_config' ) else : conf = pylons . config . current_conf ( ) localedir = os . path . join ( conf [ 'pylons.paths' ] [ 'root' ] , 'i18n' ) if not isinstance ( lang , list ) : lang = [ lang ] try : translator = translation ( conf [ 'pylons.package' ] , localedir , languages = lang , * * kwargs ) except IOError , ioe : raise LanguageError ( 'IOError: %s' % ioe ) translator . pylons_lang = lang return translator