Forums › Forums › OroPlatform › Translate the Task Status Field?
This topic contains 9 replies, has 3 voices, and was last updated by William Radi 5 years, 9 months ago.
Starting from March 1, 2020 the forum has been switched to the read-only mode. Please head to StackOverflow for support.
- CreatorTopic
- June 12, 2018 at 9:10 am #37181
How do I translate the values of field ‘status’ in Task Oro Entity? In my form, even with the pt_BR translation installed, the field appears like this below:
- CreatorTopic
- AuthorReplies
- June 14, 2018 at 5:44 am #37182
You can check this post, the Lead status made the same way as Task status.
https://oroinc.com/orocrm/forums/topic/translate-enum-values-for-lead-status
June 15, 2018 at 6:34 am #37183Hey, Andrey!
How you doing?I’m with the same problem, but I’d like to do it by the code side.
So… Is there a way to do it?Thanks!
June 15, 2018 at 10:56 am #37184Hello!
Well, researching and testing, I found this table: oro_enum_value_trans
If I insert directly into the data base, it works:PgSQL1INSERT INTO oro_enum_value_trans (foreign_key,content,locale,object_class,field) VALUES ('open', 'Aberto', 'pt_BR', 'Extend\Entity\EV_Task_Status', 'name');But, how is the right way to do it?
Like, via migration, data fixture or another one..Thanks a lot!
June 19, 2018 at 3:56 am #37185Is there a better way?
June 19, 2018 at 4:37 am #37186Hi William,
oro_enum_value_trans
table refers to EnumValueTranslation entity, so you can add it with data migrations same as for any other entity, for exampleJune 19, 2018 at 7:00 am #37187Hi, Andrey! :D
So, my migration should looks like this?
PHP123456789101112131415namespace App\Bundle\TaskBundle\Migrations\Schema\v1_0;use Doctrine\DBAL\Schema\Schema;use Oro\Bundle\MigrationBundle\Migration\Migration;use Oro\Bundle\MigrationBundle\Migration\QueryBag;class TranslateTaskStatus implements Migration{public function up(Schema $schema, QueryBag $queries){$queries->addQuery("INSERT INTO oro_enum_value_trans (foreign_key,content,locale,object_class,field)VALUES ('open', 'Aberto', 'pt_BR', 'Extend\Entity\EV_Task_Status', 'name')");}}June 19, 2018 at 7:12 am #37188This is schema migration, it should be used only for updating database schema but not the data itself.
There is another type of migrations called data migrations, for example LoadGroupData.php.
This migrations can be loaded with
oro:migration:data:load
command.
And in your case this should contain something likePHP12345678$enumValueTranslation = new EnumValueTranslation();$enumValueTranslation->setForeignKey('open')->setContent('Aberto')...$em->persist($enumValueTranslation);$em->flush();June 19, 2018 at 7:18 am #37189Thanks, Andrey! :D
Just one more question! lol
I got the object_class value following the steps described here and than, consulting the oro_enum_value_trans table.
If I need to translate another enum values, how can I get the object_class value?
Or, I don’t need to fill this column?
- This reply was modified 5 years, 9 months ago by
William Radi. - This reply was modified 5 years, 9 months ago by
William Radi.
June 21, 2018 at 10:54 am #37192Is there a way to get the object_class value?
- This reply was modified 5 years, 9 months ago by
- AuthorReplies
The forum ‘OroPlatform’ is closed to new topics and replies.