|
1 | | -# -*- coding: utf-8 -*- |
2 | | - |
3 | 1 | import os |
4 | 2 | from glob import glob |
5 | 3 |
|
@@ -53,23 +51,23 @@ def update(locale_dir, pot_dir, languages, line_width=76, ignore_obsolete=False) |
53 | 51 | cat_pot = c.load_po(pot_file) |
54 | 52 | if os.path.exists(po_file): |
55 | 53 | cat = c.load_po(po_file) |
56 | | - msgids = set([m.id for m in cat if m.id]) |
| 54 | + msgids = {m.id for m in cat if m.id} |
57 | 55 | c.update_with_fuzzy(cat, cat_pot) |
58 | | - new_msgids = set([m.id for m in cat if m.id]) |
| 56 | + new_msgids = {m.id for m in cat if m.id} |
59 | 57 | if msgids != new_msgids: |
60 | 58 | added = new_msgids - msgids |
61 | 59 | deleted = msgids - new_msgids |
62 | 60 | status['update'] += 1 |
63 | | - click.echo('Update: {0} +{1}, -{2}'.format( |
| 61 | + click.echo('Update: {} +{}, -{}'.format( |
64 | 62 | po_file, len(added), len(deleted))) |
65 | 63 | c.dump_po(po_file, cat, width=line_width, |
66 | 64 | ignore_obsolete=ignore_obsolete) |
67 | 65 | else: |
68 | 66 | status['notchanged'] += 1 |
69 | | - click.echo('Not Changed: {0}'.format(po_file)) |
| 67 | + click.echo(f'Not Changed: {po_file}') |
70 | 68 | else: # new po file |
71 | 69 | status['create'] += 1 |
72 | | - click.echo('Create: {0}'.format(po_file)) |
| 70 | + click.echo(f'Create: {po_file}') |
73 | 71 | cat_pot.locale = lang |
74 | 72 | c.dump_po(po_file, cat_pot, width=line_width, |
75 | 73 | ignore_obsolete=ignore_obsolete) |
@@ -102,7 +100,7 @@ def build(locale_dir, output_dir, languages): |
102 | 100 | if (os.path.exists(mo_file) and |
103 | 101 | os.path.getmtime(mo_file) > os.path.getmtime(po_file)): |
104 | 102 | continue |
105 | | - click.echo('Build: {0}'.format(mo_file)) |
| 103 | + click.echo(f'Build: {mo_file}') |
106 | 104 | cat = c.load_po(po_file) |
107 | 105 | c.write_mo(mo_file, cat) |
108 | 106 |
|
@@ -134,7 +132,7 @@ def stat(locale_dir, languages): |
134 | 132 | 'untranslated': len(c.untranslated_entries(cat)), |
135 | 133 | } |
136 | 134 | click.echo( |
137 | | - '{0}: {1} translated, {2} fuzzy, {3} untranslated.'.format( |
| 135 | + '{}: {} translated, {} fuzzy, {} untranslated.'.format( |
138 | 136 | po_file, |
139 | 137 | r['translated'], |
140 | 138 | r['fuzzy'], |
|
0 commit comments