Publisher does not support the Fluid field type. Please do not contact asking when support will be available.

If you purchased an add-on from expressionengine.com, be sure to visit boldminded.com/claim to add the license to your account here on boldminded.com.

Ticket: Publisher allows use of language codes that crash DeepL ...

Status Resolved
Add-on / Version Publisher 3.7.4
Severity
EE Version 6.3.5

Gavin @ JCOGS

Sep 26, 2022

Currently it is possible to enter a language code into Publisher that will crash DeepL’s Auto-Translate if used.

For example, set up a language PT and then enable AutoTranslate and you get this exception error from DeepL

DeepL\DeepLException Caught
targetLang="pt" is deprecated, please use "pt-PT" or "pt-BR" instead.

user/addons/publisher/vendor/deeplcom/deepl-php/src/Translator.php:356
Stack Trace: Please include when reporting this error

You need to add a cross-check that the Publisher language code being used appears in the DeepL listing of available target languages before submitting an API request - there is a simple listing utility for this in WebAPI so presumably also in php API.

#1

BoldMinded (Brian)

Yeah, I did this for EN, missed that this applies to PT too. I’ll send you an update in a bit.

#2

BoldMinded (Brian)

Comment has been marked private.

#3

Gavin @ JCOGS

Ace - test build is better. One question though - if you enter PT for the language is it defaulting to PT-PT for the translation? Good if it is, just need to check (as client wants both PT-PT and PT-BR versions eventually, would be useful to know if Publisher sees PT-PT and PT as ‘different’ languages (and so will require two lots of translation).

#4

BoldMinded (Brian)

Yes, they’re different. If you want pt and pt-br, you’ll need to create a different language. It’s up to you if you want the default Portuguese to be pt or pt-pt.

#5

Gavin @ JCOGS

So I set the default PT language code by setting the language code associated with the “Portuguese” language setting in Publisher to pt rather than pt-pt?

#6

BoldMinded (Brian)

It’s up to you, it can be either or. I added a check in Publisher so if you use the short language code of “pt” it’ll convert it to “pt-pt” when making the request to DeepL.

#7

Gavin @ JCOGS

Bril - thanks for the clarification.

Login to reply