#!/usr/bin/env python
#updates po files to contain new strings
import os
import commands

try:
    os.unlink('untitled.pot')
    os.unlink('doc.pot')
except:
    pass
commands.getstatusoutput('intltool-update -p')
commands.getstatusoutput('xml2po -o doc.pot ../doc/startupmanager.xml')
commands.getstatusoutput('msgcat -o untitled.pot untitled.pot doc.pot')[1]
for name in os.listdir('.'):
    if name[-2:] == 'po':
        print commands.getstatusoutput('intltool-update -d ' + name[:-3])[1]
#        print commands.getstatusoutput('xml2po -u ' + name + ' ../doc/startupmanager.xml')[1]
commands.getstatusoutput('rm -rf doc.pot')
#os.chdir('doc/')
#try:
#    os.unlink('doc.pot')
#except:
#    pass
#commands.getstatusoutput('xml2po -o doc.pot ../../doc/startupmanager.xml')
#for name in os.listdir('.'):
#    if name[-2:] == 'po':
#        print commands.getstatusoutput('xml2po -u ' + name + ' ../../doc/startupmanager.xml')[1]

#os.chdir('../')

