@@ -275,7 +275,7 @@ def strip_header(po_file):
275
275
out_file = ""
276
276
if not os .path .isfile (po_file ):
277
277
return out_file
278
- with open (po_file , "r" ) as in_file :
278
+ with open (po_file , "r" , encoding = "utf-8" ) as in_file :
279
279
for line in in_file :
280
280
if not header :
281
281
out_file += line
@@ -289,8 +289,8 @@ def aggregate_pot():
289
289
Aggregate the template files for all addons into a single file without
290
290
strings that are already present in core Gramps.
291
291
"""
292
- args = [ "touch" , " po/template.pot"]
293
- call ( args )
292
+ f = open ( " po/template.pot", "w" )
293
+ f . close ( )
294
294
295
295
args = ["xgettext" , "-j" , "-o" , "po/template.pot" ]
296
296
args .extend (glob .glob ("*/po/template.pot" ))
@@ -514,7 +514,9 @@ def register(ptype, **kwargs):
514
514
f'"{ addon } /po/{ locale } -local.po" '
515
515
)
516
516
# Get all of the addon strings out of the catalog:
517
- system (f"touch { addon } /po/{ locale } -temp.po" )
517
+ f = open (f"{ addon } /po/{ locale } -temp.po" , "w" )
518
+ f .close ()
519
+
518
520
system (
519
521
f"msggrep --location={ addon } /* "
520
522
f'"{ addon } /po/{ locale } -global.po" '
@@ -574,9 +576,14 @@ def register(ptype, **kwargs):
574
576
575
577
languages = get_all_languages ()
576
578
listings = {lang : [] for lang in languages }
577
- dirs = [
578
- file for file in glob .glob ("*" ) if os .path .isdir (file ) and file != "__pycache__"
579
- ]
579
+ if len (sys .argv ) == 3 or addon == "all" :
580
+ dirs = [
581
+ file
582
+ for file in glob .glob ("*" )
583
+ if os .path .isdir (file ) and file != "__pycache__"
584
+ ]
585
+ else :
586
+ dirs = [addon ]
580
587
for addon in sorted (dirs ):
581
588
todo = False
582
589
for po in glob .glob (f"{ addon } /po/*-local.po" ):
0 commit comments