mirror of
https://code.eliotberriot.com/funkwhale/funkwhale.git
synced 2025-10-04 06:29:18 +02:00
Resolve "i18n fixes for 0.20"
This commit is contained in:
parent
6cee546391
commit
2cdc8fa63a
79 changed files with 2960 additions and 8736 deletions
33
front/scripts/print-duplicates-source.py
Normal file
33
front/scripts/print-duplicates-source.py
Normal file
|
@ -0,0 +1,33 @@
|
|||
import argparse
|
||||
import collections
|
||||
import polib
|
||||
|
||||
|
||||
def print_duplicates(path):
|
||||
pofile = polib.pofile(path)
|
||||
|
||||
contexts_by_id = collections.defaultdict(list)
|
||||
for e in pofile:
|
||||
contexts_by_id[e.msgid].append(e.msgctxt)
|
||||
count = collections.Counter(
|
||||
[e.msgid for e in pofile]
|
||||
)
|
||||
duplicates = [
|
||||
(k, v) for k, v in count.items()
|
||||
if v > 1
|
||||
]
|
||||
for k, v in sorted(duplicates, key=lambda r: r[1], reverse=True):
|
||||
print('{} entries - {}:'.format(v, k))
|
||||
for ctx in contexts_by_id[k]:
|
||||
print(' - {}'.format(ctx))
|
||||
print()
|
||||
|
||||
total_duplicates = sum([v - 1 for _, v in duplicates])
|
||||
print('{} total duplicates'.format(total_duplicates))
|
||||
|
||||
if __name__ == "__main__":
|
||||
parser = argparse.ArgumentParser()
|
||||
parser.add_argument("po", help="Path of the po file to use as a source")
|
||||
args = parser.parse_args()
|
||||
|
||||
print_duplicates(path=args.po)
|
Loading…
Add table
Add a link
Reference in a new issue