def file_message(file_path):
    import re
    diff = difference(file_path)
    report = parse_file(file_path)
    path = re.search('(.*)LC_MESSAGES/', file_path).regs
    file_path = file_path[path[0][1]:]
    if diff[0] > diff[1]:  # something was appended
        done = report[1] / report[0] * 100
        return 'Translated %.0f%% of %s' % (done, file_path)
    size = 'Minor' if diff[0] < 20 else 'Major'
    return '%s changes in %s' % (size, file_path)
def report_progress(path, report, quiet=False):

    report('Translation progress: %s' % path)

    msgstrs_all_complete = 0
    msgstrs_all_empty = 0
    msgstrs_all_fuzzy = 0

    msgstrs_all_fuzzy_files = set()

    last_line_was_empty_msg_str = False

    for po_filepath in po_files(path):

        (msgstrs_file_complete, msgstrs_file_empty, msgstrs_file_fuzzy) = parse_file(po_filepath)

        if msgstrs_file_fuzzy > 0:
            msgstrs_all_fuzzy_files.add(po_filepath)

        if not quiet:
            report('%3d empty, %3d fuzzy of %3d; or [%5.1f %%] in %s' %
                   (msgstrs_file_empty,
                    msgstrs_file_fuzzy,
                    msgstrs_file_complete,
                    0.0 if not msgstrs_file_complete else
                    ((1.0 - (msgstrs_file_empty + msgstrs_file_fuzzy) /
                     msgstrs_file_complete) * 100.0),
                    po_filepath[len(path):]))

        msgstrs_all_complete += msgstrs_file_complete
        msgstrs_all_empty += msgstrs_file_empty
        msgstrs_all_fuzzy += msgstrs_file_fuzzy

    report(
        'Fuzzy:   %d fuzzy strings in:' %
        (msgstrs_all_fuzzy))
    for po_filepath in sorted(msgstrs_all_fuzzy_files):
        report(' ' * 9 + "%s" % po_filepath)

    report('Summary: %d empty of %d; or [%5.1f %%] complete' %
           (msgstrs_all_empty,
            msgstrs_all_complete,
            0.0 if not msgstrs_all_complete else
            ((1.0 - ((msgstrs_all_empty + msgstrs_all_fuzzy ) /
              msgstrs_all_complete)) * 100.0)))