13
13
from utils import (
14
14
convert_braces_to_percents ,
15
15
convert_percents_to_braces ,
16
+ file_updated ,
16
17
get_percent_placeholders ,
17
18
parse_resx_filename ,
18
19
)
@@ -53,6 +54,9 @@ def process_po_files(project_path):
53
54
valid_po_files = []
54
55
errors = []
55
56
for file in project_path .glob ("*.po" ):
57
+ if not file_updated (file ):
58
+ logger .info (f"File { file .name } is not changed" )
59
+ continue
56
60
if not PO_FILE_REGEX .match (file .name ):
57
61
errors .append (f"PO file { file } have incorrect name." )
58
62
continue
@@ -125,6 +129,9 @@ def process_lng_files(project_path):
125
129
valid_lng_files = []
126
130
errors = []
127
131
for file in project_path .glob ("*.lng" ):
132
+ if not file_updated (file ):
133
+ logger .info (f"File { file .name } is not changed" )
134
+ return
128
135
if not LNG_FILE_REGEX .match (file .name ):
129
136
errors .append (f"lng file { file } have incorrect name." )
130
137
continue
@@ -218,10 +225,10 @@ def validate_placeholders(original_string, translated_string):
218
225
219
226
def generate_resx_files (project_path ):
220
227
logger .info ("Generating resx files" )
221
- resx_files = []
228
+ english_resx_files = []
222
229
for file in project_path .glob ("*.resx" ):
223
230
if parse_resx_filename (file .name )[1 ] is None :
224
- resx_files .append (file )
231
+ english_resx_files .append (file )
225
232
for lng_file in project_path .glob ("*.lng" ):
226
233
if lng_file .name == "english.lng" :
227
234
continue
@@ -233,7 +240,10 @@ def generate_resx_files(project_path):
233
240
# Let's not add this error again.
234
241
continue
235
242
errors = []
236
- for resx_file in resx_files :
243
+ lng_updated = file_updated (lng_file )
244
+ for resx_file in english_resx_files :
245
+ if not (lng_updated or file_updated (resx_file )):
246
+ continue
237
247
errors .extend (generate_resx_from_lng (lng , resx_file ))
238
248
if errors :
239
249
message_manager .add_list_message (
@@ -306,6 +316,10 @@ def convert_docs_po_to_md_file(po_file):
306
316
return [
307
317
f"Failed to find source file for { po_file } . File { source_md_file } not found."
308
318
]
319
+ if file_updated (po_file ):
320
+ logger .info ("Converting because the po file has changed" )
321
+ elif file_updated (source_md_file ):
322
+ logger .info ("Converting because the source file has changed" )
309
323
process = subprocess .Popen (
310
324
[
311
325
"po2md" ,
0 commit comments