mirror of
https://github.com/HIllya51/LunaTranslator.git
synced 2024-12-29 00:24:13 +08:00
issues/753
This commit is contained in:
parent
11f370042f
commit
16ea48eb7f
@ -109,6 +109,7 @@ class MAINUI:
|
|||||||
context = None
|
context = None
|
||||||
try:
|
try:
|
||||||
if method["object"].using:
|
if method["object"].using:
|
||||||
|
if 'process_before' in dir(method["object"]):
|
||||||
content, context = method["object"].process_before(content)
|
content, context = method["object"].process_before(content)
|
||||||
except:
|
except:
|
||||||
print_exc()
|
print_exc()
|
||||||
@ -121,6 +122,7 @@ class MAINUI:
|
|||||||
context = mp[i]
|
context = mp[i]
|
||||||
try:
|
try:
|
||||||
if method["object"].using:
|
if method["object"].using:
|
||||||
|
if 'process_after' in dir(method["object"]):
|
||||||
res = method["object"].process_after(res, context)
|
res = method["object"].process_after(res, context)
|
||||||
except:
|
except:
|
||||||
print_exc()
|
print_exc()
|
||||||
|
@ -524,6 +524,18 @@ def parsemayberegexreplace(dict, res):
|
|||||||
codecs.escape_decode(bytes(item["value"], "utf-8"))[0].decode("utf-8"),
|
codecs.escape_decode(bytes(item["value"], "utf-8"))[0].decode("utf-8"),
|
||||||
res,
|
res,
|
||||||
)
|
)
|
||||||
|
else:
|
||||||
|
if (
|
||||||
|
res.isascii()
|
||||||
|
and item["key"].isascii()
|
||||||
|
and item["value"].isascii()
|
||||||
|
and (" " not in item["key"])
|
||||||
|
): # 目标可能有空格
|
||||||
|
resx = res.split(" ")
|
||||||
|
for i in range(len(resx)):
|
||||||
|
if resx[i] == item["key"]:
|
||||||
|
resx[i] = item["value"]
|
||||||
|
res = " ".join(resx)
|
||||||
else:
|
else:
|
||||||
res = res.replace(item["key"], item["value"])
|
res = res.replace(item["key"], item["value"])
|
||||||
return res
|
return res
|
||||||
|
Loading…
x
Reference in New Issue
Block a user