15
15
convert_percents_to_braces ,
16
16
file_updated ,
17
17
get_percent_placeholders ,
18
+ git_add ,
18
19
parse_resx_filename ,
19
20
)
20
21
@@ -120,6 +121,7 @@ def convert_po_to_lng(*, project_path, english_lng, file, language_code, languag
120
121
)
121
122
with lng_file .open ("w" , encoding = "utf-8" , newline = "" ) as f :
122
123
json .dump (lng , f , ensure_ascii = False , indent = 2 , sort_keys = True )
124
+ git_add (lng_file )
123
125
logger .info (f"Po file converted to lng file { lng_file } ')" )
124
126
125
127
@@ -270,6 +272,7 @@ def generate_resx_from_lng(lng, source_resx_file):
270
272
value .text = convert_percents_to_braces (lng [identifier ])
271
273
with target_resx_file .open ("wb" ) as f :
272
274
f .write (ElementTree .tostring (root , encoding = "utf-8" ))
275
+ git_add (target_resx_file )
273
276
logger .info ("Resx file generated" )
274
277
return errors
275
278
@@ -312,6 +315,7 @@ def process_language_docs(docs_dir):
312
315
def convert_docs_po_to_md_file (po_file ):
313
316
logger .info (f"Converting docs po file { po_file } to md file" )
314
317
source_md_file = po_file .parent .parent / "en" / po_file .with_suffix (".md" ).name
318
+ target_md_file = po_file .with_suffix (".md" )
315
319
if not source_md_file .is_file ():
316
320
return [
317
321
f"Failed to find source file for { po_file } . File { source_md_file } not found."
@@ -330,7 +334,7 @@ def convert_docs_po_to_md_file(po_file):
330
334
"-p" ,
331
335
po_file ,
332
336
"-s" ,
333
- po_file . with_suffix ( ".md" ) ,
337
+ target_md_file ,
334
338
source_md_file ,
335
339
],
336
340
stdin = subprocess .DEVNULL ,
@@ -340,6 +344,7 @@ def convert_docs_po_to_md_file(po_file):
340
344
process .communicate (None , timeout = 10 )
341
345
if process .returncode != 0 :
342
346
raise RuntimeError (f"po2md failed with code { process .returncode } " )
347
+ git_add (target_md_file )
343
348
logger .info ("Po file converted to md" )
344
349
return []
345
350
0 commit comments