]> git.ipfire.org Git - thirdparty/babel.git/commitdiff
frontend: Add omit-header to update_catalog
authorCédric Krier <ced@b2ck.com>
Fri, 1 Mar 2019 08:43:00 +0000 (09:43 +0100)
committerAarni Koskela <akx@iki.fi>
Fri, 1 Mar 2019 10:59:12 +0000 (12:59 +0200)
It is the same option as in extract_message but for when updating the
catalog.

babel/messages/frontend.py

index 9213cca41453a75abac1d29fe70605741d005eab..f673f900ccebef99657238d58c12b815491b26e1 100644 (file)
@@ -647,6 +647,8 @@ class update_catalog(Command):
         ('output-file=', 'o',
          "name of the output file (default "
          "'<output_dir>/<locale>/LC_MESSAGES/<domain>.po')"),
+        ('omit-header', None,
+         "do not include msgid "" entry in header"),
         ('locale=', 'l',
          'locale of the catalog to compile'),
         ('width=', 'w',
@@ -661,15 +663,19 @@ class update_catalog(Command):
         ('update-header-comment', None,
          'update target header comment'),
         ('previous', None,
-         'keep previous msgids of translated messages')
+         'keep previous msgids of translated messages'),
+    ]
+    boolean_options = [
+        'omit-header', 'no-wrap', 'ignore-obsolete', 'no-fuzzy-matching',
+        'previous', 'update-header-comment',
     ]
-    boolean_options = ['no-wrap', 'ignore-obsolete', 'no-fuzzy-matching', 'previous', 'update-header-comment']
 
     def initialize_options(self):
         self.domain = 'messages'
         self.input_file = None
         self.output_dir = None
         self.output_file = None
+        self.omit_header = False
         self.locale = None
         self.width = None
         self.no_wrap = False
@@ -740,6 +746,7 @@ class update_catalog(Command):
             try:
                 with open(tmpname, 'wb') as tmpfile:
                     write_po(tmpfile, catalog,
+                             omit_header=self.omit_header,
                              ignore_obsolete=self.ignore_obsolete,
                              include_previous=self.previous, width=self.width)
             except: