Adapter/ShopwareAdapter/DataPersister/Translation/TranslationDataPersister.php
public function writeProductTranslations(Product $product)
    {
        $productIdentity = $this->identityService->findOneBy([
            'objectIdentifier' => $product->getIdentifier(),
            'objectType' => Product::TYPE,
            'adapterName' => ShopwareAdapter::NAME,
        ]);

        if (null === $productIdentity) {
            return;
        }

        foreach ($this->translationHelper->getLanguageIdentifiers($product) as $languageIdentifier) {
            /**
             * @var Product $translatedProduct
             */
            $translatedProduct = $this->translationHelper->translate($languageIdentifier, $product);

            $languageIdentity = $this->identityService->findOneBy([
                'objectIdentifier' => $languageIdentifier,
                'objectType' => Language::TYPE,
                'adapterName' => ShopwareAdapter::NAME,
            ]);

            if (null === $languageIdentity) {
                $this->logger->notice('language not mapped - ' . $languageIdentifier);

                continue;
            }

            $translation = [
                'name' => $translatedProduct->getName(),
                'description' => $translatedProduct->getDescription(),
                'descriptionLong' => $translatedProduct->getLongDescription(),
                'metaTitle' => $translatedProduct->getMetaTitle(),
                'metaDescription' => $translatedProduct->getMetaDescription(),
                'keywords' => $translatedProduct->getMetaKeywords(),
            ];

            foreach ($product->getAttributes() as $attribute) {
                /**
                 * @var Attribute $translatedAttribute
                 */
                $translatedAttribute = $this->translationHelper->translate($languageIdentifier, $attribute);

                $key = '__attribute_plenty_connector' . ucfirst($attribute->getKey());
                $attribute_key = strtolower(preg_replace('/[A-Z]/', '_\\0', lcfirst($key)));
                $translation[$attribute_key] = $translatedAttribute->getValue();
            }

            $this->writeTranslations(
                'article',
                (int) $productIdentity->getAdapterIdentifier(),
                $translation,
                $languageIdentity
            );
        }

        foreach ($product->getProperties() as $property) {
            $this->writeGroupTranslations($property, 'propertyoption');

            foreach ($property->getValues() as $value) {
                $this->writeValueTranslations($value, 'propertyvalue');
            }
        }

        foreach ($product->getVariantConfiguration() as $variantConfiguration) {
            $this->writeGroupTranslations($variantConfiguration, 'configuratorgroup');

            foreach ($variantConfiguration->getValues() as $value) {
                $this->writeValueTranslations($value, 'configuratoroption');
            }
        }

        foreach ($product->getImages() as $articleImage) {
            $this->writeMediaTranslations($articleImage, $productIdentity->getAdapterIdentifier());
        }
    }
public function writeProductTranslations(Product $product)
    {
        $productIdentity = $this->identityService->findOneBy([
            'objectIdentifier' => $product->getIdentifier(),
            'objectType' => Product::TYPE,
            'adapterName' => ShopwareAdapter::NAME,
        ]);

        if (null === $productIdentity) {
            return;
        }

        foreach ($this->translationHelper->getLanguageIdentifiers($product) as $languageIdentifier) {
            /**
             * @var Product $translatedProduct
             */
            $translatedProduct = $this->translationHelper->translate($languageIdentifier, $product);

            $languageIdentity = $this->identityService->findOneBy([
                'objectIdentifier' => $languageIdentifier,
                'objectType' => Language::TYPE,
                'adapterName' => ShopwareAdapter::NAME,
            ]);

            if (null === $languageIdentity) {
                $this->logger->notice('language not mapped - ' . $languageIdentifier);

                continue;
            }

            $translation = [
                'name' => $translatedProduct->getName(),
                'description' => $translatedProduct->getDescription(),
                'descriptionLong' => $translatedProduct->getLongDescription(),
                'metaTitle' => $translatedProduct->getMetaTitle(),
                'metaDescription' => $translatedProduct->getMetaDescription(),
                'keywords' => $translatedProduct->getMetaKeywords(),
            ];

            foreach ($product->getAttributes() as $attribute) {
                /**
                 * @var Attribute $translatedAttribute
                 */
                $translatedAttribute = $this->translationHelper->translate($languageIdentifier, $attribute);

                $key = '__attribute_plenty_connector' . ucfirst($attribute->getKey());
                $attribute_key = strtolower(preg_replace('/[A-Z]/', '_\\0', lcfirst($key)));
                $translation[$attribute_key] = $translatedAttribute->getValue();
            }

            $this->writeTranslations(
                'article',
                (int) $productIdentity->getAdapterIdentifier(),
                $translation,
                $languageIdentity
            );
        }

        foreach ($product->getProperties() as $property) {
            $this->writeGroupTranslations($property, 'propertyoption');

            foreach ($property->getValues() as $value) {
                $this->writeValueTranslations($value, 'propertyvalue');
            }
        }

        foreach ($product->getVariantConfiguration() as $variantConfiguration) {
            $this->writeGroupTranslations($variantConfiguration, 'configuratorgroup');

            foreach ($variantConfiguration->getValues() as $value) {
                $this->writeValueTranslations($value, 'configuratoroption');
            }
        }

        foreach ($product->getImages() as $articleImage) {
            $this->writeMediaTranslations($articleImage, $productIdentity->getAdapterIdentifier());
        }
    }
{@inheritdoc}