'Merge the uploaded CSV file with existing language file
& mark translation percentages as dirty'

@staticmethod
def translate_language_onaccept(form):

    import csv
    import os
    from ..s3.s3translate import Strings
    form_vars = form.vars
    lang_code = form_vars.code
    csvfilename = os.path.join(current.request.folder, 'uploads', form_vars.file)
    S = Strings()
    try:
        S.write_w2p([csvfilename], lang_code, 'm')
    except (csv.Error, SyntaxError):
        import sys
        current.session.error = (current.T('Error    reading    file    (invalid    format?):    %(msg)s') % {'msg': sys.exc_info()[1]})
        return
    ptable = current.s3db.translate_percentage
    current.db((ptable.code == lang_code)).update(dirty=True)
    return
