--- ../gnome-doc-utils/xml2po/xml2po.py	2005-07-23 13:23:18.000000000 +0100
+++ ./xml2po/xml2po.py	2006-03-27 15:32:38.109711000 +0100
@@ -528,6 +528,8 @@
             sys.exit(9)
         elif opt in ('-u', '--update-translation'):
             pass
+        elif opt in ('-d', '--desktop-file'):
+            command += " -d %s" % arg
         else:
             sys.stderr.write("Error: Option `%s' is not supported with option `-u'.\n" % (opt))
             sys.exit(9)
@@ -589,6 +591,7 @@
 expand_all_entities = 0
 
 output  = '-' # this means to stdout
+desktop_file = None
 
 NULL_STRING = '/dev/null'
 if not os.path.exists('/dev/null'): NULL_STRING = 'NUL'
@@ -613,6 +616,7 @@
     -u    --update-translation=LANG.po   Updates a PO file using msgmerge program
     -l    --language=LANG      Set language of the translation to LANG
     -v    --version            Output version of the xml2po program
+    -d    --desktop-file       .desktop file to use for menu substitution
 
     -h    --help               Output this message
 
@@ -631,9 +635,9 @@
 if len(sys.argv) < 2: usage()
 
 args = sys.argv[1:]
-try: opts, args = getopt.getopt(args, 'avhkem:t:o:p:u:r:l:',
+try: opts, args = getopt.getopt(args, 'avhkem:t:o:p:u:r:l:d:',
                            ['automatic-tags','version', 'help', 'keep-entities', 'expand-all-entities', 'mode=', 'translation=',
-                            'output=', 'po-file=', 'update-translation=', 'reuse=', 'language=' ])
+                            'output=', 'po-file=', 'update-translation=', 'reuse=', 'language=', 'desktop-file=' ])
 except getopt.GetoptError: usage(True)
 
 for opt, arg in opts:
@@ -666,6 +670,8 @@
     elif opt in ('-v', '--version'):
         print VERSION
         sys.exit(0)
+    elif opt in ('-d', '--desktop-file'):
+        desktop_file = arg
     elif opt in ('-h', '--help'):
     	usage(True)
 
@@ -748,4 +754,6 @@
         else:
             outtxt = ''
         CurrentXmlMode.postProcessXmlTranslation(doc, translationlanguage, outtxt)
+        if desktop_file:
+            CurrentXmlMode.processMenuPath(doc, desktop_file)
     out.write(doc.serialize('utf-8', 1))
