|
6 | 6 | from subprocess import call
|
7 | 7 |
|
8 | 8 |
|
9 |
| -def merge(translationdirectory: str) -> None: |
| 9 | +def merge(translationdirectory: str, language: str) -> None: |
10 | 10 | for dirpath, dirnames, filenames in walk(Path(translationdirectory)):
|
11 | 11 | for filename in filenames:
|
12 | 12 | if filename.endswith(".po"):
|
13 | 13 | directory = Path(dirpath)
|
14 |
| - set = directory.name |
| 14 | + parent = directory.name |
15 | 15 | source = directory / filename
|
16 |
| - potential_target = Path("pos/locale/python/pl") / source.name |
| 16 | + potential_target = Path("pos/locale/python") / language / source.name |
17 | 17 | if potential_target.exists():
|
18 | 18 | merge_po(potential_target, source)
|
19 | 19 | else:
|
20 |
| - potential_target = Path("pos/locale/python/pl") / f"{set}.po" |
| 20 | + potential_target = ( |
| 21 | + Path("pos/locale/python") / language / f"{parent}.po" |
| 22 | + ) |
21 | 23 | if potential_target.exists():
|
22 | 24 | merge_po(potential_target, source)
|
23 | 25 | else:
|
@@ -52,6 +54,7 @@ def merge_po(potential_target, source):
|
52 | 54 | if __name__ == "__main__":
|
53 | 55 | parser = ArgumentParser()
|
54 | 56 | parser.add_argument('translationdirectory')
|
| 57 | + parser.add_argument('language') |
55 | 58 | args = parser.parse_args()
|
56 | 59 |
|
57 |
| - merge(args.translationdirectory) |
| 60 | + merge(args.translationdirectory, args.language) |
0 commit comments