+
+def create_mo_files():
+ po_dir = 'po/'
+ if not os.path.exists(po_dir):
+ return []
+ domain = 'torbrowser-launcher'
+ mo_files = []
+ po_files = [f
+ for f in next(os.walk(po_dir))[2]
+ if os.path.splitext(f)[1] == '.po']
+ for po_file in po_files:
+ filename, extension = os.path.splitext(po_file)
+ mo_file = domain + '.mo'
+ mo_dir = 'share/locale/' + filename + '/LC_MESSAGES/'
+ subprocess.call('mkdir -p ' + mo_dir, shell=True)
+ msgfmt_cmd = 'msgfmt {} -o {}'.format(po_dir + po_file, mo_dir + mo_file)
+ subprocess.call(msgfmt_cmd, shell=True)
+ mo_files.append(mo_dir + mo_file)
+ return mo_files
+
+