mirror of
https://github.com/HIllya51/LunaTranslator.git
synced 2025-01-13 15:43:53 +08:00
.
This commit is contained in:
parent
cc13b92d27
commit
0019d6e7d8
@ -27,7 +27,10 @@ class TS(basetrans):
|
|||||||
return
|
return
|
||||||
with open(pp, "r", encoding="utf8") as f:
|
with open(pp, "r", encoding="utf8") as f:
|
||||||
try:
|
try:
|
||||||
self.json.update(json.load(f))
|
for k, v in json.load(f).items():
|
||||||
|
if k not in self.json:
|
||||||
|
self.json[k] = []
|
||||||
|
self.json[k].append(v)
|
||||||
except:
|
except:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
@ -47,7 +50,7 @@ class TS(basetrans):
|
|||||||
self.unsafegetcurrentgameconfig(), tuple(self.config["jsonfile"])
|
self.unsafegetcurrentgameconfig(), tuple(self.config["jsonfile"])
|
||||||
)
|
)
|
||||||
|
|
||||||
def analyze_result(self, obj):
|
def analyze_result__(self, obj):
|
||||||
if type(obj) == str:
|
if type(obj) == str:
|
||||||
return obj
|
return obj
|
||||||
if type(obj) != dict:
|
if type(obj) != dict:
|
||||||
@ -63,6 +66,14 @@ class TS(basetrans):
|
|||||||
|
|
||||||
return None
|
return None
|
||||||
|
|
||||||
|
def analyze_result(self, obj):
|
||||||
|
_x = []
|
||||||
|
for _ in obj:
|
||||||
|
__ = self.analyze_result__(_)
|
||||||
|
if __:
|
||||||
|
_x.append(__)
|
||||||
|
return _x
|
||||||
|
|
||||||
def delayloadlines(self):
|
def delayloadlines(self):
|
||||||
if self.lines is not None:
|
if self.lines is not None:
|
||||||
return
|
return
|
||||||
@ -110,8 +121,8 @@ class TS(basetrans):
|
|||||||
line = self.tryfindtranslate(line, self.json, self.lines)
|
line = self.tryfindtranslate(line, self.json, self.lines)
|
||||||
if not line:
|
if not line:
|
||||||
return None
|
return None
|
||||||
collect.append(line)
|
collect.append("\n".join(line))
|
||||||
return "\n".join(collect)
|
return collect
|
||||||
|
|
||||||
def translate(self, content):
|
def translate(self, content):
|
||||||
self.checkfilechanged(
|
self.checkfilechanged(
|
||||||
@ -122,4 +133,4 @@ class TS(basetrans):
|
|||||||
res = self.tryfindtranslate_single(content)
|
res = self.tryfindtranslate_single(content)
|
||||||
if not res:
|
if not res:
|
||||||
raise Exception("can't find: " + content)
|
raise Exception("can't find: " + content)
|
||||||
return res
|
return "\n".join(res)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user