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
Comment | File | Size | Author |
---|---|---|---|
#2 | handle_undefined-2861395-2.patch | 693 bytes | mbovan |
Comments
Comment #2
mbovan CreditAttribution: mbovan at MD Systems GmbH commentedHandling the case of invalid language code.
Comment #3
mbovan CreditAttribution: mbovan at MD Systems GmbH commentedTested #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?
Comment #5
BerdirYeah, lets do that.