public function getGlossaryTerms(LocaleEntity $locale, TranslatableEntity $translatable)
    {
        $result = [];
        $connection = $this->app->make(EntityManager::class)->getConnection();
        $rs = $connection->executeQuery(
            '
                select
                    CommunityTranslationGlossaryEntries.id,
                    CommunityTranslationGlossaryEntries.term,
                    CommunityTranslationGlossaryEntries.type,
                    CommunityTranslationGlossaryEntries.comments as commentsE,
                    CommunityTranslationGlossaryEntriesLocalized.translation,
                    CommunityTranslationGlossaryEntriesLocalized.comments as commentsEL,
                    match(CommunityTranslationGlossaryEntries.term) against (:search in natural language mode) as relevance
                from
                    CommunityTranslationGlossaryEntries
                    left join CommunityTranslationGlossaryEntriesLocalized on CommunityTranslationGlossaryEntries.id = CommunityTranslationGlossaryEntriesLocalized.entry and :locale = CommunityTranslationGlossaryEntriesLocalized.locale
                having
                    relevance > 0
                order by
                    relevance desc,
                    CommunityTranslationGlossaryEntries.term asc
                limit
                    0, ' . ((int) self::MAX_GLOSSARY_ENTRIES) . '
            ',
            [
                'search' => $translatable->getText(),
                'locale' => $locale->getID(),
            ]
        );
        while ($row = $rs->fetch()) {
            $result[] = [
                'id' => (int) $row['id'],
                'term' => $row['term'],
                'type' => $row['type'],
                'termComments' => $row['commentsE'],
                'translation' => ($row['translation'] === null) ? '' : $row['translation'],
                'translationComments' => ($row['commentsEL'] === null) ? '' : $row['commentsEL'],
            ];
        }
        $rs->closeCursor();

        return $result;
    }
public function getGlossaryTerms(LocaleEntity $locale, TranslatableEntity $translatable)
    {
        $result = [];
        $connection = $this->app->make(EntityManager::class)->getConnection();
        $rs = $connection->executeQuery(
            '
                select
                    CommunityTranslationGlossaryEntries.id,
                    CommunityTranslationGlossaryEntries.term,
                    CommunityTranslationGlossaryEntries.type,
                    CommunityTranslationGlossaryEntries.comments as commentsE,
                    CommunityTranslationGlossaryEntriesLocalized.translation,
                    CommunityTranslationGlossaryEntriesLocalized.comments as commentsEL,
                    match(CommunityTranslationGlossaryEntries.term) against (:search in natural language mode) as relevance
                from
                    CommunityTranslationGlossaryEntries
                    left join CommunityTranslationGlossaryEntriesLocalized on CommunityTranslationGlossaryEntries.id = CommunityTranslationGlossaryEntriesLocalized.entry and :locale = CommunityTranslationGlossaryEntriesLocalized.locale
                having
                    relevance > 0
                order by
                    relevance desc,
                    CommunityTranslationGlossaryEntries.term asc
                limit
                    0, ' . ((int) self::MAX_GLOSSARY_ENTRIES) . '
            ',
            [
                'search' => $translatable->getText(),
                'locale' => $locale->getID(),
            ]
        );
        while ($row = $rs->fetch()) {
            $result[] = [
                'id' => (int) $row['id'],
                'term' => $row['term'],
                'type' => $row['type'],
                'termComments' => $row['commentsE'],
                'translation' => ($row['translation'] === null) ? '' : $row['translation'],
                'translationComments' => ($row['commentsEL'] === null) ? '' : $row['commentsEL'],
            ];
        }
        $rs->closeCursor();

        return $result;
    }
public function getGlossaryTerms ( LocaleEntity $ locale , TranslatableEntity $ translatable ) { $ result = [ ] ; $ connection = $ this -> app -> make ( EntityManager :: class ) -> getConnection ( ) ; $ rs = $ connection -> executeQuery ( '
                select
                    CommunityTranslationGlossaryEntries.id,
                    CommunityTranslationGlossaryEntries.term,
                    CommunityTranslationGlossaryEntries.type,
                    CommunityTranslationGlossaryEntries.comments as commentsE,
                    CommunityTranslationGlossaryEntriesLocalized.translation,
                    CommunityTranslationGlossaryEntriesLocalized.comments as commentsEL,
                    match(CommunityTranslationGlossaryEntries.term) against (:search in natural language mode) as relevance
                from
                    CommunityTranslationGlossaryEntries
                    left join CommunityTranslationGlossaryEntriesLocalized on CommunityTranslationGlossaryEntries.id = CommunityTranslationGlossaryEntriesLocalized.entry and :locale = CommunityTranslationGlossaryEntriesLocalized.locale
                having
                    relevance > 0
                order by
                    relevance desc,
                    CommunityTranslationGlossaryEntries.term asc
                limit
                    0, ' . ( ( int ) self :: MAX_GLOSSARY_ENTRIES ) . '
            ' , [ 'search' => $ translatable -> getText ( ) , 'locale' => $ locale -> getID ( ) , ] ) ; while ( $ row = $ rs -> fetch ( ) ) { $ result [ ] = [ 'id' => ( int ) $ row [ 'id' ] , 'term' => $ row [ 'term' ] , 'type' => $ row [ 'type' ] , 'termComments' => $ row [ 'commentsE' ] , 'translation' => ( $ row [ 'translation' ] === null ) ? '' : $ row [ 'translation' ] , 'translationComments' => ( $ row [ 'commentsEL' ] === null ) ? '' : $ row [ 'commentsEL' ] , ] ; } $ rs -> closeCursor ( ) ; return $ result ; }
Search the glossary entries to show when translating a string in a specific locale.

@param LocaleEntity $locale the current editor locale
@param TranslatableEntity $translatable the source string that's being translated

@return array
Search the glossary entries to show when translating a string in a specific locale .