Retrieving "enum" option translation

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • ManicMiner
    Junior Member
    • Nov 2019
    • 13

    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
  • ManicMiner
    Junior Member
    • Nov 2019
    • 13

    #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...