Announcement

Collapse
No announcement yet.

Retrieving "enum" option translation

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Retrieving "enum" option translation

    Please, what's the easiest way to get the translation for any "enum" field option?

    I'm geting crazy trying to create "new Language" objects without any result.

    Some "code portion" will be wellcomed ... I'm trying to get the translation from inside a "Controller" object and from inside a "Service" object, without any luck ...

    TIA

  • #2
    PARTIALY SOLVED ...

    here is the code from inside a SERVICE object ... where 'convocatoria' is the name of the ENUM field ...

    $lang = new Language('en_US', $this->getFileManager(), $this->getMetadata());
    $transliterated = $lang->translateOption($entity->get('convocatoria'), 'convocatoria', $entity->getEntityName());
    $entity->set('fullName', $entity->get('name'). ', ' . $transliterated);

    but this way ONLY works for "detail" view; failing with "list" view ... any idea?

    Last edited by ManicMiner; 11-18-2019, 12:52 PM.

    Comment

    Working...
    X