Original issue reported: #2208679: All Translators (auto created) (unsupported)

After investigation it turned out that in case of auth failure we only log the error but nothing gets displayed to UI. That leaves an impression that either bing cannot translate the language pair or there is a bug at the client side. This problem should be addressed on both the job checkout page as well as the translator settings page where it tries to get available target languages.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

miro_dietiker’s picture

Priority: Normal » Major

Pushing to major as it's a severe usability issue.
People always had problems to get the credentials right.
Validation is critical.

blueminds’s picture

Also see https://drupal.org/comment/8553545#comment-8553545 and below. The API key is causing also some confusion (including in my case). Maybe getting rid of it?

Berdir’s picture

Yes, but we decided to leave it originally because it still worked for existing clients. Probably no longer the case.

Anybody’s picture

Priority: Major » Normal

I can confirm that the old method does not work anymore. It should be removed with the next release and these problems could be fixed though. It would be good to output a note using hook_update() :)

Anybody’s picture

Could the maintainer have a look at this perhaps and fix it in the .dev release?
This bug makes the module hard to use for new users currently!

edurenye’s picture

In this issue we can do both validations, the api-key and the remote langcode (https://www.drupal.org/node/2256959#comment-10331205).

edurenye’s picture

Status: Active » Needs review
FileSize
802 bytes
3.35 KB

Done both validations for api key and for languages.
Added tests for not valid api key.
Tested manually language validation as it needs a valid api key to be tested.

The last submitted patch, 7: authentication_error_to-2211889-7-test_only.patch, failed testing.

Status: Needs review » Needs work

The last submitted patch, 7: authentication_error_to-2211889-7.patch, failed testing.

edurenye’s picture

Sorry, I thought that this issue was for D8, should I open a new issue for D8 or change this issue to D8?

edurenye’s picture

Version: 7.x-1.x-dev » 8.x-1.x-dev

Changed to D8

edurenye’s picture

Apply the last api changes and added tests using the mock.

The last submitted patch, 12: authentication_error_to-2211889-12-test_only.patch, failed testing.

The last submitted patch, 12: authentication_error_to-2211889-12-test_only.patch, failed testing.

Berdir’s picture

+++ b/src/MicrosoftTranslatorUi.php
@@ -30,11 +34,42 @@ class MicrosoftTranslatorUi extends TranslatorPluginUiBase {
+    $translator = $form_state->getFormObject()->getEntity();
+    $supported_remote_languages = $entity = $translator->getPlugin()->getSupportedRemoteLanguages($translator);
+    if (!empty($supported_remote_languages)) {
+      foreach ($form_state->getValue('remote_languages_mappings') as $local_language => $remote_language) {
+        // Empty targets are unsupported languages.
+        if ($remote_language == '') {
+          continue;
+        }
 
-    return parent::pluginSettingsForm($form, $form_state, $translator);

This comment isn't really correct, they're not unsupported, they're just not mapped.

Also ,this logic doesn't seem to belong here, it's not specific to Microsoft translator, we could do this for all translators that support remote mappings?

The second part is tricky then, of course, if we remove the first part.

edurenye’s picture

So we might move the logic to the parent then? Should I do it here #2256959: Validate language mapping selection?

edurenye’s picture

I discussed this with @Berdir, we are going to move the mapping validation to the TranslatorForm in the issue #2256959: Validate language mapping selection
So here is the patch with just the validaton of the client id and client secret and the changes in the API.

juanse254’s picture

Status: Needs review » Needs work
+++ b/src/MicrosoftTranslatorUi.php
@@ -30,11 +34,30 @@ class MicrosoftTranslatorUi extends TranslatorPluginUiBase {
+    $supported_remote_languages = $entity = $translator->getPlugin()->getSupportedRemoteLanguages($translator);

This is not right.

edurenye’s picture

Done.

edurenye’s picture

edurenye’s picture

The last was wrong, this is the good way.

Berdir’s picture

Version: 8.x-1.x-dev » 7.x-1.x-dev
Status: Needs review » Patch (to be ported)

Ok, committed.

  • Berdir committed ad0ec7b on 8.x-1.x authored by edurenye
    Issue #2211889 by edurenye: Authentication error to bing service dies...
miro_dietiker’s picture

Yay! We start to have real setting validations! :-)