Problem/Motivation

In #2860533: Support live preview we added support for the live preview and improved language pairs fetching to work with the given language code.

The problem appears when we try to fetch target languages for a non-existing/invalid (remote) source language code.
This becomes obvious on: admin/tmgmt/continuous_jobs/continuous_add where translator gets a request to fetch language pairs for the given invalid "und" language code.
Even though, Drupal\tmgmt\Entity\Translator::getSupportedTargetLanguages() tries to map a source language into a remote source language code, Drupal\tmgmt\Entity\Translator::mapToRemoteLanguage() works in a way to find a best possible remote language code. It means, returning the original language code in case there is no match.

Proposed resolution

Add a try/catch block into AcclaroTranslator::getLanguagePairs() and return an empty in case of invalid source language code.

Remaining tasks

User interface changes

API changes

Data model changes

CommentFileSizeAuthor
#2 handle_undefined-2861395-2.patch693 bytesmbovan
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

mbovan created an issue. See original summary.

mbovan’s picture

Assigned: mbovan » Berdir
Issue summary: View changes
Status: Active » Needs review
FileSize
693 bytes

Handling the case of invalid language code.

mbovan’s picture

Tested #2861444: Handle undefined language code when creating continuous jobs (#6) with Acclaro and I can confirm it fixes this issue.

Since we still have some "undefined" language cases in TMGMT, we might want to keep #2?

  • Berdir committed 984459e on 8.x-1.x authored by mbovan
    Issue #2861395 by mbovan: Handle undefined language code
    
Berdir’s picture

Status: Needs review » Fixed

Yeah, lets do that.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.