diff --git a/src/Form/Type/TranslatedEntityType.php b/src/Form/Type/TranslatedEntityType.php index 3dc27f5..2b6c716 100644 --- a/src/Form/Type/TranslatedEntityType.php +++ b/src/Form/Type/TranslatedEntityType.php @@ -2,11 +2,11 @@ namespace ObjectBG\TranslationBundle\Form\Type; +use Symfony\Bridge\Doctrine\Form\Type\EntityType; use Symfony\Component\Form\AbstractType; use Symfony\Component\HttpFoundation\RequestStack; use Symfony\Component\OptionsResolver\Options; use Symfony\Component\OptionsResolver\OptionsResolver; -use Symfony\Bridge\Doctrine\Form\Type\EntityType; /** * Translated entity @@ -40,7 +40,8 @@ public function configureOptions(OptionsResolver $resolver) throw new \Exception('Error while getting request'); } - return $options['translation_path'] . '[' . $this->request->getLocale() . '].' . $options['translation_property']; + return $options['translation_path'].'['.$this->request->getLocale( + ).'].'.$options['translation_property']; }, ) ); @@ -51,4 +52,8 @@ public function getParent() return EntityType::class; } + public function getBlockPrefix() + { + return 'object_bg_translated_entity'; + } } diff --git a/src/Form/Type/TranslationsFieldsType.php b/src/Form/Type/TranslationsFieldsType.php index b8c2880..fc8adb3 100644 --- a/src/Form/Type/TranslationsFieldsType.php +++ b/src/Form/Type/TranslationsFieldsType.php @@ -37,5 +37,8 @@ public function configureOptions(OptionsResolver $resolver) ); } - + public function getBlockPrefix() + { + return 'object_bg_translation_fields'; + } } diff --git a/src/Form/Type/TranslationsFormsType.php b/src/Form/Type/TranslationsFormsType.php index 10dbe40..9e041d0 100644 --- a/src/Form/Type/TranslationsFormsType.php +++ b/src/Form/Type/TranslationsFormsType.php @@ -95,4 +95,8 @@ public function configureOptions(OptionsResolver $resolver) ); } + public function getBlockPrefix() + { + return 'object_bg_translations_forms'; + } } diff --git a/src/Form/Type/TranslationsLocalesSelectorType.php b/src/Form/Type/TranslationsLocalesSelectorType.php index 3f1120c..958cc22 100644 --- a/src/Form/Type/TranslationsLocalesSelectorType.php +++ b/src/Form/Type/TranslationsLocalesSelectorType.php @@ -44,7 +44,11 @@ public function configureOptions(OptionsResolver $resolver) public function getParent() { - return \Symfony\Component\Form\Extension\Core\Type\ChoiceType::class; + return \Symfony\Component\Form\Extension\Core\Type\ChoiceType::class; } + public function getBlockPrefix() + { + return 'object_bg_locales_selector'; + } } diff --git a/src/Form/Type/TranslationsType.php b/src/Form/Type/TranslationsType.php index 59ce85e..b658761 100644 --- a/src/Form/Type/TranslationsType.php +++ b/src/Form/Type/TranslationsType.php @@ -71,4 +71,8 @@ public function configureOptions(OptionsResolver $resolver) ); } + public function getBlockPrefix() + { + return 'object_bg_translations'; + } } diff --git a/src/TranslationService.php b/src/TranslationService.php index b549c2d..e5fe1c5 100644 --- a/src/TranslationService.php +++ b/src/TranslationService.php @@ -132,7 +132,7 @@ public function getLocales() { $locales = array(); foreach ($this->getLanguages() as $lang) { - $locales[$lang->getLocale()] = $lang->getName(); + $locales[$lang->getLocale()] = $lang->getName().'('.$lang->getLocale().')'; } return $locales; @@ -298,7 +298,7 @@ private function getFieldsList($options, $class) // Check existing foreach ($formFields as $field) { if (!property_exists($class, $field)) { - throw new \Exception("Field '" . $field . "' doesn't exist in " . $class); + throw new \Exception("Field '".$field."' doesn't exist in ".$class); } }