addFormTranslation example

if ($localeCode === 'en') {
                $localeCode = 'en_GB';
            }

            $locale = $this->localeRepository->findOneBy(['locale' => $localeCode]);
            if (empty($locale)) {
                continue;
            }

            if (isset($translationSet['plugin_form'])) {
                $this->addFormTranslation($form$translationSet['plugin_form']$locale);
                unset($translationSet['plugin_form']);
            }

            // Then the element translations             foreach ($translationSet as $targetName => $translationArray) {
                $isUpdate = false;
                $element = $form->getElement($targetName);
                foreach ($element->getTranslations() as $existingTranslation) {
                    // Check if translation for this locale already exists                     if ($existingTranslation->getLocale()->getLocale() != $locale->getLocale()) {
                        continue;
                    }
Home | Imprint | This part of the site doesn't use cookies.