Closed max14354 closed 1 year ago
I supposed the reason was that I downloaded from the releases tab instead of cloning the github.
Yes, the released packages have the source code compiled into an executable file. Maybe I'll add some kind of extension system supporting installing scripts from external sources in the future.
For anyone who is interested, a workaround for this is to run Ballon with translation turned off and use your program to edit the project.json, extracting the text, translate it and send it back to the .json.
Example:
import requests
import json
def send_message_to_server(content, message):
url = "http://localhost/"
headers = {'Content-Type': 'application/json'}
data = {'content': content, 'message': message}
response = requests.post(url, headers=headers, data=json.dumps(data))
response_json = response.json()
print(response_json)
return response_json
with open('imgtrans_manga.json', 'r', encoding= "UTF-8") as f:
data = json.load(f)
for page in data["pages"]:
for textnumber in range(len(data["pages"][page])):
data["pages"][page][textnumber]["translation"] = send_message_to_server(data["pages"][page][textnumber]["text"], "translate sentences").upper()
with open("imgtrans_manga.json", "w") as json_file:
json.dump(data, json_file)
I tried to follow #39 instructions and the provided guide but I can't seem to find the file where the translators are defined or its equivalent classes. I supposed the reason was that I downloaded from the releases tab instead of cloning the github.
My question is if its possible to setup a custom translator in my case and where should I define it. Specifically its a simple request to a local server that will return the translated text.
Thanks in advance, this tool is truly extraordinary