Make more messages translatable

This commit is contained in:
Chris Mayo 2022-11-08 19:21:29 +00:00
parent 55c13f0834
commit fd6c960ace
5 changed files with 7 additions and 7 deletions

View file

@ -74,7 +74,7 @@ def get_link_pat(arg, strict=False):
@rtype: dict
@raises: re.error on invalid regular expressions
"""
log.debug(LOG_CHECK, "Link pattern %r strict=%s", arg, strict)
log.debug(LOG_CHECK, _("Link pattern %r strict=%s"), arg, strict)
if arg.startswith('!'):
pattern = arg[1:]
negate = True
@ -84,7 +84,7 @@ def get_link_pat(arg, strict=False):
try:
regex = re.compile(pattern)
except re.error as msg:
log.warn(LOG_CHECK, "invalid regular expression %r: %s" % (pattern, msg))
log.warn(LOG_CHECK, _("invalid regular expression %r: %s"), pattern, msg)
raise
return {
"pattern": regex,

View file

@ -212,7 +212,7 @@ def checkform(form, env):
locale.setlocale(locale.LC_ALL, localestr)
init_i18n()
except locale.Error as errmsg:
log(env, "could not set locale %r: %s" % (localestr, errmsg))
log(env, _("could not set locale %r: %s") % (localestr, errmsg))
else:
raise LCFormError(_("unsupported language %r") % lang)
# check url syntax

View file

@ -37,7 +37,7 @@ def get_package_modules(packagename, packagepath):
name = "..%s.%s" % (packagename, mod.name)
yield importlib.import_module(name, __name__)
except ImportError as msg:
print("WARN: could not load module %s: %s" % (mod.name, msg))
print(_("WARN: could not load module %s: %s") % (mod.name, msg))
def get_folder_modules(folder, parentpackage):
@ -54,7 +54,7 @@ def get_folder_modules(folder, parentpackage):
spec.loader.exec_module(module)
yield module
except ImportError as msg:
print("WARN: could not load file %s: %s" % (fullname, msg))
print(_("WARN: could not load file %s: %s") % (fullname, msg))
def get_importable_files(folder):

View file

@ -85,7 +85,7 @@ class MarkdownCheck(_ContentPlugin):
try:
self.filename_re = re.compile(pattern)
except re.error as msg:
log.warn(LOG_PLUGIN, "Invalid regex pattern %r: %s" % (pattern, msg))
log.warn(LOG_PLUGIN, _("Invalid regex pattern %r: %s"), pattern, msg)
@classmethod
def read_config(cls, configparser):

View file

@ -42,7 +42,7 @@ class RegexCheck(_ContentPlugin):
try:
self.warningregex = re.compile(pattern)
except re.error as msg:
log.warn(LOG_PLUGIN, "Invalid regex pattern %r: %s" % (pattern, msg))
log.warn(LOG_PLUGIN, _("Invalid regex pattern %r: %s"), pattern, msg)
def applies_to(self, url_data):
"""Check for warningregex, extern flag and parseability."""