public function forPackage($packageOrHandleVersion, LocaleEntity $locale, $excludeUntranslatedStrings = false)
    {
        if ($packageOrHandleVersion instanceof PackageVersionEntity) {
            $packageVersion = $packageOrHandleVersion;
        } elseif (is_array($packageOrHandleVersion) && isset($packageOrHandleVersion['handle']) && isset($packageOrHandleVersion['version'])) {
            $packageVersion = $this->app->make(PackageVersionRepository::class)->findOneBy([
                'handle' => $packageOrHandleVersion['handle'],
                'version' => $packageOrHandleVersion['version'],
            ]);
        } elseif (is_array($packageOrHandleVersion) && isset($packageOrHandleVersion[0]) && isset($packageOrHandleVersion[1])) {
            $packageVersion = $this->app->make(PackageVersionRepository::class)->findOneBy([
                'handle' => $packageOrHandleVersion[0],
                'version' => $packageOrHandleVersion[1],
            ]);
        } else {
            $packageVersion = null;
        }
        if ($packageVersion === null) {
            throw new UserMessageException(t('Invalid translated package version specified'));
        }
        $rs = $this->getPackageSelectQuery($packageVersion, $locale, $excludeUntranslatedStrings);

        $result = $this->buildTranslations($locale, $rs);

        $result->setHeader('Project-Id-Version', $packageVersion->getPackage()->getHandle() . ' ' . $packageVersion->getVersion());

        return $result;
    }
public function forPackage($packageOrHandleVersion, LocaleEntity $locale, $excludeUntranslatedStrings = false)
    {
        if ($packageOrHandleVersion instanceof PackageVersionEntity) {
            $packageVersion = $packageOrHandleVersion;
        } elseif (is_array($packageOrHandleVersion) && isset($packageOrHandleVersion['handle']) && isset($packageOrHandleVersion['version'])) {
            $packageVersion = $this->app->make(PackageVersionRepository::class)->findOneBy([
                'handle' => $packageOrHandleVersion['handle'],
                'version' => $packageOrHandleVersion['version'],
            ]);
        } elseif (is_array($packageOrHandleVersion) && isset($packageOrHandleVersion[0]) && isset($packageOrHandleVersion[1])) {
            $packageVersion = $this->app->make(PackageVersionRepository::class)->findOneBy([
                'handle' => $packageOrHandleVersion[0],
                'version' => $packageOrHandleVersion[1],
            ]);
        } else {
            $packageVersion = null;
        }
        if ($packageVersion === null) {
            throw new UserMessageException(t('Invalid translated package version specified'));
        }
        $rs = $this->getPackageSelectQuery($packageVersion, $locale, $excludeUntranslatedStrings);

        $result = $this->buildTranslations($locale, $rs);

        $result->setHeader('Project-Id-Version', $packageVersion->getPackage()->getHandle() . ' ' . $packageVersion->getVersion());

        return $result;
    }
public function forPackage ( $ packageOrHandleVersion , LocaleEntity $ locale , $ excludeUntranslatedStrings = false ) { if ( $ packageOrHandleVersion instanceof PackageVersionEntity ) { $ packageVersion = $ packageOrHandleVersion ; } elseif ( is_array ( $ packageOrHandleVersion ) && isset ( $ packageOrHandleVersion [ 'handle' ] ) && isset ( $ packageOrHandleVersion [ 'version' ] ) ) { $ packageVersion = $ this -> app -> make ( PackageVersionRepository :: class ) -> findOneBy ( [ 'handle' => $ packageOrHandleVersion [ 'handle' ] , 'version' => $ packageOrHandleVersion [ 'version' ] , ] ) ; } elseif ( is_array ( $ packageOrHandleVersion ) && isset ( $ packageOrHandleVersion [ 0 ] ) && isset ( $ packageOrHandleVersion [ 1 ] ) ) { $ packageVersion = $ this -> app -> make ( PackageVersionRepository :: class ) -> findOneBy ( [ 'handle' => $ packageOrHandleVersion [ 0 ] , 'version' => $ packageOrHandleVersion [ 1 ] , ] ) ; } else { $ packageVersion = null ; } if ( $ packageVersion === null ) { throw new UserMessageException ( t ( 'Invalid translated package version specified' ) ) ; } $ rs = $ this -> getPackageSelectQuery ( $ packageVersion , $ locale , $ excludeUntranslatedStrings ) ; $ result = $ this -> buildTranslations ( $ locale , $ rs ) ; $ result -> setHeader ( 'Project-Id-Version' , $ packageVersion -> getPackage ( ) -> getHandle ( ) . ' ' . $ packageVersion -> getVersion ( ) ) ; return $ result ; }
Get the translations for a specific package, version and locale.

@param PackageVersionEntity|array $packageOrHandleVersion The package version for which you want the translations (a Package\Version entity instance of an array with handle and version)
@param LocaleEntity $locale the locale that you want
@param bool $excludeUntranslatedStrings set to true to filter out untranslated strings

@return Translations
Get the translations for a specific package version and locale .