public function getTranslatableData(LocaleEntity $locale, TranslatableEntity $translatable, PackageVersionEntity $packageVersion = null, $initial = false)
    {
        $result = [
            'id' => $translatable->getID(),
            'translations' => $this->getTranslations($locale, $translatable),
        ];
        if ($initial) {
            $place = ($packageVersion === null) ? null : $this->app->make(TranslatablePlaceRepository::class)->findOneBy(['packageVersion' => $packageVersion, 'translatable' => $translatable]);
            if ($place !== null) {
                $extractedComments = $place->getComments();
                $references = $this->expandReferences($place->getLocations(), $packageVersion);
            } else {
                $extractedComments = [];
                $references = [];
            }
            $result['extractedComments'] = $extractedComments;
            $result['references'] = $references;
            $result['extractedComments'] = ($place === null) ? [] : $place->getComments();
            $result['comments'] = $this->getComments($locale, $translatable);
            $result['suggestions'] = $this->getSuggestions($locale, $translatable);
            $result['glossary'] = $this->getGlossaryTerms($locale, $translatable);
        }

        return $result;
    }
public function getTranslatableData(LocaleEntity $locale, TranslatableEntity $translatable, PackageVersionEntity $packageVersion = null, $initial = false)
    {
        $result = [
            'id' => $translatable->getID(),
            'translations' => $this->getTranslations($locale, $translatable),
        ];
        if ($initial) {
            $place = ($packageVersion === null) ? null : $this->app->make(TranslatablePlaceRepository::class)->findOneBy(['packageVersion' => $packageVersion, 'translatable' => $translatable]);
            if ($place !== null) {
                $extractedComments = $place->getComments();
                $references = $this->expandReferences($place->getLocations(), $packageVersion);
            } else {
                $extractedComments = [];
                $references = [];
            }
            $result['extractedComments'] = $extractedComments;
            $result['references'] = $references;
            $result['extractedComments'] = ($place === null) ? [] : $place->getComments();
            $result['comments'] = $this->getComments($locale, $translatable);
            $result['suggestions'] = $this->getSuggestions($locale, $translatable);
            $result['glossary'] = $this->getGlossaryTerms($locale, $translatable);
        }

        return $result;
    }
public function getTranslatableData ( LocaleEntity $ locale , TranslatableEntity $ translatable , PackageVersionEntity $ packageVersion = null , $ initial = false ) { $ result = [ 'id' => $ translatable -> getID ( ) , 'translations' => $ this -> getTranslations ( $ locale , $ translatable ) , ] ; if ( $ initial ) { $ place = ( $ packageVersion === null ) ? null : $ this -> app -> make ( TranslatablePlaceRepository :: class ) -> findOneBy ( [ 'packageVersion' => $ packageVersion , 'translatable' => $ translatable ] ) ; if ( $ place !== null ) { $ extractedComments = $ place -> getComments ( ) ; $ references = $ this -> expandReferences ( $ place -> getLocations ( ) , $ packageVersion ) ; } else { $ extractedComments = [ ] ; $ references = [ ] ; } $ result [ 'extractedComments' ] = $ extractedComments ; $ result [ 'references' ] = $ references ; $ result [ 'extractedComments' ] = ( $ place === null ) ? [ ] : $ place -> getComments ( ) ; $ result [ 'comments' ] = $ this -> getComments ( $ locale , $ translatable ) ; $ result [ 'suggestions' ] = $ this -> getSuggestions ( $ locale , $ translatable ) ; $ result [ 'glossary' ] = $ this -> getGlossaryTerms ( $ locale , $ translatable ) ; } return $ result ; }
Returns the data to be used in the editor when editing a string.

@param LocaleEntity $locale the current editor locale
@param TranslatableEntity $translatable the source string that's being translated
@param PackageVersionEntity $packageVersion the package version where this string is used
@param bool $initial set to true when a string is first loaded, false after it has been saved

@return array
Returns the data to be used in the editor when editing a string .