This is a multi-part message in MIME format. --nextPart1871947.CSlMmaOXsF Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" To compile po files with Lokalize i use the script msgfmt.py: http://websvn.kde.org/trunk/l10n-kde4/scripts/lokalize/msgfmt.py?view=log i added kdialog to be able to choose the output path and support for qt .ts files. I use Lokalize to translate ts files as it supports spell check which Qtlinguist doesn't I have only a problem with the auto complete with ts files, it doesn't work yet. I hope that the 'export to' feature will be integrated in some next version of Lokalize (i have the 1.5 with KDE 4.10.5) -- Dimitrios Glentadakis --nextPart1871947.CSlMmaOXsF Content-Disposition: attachment; filename="msgfmt.py" Content-Transfer-Encoding: 7Bit Content-Type: text/x-python; charset="UTF-8"; name="msgfmt.py" # -*- coding: utf-8 -*- import os import sys import subprocess import Editor import Project def _init(): global lang global package global currentFile global fileType currentFile = Editor.currentFile() fileType = currentFile[-2:] if not Editor.isValid() or currentFile == '': return lang = Project.targetLangCode() (path, pofilename) = os.path.split(Editor.currentFile()) (package, ext) = os.path.splitext(pofilename) currentFile = Editor.currentFile() if fileType == 'po': complilerPresent = cmd_exists('msgfmt') if complilerPresent: actions() else: os.system('kdialog --sorry \ "The command is not available.\nYou need to install the gettext package"') return if fileType == 'ts': complilerPresent = cmd_exists('lrelease') if complilerPresent: saveAs() else: os.system('kdialog --sorry \ "The command is not available.\nYou need to install the Qt4 development package"') return def cmd_exists(cmd): return subprocess.call("type " + cmd, shell=True, \ stdout=subprocess.PIPE, stderr=subprocess.PIPE) == 0 def doCompile(): flag = False targetPath = variables() totalPath = targetPath+package+'.mo' if os.path.exists(totalPath): flag = True os.system('kdialog --title "The file exists!" --warningcontinuecancel "Do you want to overwrite the file?"; \ ans=$`echo $?`; if [ "${ans:1}" -eq "0" ]; then msgfmt -o %s %s;fi' %(totalPath, currentFile)) if not os.path.exists(targetPath): os.system('mkdir -p {0}'.format(targetPath)) if not flag: os.system('msgfmt -o %s %s' %(totalPath, currentFile)) def saveAs(): if fileType == 'po': ext = '.mo' compiler = 'msgfmt -o' if fileType == 'ts': ext = '.qm' compiler = 'lrelease -qm' home = os.getenv('HOME') output_path = home + '/' + package + ext cmd = ['kdialog', '--getsavefilename', output_path] binPath = subprocess.Popen( cmd, stdout=subprocess.PIPE ).communicate()[0] if binPath != '': binPath = binPath.rstrip() if os.path.exists(binPath): os.system('kdialog --title "The file exists!" --warningcontinuecancel "Do you want to overwrite the file?"; \ ans=$`echo $?`; if [ "${ans:1}" -eq "0" ]; then %s %s %s;fi' %(compiler, binPath, currentFile)) else: os.system('{0} {1} {2}'.format(compiler, binPath, currentFile)) def variables(): cmd = ['kde4-config', '--localprefix'] output = subprocess.Popen( cmd, stdout=subprocess.PIPE ).communicate()[0] output = output.rstrip() kde4path = output + 'share/locale/{0}/LC_MESSAGES/'.format(lang) return kde4path def kdialogmenu(): choice = '' kde4path = variables() string = 'Export {0}.mo to default path:\n{1}\nor choose a custom path:'.format(package,kde4path) try: choice = subprocess.check_output(['kdialog', '--combobox', string, '--default', \ 'Default path', 'Default path', 'Custom path']) except: pass if choice != '': choice = str(choice) choice = choice.rstrip() else: print('Canceled') return choice def actions(): choice = kdialogmenu() if choice == '': return if choice == 'Default path': doCompile() if choice == 'Custom path': saveAs() _init() --nextPart1871947.CSlMmaOXsF--