Tools/updatets.py: clean up file formatting issues.

This commit is contained in:
Chris Hennes
2023-04-16 20:44:44 -05:00
parent 07a6c62aef
commit 8d2f98a780

View File

@@ -1,29 +1,27 @@
#!/usr/bin/python3
# -*- coding: utf-8 -*-
# (c) 2010 Werner Mayer LGPL
#***************************************************************************
#* *
#* Copyright (c) 2010 Werner Mayer <wmayer@users.sourceforge.net> *
#* *
#* This program is free software; you can redistribute it and/or modify *
#* it under the terms of the GNU Library General Public License (LGPL) *
#* as published by the Free Software Foundation; either version 2 of *
#* the License, or (at your option) any later version. *
#* for detail see the LICENCE text file. *
#* *
#* This program is distributed in the hope that it will be useful, *
#* but WITHOUT ANY WARRANTY; without even the implied warranty of *
#* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
#* GNU Library General Public License for more details. *
#* *
#* You should have received a copy of the GNU Library General Public *
#* License along with this program; if not, write to the Free Software *
#* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 *
#* USA *
#* *
#***************************************************************************
# SPDX-License-Identifier: LGPL-2.1-or-later
# ***************************************************************************
# * *
# * Copyright (c) 2010 Werner Mayer <wmayer@users.sourceforge.net> *
# * *
# * This file is part of FreeCAD. *
# * *
# * FreeCAD is free software: you can redistribute it and/or modify it *
# * under the terms of the GNU Lesser General Public License as *
# * published by the Free Software Foundation, either version 2.1 of the *
# * License, or (at your option) any later version. *
# * *
# * FreeCAD is distributed in the hope that it will be useful, but *
# * WITHOUT ANY WARRANTY; without even the implied warranty of *
# * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
# * Lesser General Public License for more details. *
# * *
# * You should have received a copy of the GNU Lesser General Public *
# * License along with FreeCAD. If not, see *
# * <https://www.gnu.org/licenses/>. *
# * *
# ***************************************************************************
# Changelog:
# 0.5 Add support for Qt 6 lupdate (which fixes MANY bugs and should be preferred)
@@ -60,7 +58,6 @@ directories = [
{"tsname":"FreeCAD", "workingdir":"./src/Gui", "tsdir":"Language"},
{"tsname":"AddonManager", "workingdir":"./src/Mod/AddonManager/", "tsdir":"Resources/translations"},
{"tsname":"Arch", "workingdir":"./src/Mod/Arch/", "tsdir":"Resources/translations"},
#{"tsname":"Assembly", "workingdir":"./src/Mod/Assembly/", "tsdir":"Gui/Resources/translations"},
{"tsname":"Draft", "workingdir":"./src/Mod/Draft/", "tsdir":"Resources/translations"},
{"tsname":"Drawing", "workingdir":"./src/Mod/Drawing/", "tsdir":"Gui/Resources/translations"},
{"tsname":"Fem", "workingdir":"./src/Mod/Fem/", "tsdir":"Gui/Resources/translations"},
@@ -215,16 +212,16 @@ def update_translation(entry):
file_list.write(os.path.join(root,f) + "\n")
try:
p = subprocess.run([LUPDATE, "@files_to_translate.txt","-I","./", "-recursive", "-no-sort", "-ts", f"{tsBasename}.ts"], capture_output=True, timeout=60)
p = subprocess.run([LUPDATE, "@files_to_translate.txt","-I","./", "-recursive", "-no-sort", "-ts", f"{tsBasename}.ts"], capture_output=True, timeout=60, encoding="utf-8")
except Exception as e:
print(str(e))
os.chdir(cur)
return
with open (f"{cur}/tsupdate_stdout.log","a") as f:
with open (f"{cur}/tsupdate_stdout.log", "a", encoding="utf-8") as f:
f.write(p.stdout.decode())
print(p.stdout.decode())
with open (f"{cur}/tsupdate_stderr.log","a") as f:
with open (f"{cur}/tsupdate_stderr.log", "a", encoding="utf-8") as f:
f.write(p.stderr.decode())
# Strip out obsolete strings, and make sure there are no translations in the main *.ts file