-
Notifications
You must be signed in to change notification settings - Fork 8
Introduce AUTO as a valid source language #7
Conversation
deeplator/translator.py
Outdated
@@ -3,7 +3,8 @@ | |||
from .jsonrpc import JSONRPCBuilder | |||
|
|||
POST_URL = "https://www2.deepl.com/jsonrpc" | |||
VALID_LANGS = ["EN", "DE", "FR", "ES", "IT", "NL", "PL"] | |||
SOURCE_LANGS = ["AUTO", "EN", "DE", "FR", "ES", "IT", "NL", "PL"] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd like the language codes to be index independent for better readability. I think for now it's sufficient to define a AUTO_LANG = "AUTO"
and set SOURCE_LANGS = TARGET_LANGS + [AUTO_LANG]
.
deeplator/translator.py
Outdated
@@ -3,7 +3,8 @@ | |||
from .jsonrpc import JSONRPCBuilder | |||
|
|||
POST_URL = "https://www2.deepl.com/jsonrpc" | |||
VALID_LANGS = ["EN", "DE", "FR", "ES", "IT", "NL", "PL"] | |||
SOURCE_LANGS = ["AUTO", "EN", "DE", "FR", "ES", "IT", "NL", "PL"] | |||
TARGET_LANGS = SOURCE_LANGS[1:] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TARGET_LANGS
can be defined like the old VALID_LANGS
then.
deeplator/translator.py
Outdated
} | ||
if self.src_lang != SOURCE_LANGS[0]: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here we can use AUTO_LANG
instead to get rid of the index.
deeplator/translator.py
Outdated
"target_lang": self.dst_lang | ||
} | ||
} | ||
if self.src_lang != SOURCE_LANGS[0]: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here we should use AUTO_LANG
, too.
It should be fixed now. |
This is my own take at fixing #2.