Commit 9a4292d4 authored by Jakob Lerch's avatar Jakob Lerch
Browse files


parent 406fb2c1
import json
import time
from configparser import ConfigParser
from pathlib import Path
import requests
import utils
from pad import Etherpad, HedgedocNote, Pad
# TODO: scheint nur bei fem-instanz zu funktionieren. bei kackt das ab
# TODO: auch kompatibel mit deepl machen
# TODO: besseren algorithmus für die übersetzung ausdenken (working sets)
if __name__ == "__main__":
# read config
# api keys
api_keys = ConfigParser()"api_keys.conf")
# everything else
config = ConfigParser()"config.conf")
# create src pad
src_conf = config["source"]
src_pad: Pad
if src_conf["kind"] == "hedgedoc":
src_pad = HedgedocNote(src_conf["url"])
elif src_conf["kind"] == "etherpad":
src_pad = Etherpad(
src_conf["url"], api_keys["default"]["etherpad_key"])
raise ValueError("config.conf: 'kind' in [source] is not valid")
src_lang = src_conf["language"]
# create dst pad
# ..other than etherpad is not supported as destination yet
dst_conf = config["destination"]
dst_pad = Etherpad(dst_conf["url"], api_keys["default"]["etherpad_key"])
dst_lang = dst_conf["language"]
# do translation
# ..initial translation
src_lang=src_lang, dst_lang=dst_lang, api_key=api_keys["default"]["libretranslate_key"]))
# ..further translation
while True:
# TODO: think of algorithm / try naiv method, if this works, do it
), src_lang=src_lang, dst_lang=dst_lang, api_key=api_keys["default"]["libretranslate_key"]))
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment