OLD | NEW |
1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
2 | 2 |
3 ''' | 3 ''' |
4 USAGE: cd Documentation && translations-status.py | 4 USAGE: cd Documentation && translations-status.py |
5 | 5 |
6 Write: | 6 Write: |
7 translations.itexi | 7 translations.itexi |
8 <LANG>/translations.itexi | 8 <LANG>/translations.itexi |
9 out/translations-status.txt | 9 out/translations-status.txt |
10 | 10 |
(...skipping 673 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
684 update_category_word_counts_re = re.compile (r'(?ms)^-(\d+)-(.*?\n)\d+ *total') | 684 update_category_word_counts_re = re.compile (r'(?ms)^-(\d+)-(.*?\n)\d+ *total') |
685 | 685 |
686 counts_re = re.compile (r'(?m)^(\d+) ') | 686 counts_re = re.compile (r'(?m)^(\d+) ') |
687 | 687 |
688 def update_category_word_counts_sub (m): | 688 def update_category_word_counts_sub (m): |
689 return ('-' + m.group (1) + '-' + m.group (2) | 689 return ('-' + m.group (1) + '-' + m.group (2) |
690 + str (sum ([int (c) | 690 + str (sum ([int (c) |
691 for c in counts_re.findall (m.group (2))])).ljust (6) | 691 for c in counts_re.findall (m.group (2))])).ljust (6) |
692 + 'total') | 692 + 'total') |
693 | 693 |
694 # urg | 694 # urg |
695 # main () starts here-abouts | 695 # main () starts here-abouts |
696 | 696 |
697 progress ("Reading documents...") | 697 progress ("Reading documents...") |
698 | 698 |
699 master_files = \ | 699 master_files = \ |
700 buildlib.read_pipe ("git ls-files | grep -E '[^/]*/?[^/]*[.](tely|texi)$'")[
0].splitlines () | 700 buildlib.read_pipe ("git ls-files | grep -E '[^/]*/?[^/]*[.](tely|texi)$'")[
0].splitlines () |
701 master_files.sort () | 701 master_files.sort () |
702 master_docs = [MasterTelyDocument (os.path.normpath (filename)) | 702 master_docs = [MasterTelyDocument (os.path.normpath (filename)) |
703 for filename in master_files] | 703 for filename in master_files] |
704 master_docs = [doc for doc in master_docs if doc.translations] | 704 master_docs = [doc for doc in master_docs if doc.translations] |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
768 translation_instructions = update_word_count (translation_instructions, | 768 translation_instructions = update_word_count (translation_instructions, |
769 po_file, | 769 po_file, |
770 word_count) | 770 word_count) |
771 | 771 |
772 translation_instructions = \ | 772 translation_instructions = \ |
773 update_category_word_counts_re.sub (update_category_word_counts_sub, | 773 update_category_word_counts_re.sub (update_category_word_counts_sub, |
774 translation_instructions) | 774 translation_instructions) |
775 | 775 |
776 open (translation_instructions_file, 'w').write (translation_instructions) | 776 open (translation_instructions_file, 'w').write (translation_instructions) |
777 sys.exit (exit_code) | 777 sys.exit (exit_code) |
OLD | NEW |