#NEWLINE# def _translate_page_into( page , language , default = None ) : #NEWLINE# #INDENT# '\n    Return the translation for a given page\n    ' #NEWLINE# try : #NEWLINE# #INDENT# if ( page . language == language ) : #NEWLINE# #INDENT# return page #NEWLINE# #UNINDENT# if ( language is not None ) : #NEWLINE# #INDENT# translations = dict ( ( ( page . language , t ) for t in page . available_translations ( ) ) ) #NEWLINE# if ( language in translations ) : #NEWLINE# #INDENT# return translations [ language ] #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# except AttributeError : #NEWLINE# #INDENT# pass #NEWLINE# #UNINDENT# if hasattr ( default , '__call__' ) : #NEWLINE# #INDENT# return default ( page = page ) #NEWLINE# #UNINDENT# return default