public function fetchTranslation(Message $message, $updateFs = false)
    {
        $project = $this->getProject($message);

        try {
            $resource = sprintf('translations/%s/%s', $message->getId(), $message->getLocale());
            $response = $this->makeApiRequest($project['api_key'], 'GET', $resource);
        } catch (HttpException $e) {
            if ($e->getCode() === 404) {
                //Message does not exist
                return;
            }
            throw $e;
        }

        $logoTranslation = $response['translation'];
        $messageTranslation = $message->getTranslation();
        $message->setTranslation($logoTranslation);

        // update filesystem
        if ($updateFs && $logoTranslation !== $messageTranslation) {
            $this->filesystemService->updateMessageCatalog([$message]);
        }

        return $logoTranslation;
    }
public function fetchTranslation(Message $message, $updateFs = false)
    {
        $project = $this->getProject($message);

        try {
            $resource = sprintf('translations/%s/%s', $message->getId(), $message->getLocale());
            $response = $this->makeApiRequest($project['api_key'], 'GET', $resource);
        } catch (HttpException $e) {
            if ($e->getCode() === 404) {
                //Message does not exist
                return;
            }
            throw $e;
        }

        $logoTranslation = $response['translation'];
        $messageTranslation = $message->getTranslation();
        $message->setTranslation($logoTranslation);

        // update filesystem
        if ($updateFs && $logoTranslation !== $messageTranslation) {
            $this->filesystemService->updateMessageCatalog([$message]);
        }

        return $logoTranslation;
    }
public function fetchTranslation ( Message $ message , $ updateFs = false ) { $ project = $ this -> getProject ( $ message ) ; try { $ resource = sprintf ( 'translations/%s/%s' , $ message -> getId ( ) , $ message -> getLocale ( ) ) ; $ response = $ this -> makeApiRequest ( $ project [ 'api_key' ] , 'GET' , $ resource ) ; } catch ( HttpException $ e ) { if ( $ e -> getCode ( ) === 404 ) { //Message does not exist return ; } throw $ e ; } $ logoTranslation = $ response [ 'translation' ] ; $ messageTranslation = $ message -> getTranslation ( ) ; $ message -> setTranslation ( $ logoTranslation ) ; // update filesystem if ( $ updateFs && $ logoTranslation !== $ messageTranslation ) { $ this -> filesystemService -> updateMessageCatalog ( [ $ message ] ) ; } return $ logoTranslation ; }
Fetch a translation form Loco.

@param Message $message
Fetch a translation form Loco .