Addon Manager: Translation cleanup

pylupdate does not extract translations when f-strings are used for the
translated text, so all f-strings are migrated to calls to format().
Several other minor translation issues are also addressed.

NOTE: This code has been run through the Black reformatter, which adds
trailing commas in many places that the stock Qt 5.x pylupdate does not
recognize. This code must be processed with the corrected pylupdate to
generate the correct translations.
This commit is contained in:
Chris Hennes
2022-01-27 23:11:31 -06:00
parent d1f30a9d9b
commit c62dc32739
7 changed files with 153 additions and 144 deletions

View File

@@ -24,7 +24,6 @@
import os
import re
import ctypes
import ssl
from typing import Union, Optional
import urllib
@@ -38,20 +37,6 @@ from PySide2 import QtCore, QtWidgets
import FreeCAD
import FreeCADGui
# check for SSL support
ssl_ctx = None
try:
import ssl
except ImportError:
pass
else:
try:
# ssl_ctx = ssl.create_default_context(cafile=certifi.where())
# ssl_ctx = ssl.create_default_context(ssl.Purpose.CLIENT_AUTH)
ssl_ctx = ssl.create_default_context(ssl.Purpose.SERVER_AUTH)
except AttributeError:
pass
# @package AddonManager_utilities
# \ingroup ADDONMANAGER
@@ -59,15 +44,7 @@ else:
# @{
def translate(context, text, disambig=None):
"Main translation function"
try:
_encoding = QtWidgets.QApplication.UnicodeUTF8
except AttributeError:
return QtWidgets.QApplication.translate(context, text, disambig)
else:
return QtWidgets.QApplication.translate(context, text, disambig, _encoding)
translate = FreeCAD.Qt.translate
def symlink(source, link_name):