#NEWLINE# @ register . filter #NEWLINE# def trans( name , langs = None , include_lang = True , use_delim = True ) : #NEWLINE# #INDENT# langs = ( langs or [ 'default' ] ) #NEWLINE# if include_lang : #NEWLINE# #INDENT# if use_delim : #NEWLINE# #INDENT# suffix = ( lambda lang : ( ' [%s]' % lang ) ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# suffix = ( lambda lang : ( LANG_BUTTON % { #NEWLINE# #INDENT# 'lang' : html . escape ( lang ) , #NEWLINE# 'extra_class' : '' , #NEWLINE# 'extra_style' : '' , #NEWLINE# #UNINDENT# } ) ) #NEWLINE# #UNINDENT# #UNINDENT# else : #NEWLINE# #INDENT# suffix = ( lambda lang : '' ) #NEWLINE# #UNINDENT# for lang in langs : #NEWLINE# #INDENT# if ( ( lang in name ) and name [ lang ] ) : #NEWLINE# #INDENT# return ( name [ lang ] + ( '' if ( langs and ( langs == langs [ 0 ] ) ) else suffix ( lang ) ) ) #NEWLINE# #UNINDENT# #UNINDENT# for ( lang , n ) in sorted ( name . items ( ) ) : #NEWLINE# #INDENT# return ( n + suffix ( lang ) ) #NEWLINE# #UNINDENT# return ''