#NEWLINE# @ staticmethod #NEWLINE# def translate_language_onaccept( form ) : #NEWLINE# #INDENT# '\n            Merge the uploaded CSV file with existing language file\n            & mark translation percentages as dirty\n        ' #NEWLINE# import csv #NEWLINE# import os #NEWLINE# from .. s3.s3translate import Strings #NEWLINE# form_vars = form . vars #NEWLINE# lang_code = form_vars . code #NEWLINE# csvfilename = os . path . join ( current . request . folder , 'uploads' , form_vars . file ) #NEWLINE# S = Strings ( ) #NEWLINE# try : #NEWLINE# #INDENT# S . write_w2p ( [ csvfilename ] , lang_code , 'm' ) #NEWLINE# #UNINDENT# except ( csv . Error , SyntaxError ) : #NEWLINE# #INDENT# import sys #NEWLINE# current . session . error = ( current . T ( 'Error reading file (invalid format?): %(msg)s' ) % { #NEWLINE# #INDENT# 'msg' : sys . exc_info ( ) [ 1 ] , #NEWLINE# #UNINDENT# } ) #NEWLINE# return #NEWLINE# #UNINDENT# ptable = current . s3db . translate_percentage #NEWLINE# current . db ( ( ptable . code == lang_code ) ) . update ( dirty = True ) #NEWLINE# return