#NEWLINE# def preprocess( self ) : #NEWLINE# #INDENT# '\n        Preprocess (if necessary) a translatable file before passing it to\n        xgettext GNU gettext utility.\n        ' #NEWLINE# from django.utils.translation import templatize #NEWLINE# if ( not self . is_templatized ) : #NEWLINE# #INDENT# return #NEWLINE# #UNINDENT# with io . open ( self . path , 'r' , encoding = settings . FILE_CHARSET ) as fp : #NEWLINE# #INDENT# src_data = fp . read ( ) #NEWLINE# #UNINDENT# if ( self . domain == 'djangojs' ) : #NEWLINE# #INDENT# content = prepare_js_for_gettext ( src_data ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( self . domain == 'django' ) : #NEWLINE# #INDENT# content = templatize ( src_data , self . path [ 2 : ] ) #NEWLINE# #UNINDENT# #UNINDENT# with io . open ( self . work_path , 'w' , encoding = 'utf-8' ) as fp : #NEWLINE# #INDENT# fp . write ( src_data )