sitegeist / Sitegeist.LostInTranslation

Automatic Translations for Neos via DeeplApi
GNU General Public License v3.0
9 stars 9 forks source link

Error on demo site - when not defined source language en, only en_US and en_GB #2

Closed snoblucha closed 1 year ago

snoblucha commented 2 years ago

https://github.com/sitegeist/Sitegeist.LostInTranslation/blob/4b587e065ed50582041b5b7825368b3845602c3b/Classes/ContentRepository/NodeTranslationService.php#L68

Hi,

I faced an issue in demo site content. This does not work, because there is not configured language in plain format

 $sourceLanguage = explode('_', $node->getContext()->getTargetDimensions()[$this->languageDimensionName])[0]; 

then it fails on referenced line with

 Exception in line 68 of /var/www/html/Data/Temporary/Production/Cache/Code/Flow_Object_Classes/Sitegeist_LostInTranslation_ContentRepository_NodeTranslationService.php: array_key_exists() expects parameter 2 to be array, null given - See also: 202112162127168de9bc.txt

should be checking if the preset really exists.

if ($sourceLanguagePreset && array_key_exists('options', $sourceLanguagePreset) && array_key_exists('deeplLanguage', $sourceLanguage
            $sourceLanguage = $sourceLanguagePreset['options']['deeplLanguage'];
        }
mficzel commented 2 years ago

Can confirm the problem, we are working on a fix.

mficzel commented 2 years ago

@snoblucha This should be solved with 2.0.0 can you verify this?

mprofi commented 1 year ago

Yes we can confirm this. Thanks