OzzyCzech / potrans

Command line tool for translate Gettext with Google Translator API or DeepL API
MIT License
90 stars 30 forks source link

Allow using non-free DeepL api endpoint [bug] #15

Closed AndreiMiculita closed 1 year ago

AndreiMiculita commented 1 year ago

The endpoint used for DeepL Pro is different from the one used for free accounts.

i.e. instead of https://github.com/OzzyCzech/potrans/blob/f1d1a1e2f1e2d4409461d42f41bc7f9980a6a902/src/commands/DeepLTranslatorCommand.php#L87 it should be https://api.deepl.com/v2/translate

Currently, trying to use the free endpoint with an authentication key for a pro account results in an error (which unfortunately causes potrans to fail silently and generate all translations in the from language).

There should be a flag to choose which endpoint to use, or even have potrans automatically change endpoints if one of them fails.

OzzyCzech commented 1 year ago

Hi Andrej,

there is a new version (not released) please check

https://github.com/OzzyCzech/potrans/commit/970f6d8a8db02e25ff226569fef8de38eb56f7a5

I am just rewrited deepl command to official PHP DeepL client that client should autodetect API url based on user account. That should help you.

Let mi know, if that's help

AndreiMiculita commented 1 year ago

Yes, thank you, that should fix it! Feel free to close this issue then.