|
7 | 7 | p = Path(r'.').glob('**/*.po')
|
8 | 8 | pofiles = list(p)
|
9 | 9 |
|
10 |
| -translators_credits_list = [] |
| 10 | +translators_credits_set = set() |
11 | 11 |
|
12 | 12 | # Exclude bot account, duplicated entry and hashes for deleted accounts
|
13 | 13 | ignore_entries = [
|
|
37 | 37 | # if true, we are in the translator credits block; extract info
|
38 | 38 | if is_translator_credits:
|
39 | 39 | # remove leading sharp sign, and trailing comma and year
|
40 |
| - line = line.strip('# ') |
| 40 | + line = line.strip('# ') |
41 | 41 | line = line[:-7]
|
42 | 42 |
|
43 | 43 | # Skip entries we do not want to add
|
44 | 44 | if line in ignore_entries:
|
45 | 45 | continue
|
46 | 46 |
|
47 | 47 | # Add entry to the set
|
48 |
| - if line not in translators_credits_list: |
49 |
| - translators_credits_list.append(line) |
| 48 | + translators_credits_set.add(line) |
50 | 49 |
|
51 | 50 | # if true, this is the start of the translation credits block;
|
52 |
| - # flag is_translator_credits and go to the next line |
| 51 | + # flag is_translator_credits and go to the next line |
53 | 52 | if line == '# Translators:\n':
|
54 | 53 | is_translator_credits = True
|
55 | 54 | continue
|
|
61 | 60 | if line == 'msgid "':
|
62 | 61 | break
|
63 | 62 |
|
64 |
| -# Remove parentheses that messes the reorder of the list. |
65 |
| -edit_index = translators_credits_list.index('(Douglas da Silva) <dementikovalev@yandex.ru>') |
66 |
| -translators_credits_list[edit_index] = 'Douglas da Silva <dementikovalev@yandex.ru>' |
67 |
| - |
68 |
| -# Reordered in a case-insensitive way as some names were set lowercase |
69 |
| -translators_credits_list_reordered = sorted(translators_credits_list, key=str.casefold) |
| 63 | +# Remove parentheses that messes the alphabeticall order. |
| 64 | +translators_credits_set.remove('(Douglas da Silva) <dementikovalev@yandex.ru>') |
| 65 | +translators_credits_set.add('Douglas da Silva <dementikovalev@yandex.ru>') |
70 | 66 |
|
71 | 67 | # Print the resulting list to the standard output
|
72 |
| -for t in translators_credits_list_reordered: |
| 68 | +for t in sorted(translators_credits_set): |
73 | 69 | print(t)
|
0 commit comments