-
Notifications
You must be signed in to change notification settings - Fork 0
/
translate.py
executable file
·38 lines (35 loc) · 1.3 KB
/
translate.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
"""start using diff tool"""
import os
from argparse import ArgumentParser
from src import diff
if __name__ == '__main__':
parser = ArgumentParser(description='Add missing translations in destination-file.')
parser.add_argument(
'--diff',
default=False,
action='store_true',
help='Find different keyvalues and select the correct one manually.')
parser.add_argument(
'--auto',
default=False,
action='store_true',
help='In automode additional keys will automatically be added.')
parser.add_argument(
'src_file', metavar='src_file', type=str,
help='Specify a source file where all translations exists.')
parser.add_argument(
'dst_file', metavar='dst_file', type=str,
help='Specify a destination file where translations are missing.')
parser.add_argument(
'--out', type=str,
default='./data/out/outfile.json',
help='Specify the destination the new file should be written.')
ARGS = parser.parse_args()
DIRNAME = os.path.dirname(__file__)
DIFF = diff.Diff(ARGS.src_file, ARGS.dst_file, ARGS.out)
DIFF.display_count_keys_not_in_dst()
if ARGS.diff:
DIFF.compare_keys()
else:
DIFF.add_missing_keys(ARGS.auto)
DIFF.write_file(os.path.join(DIRNAME))