@param \eZ\Publish\API\Repository\Values\ContentType\ContentTypeDraft $contentTypeDraft
@param string $languageCode

@return \eZ\Publish\API\Repository\Values\ContentType\ContentTypeDraft
497008
public function removeContentTypeTranslation(ContentTypeDraft $contentTypeDraft, string $languageCode): ContentTypeDraft
    {
        $contentTypeDraft = $this->service->removeContentTypeTranslation($contentTypeDraft, $languageCode);
        $this->signalDispatcher->emit(
            new RemoveContentTypeDraftTranslationSignal(
                [
                    'contentTypeDraftId' => $contentTypeDraft->id,
                    'languageCode' => $languageCode,
                ]
            )
        );

        return $contentTypeDraft;
    }
552090
public function deleteTranslationFromContent($contentId, $languageCode)
    {
        try {
            return $this->innerGateway->deleteTranslationFromContent($contentId, $languageCode);
        } catch (DBALException $e) {
            throw new RuntimeException('Database error', 0, $e);
        } catch (PDOException $e) {
            throw new RuntimeException('Database error', 0, $e);
        }
    }
732264
public static function init(common_ext_Extension $extension, $langCode)
    {
    	// if the langCode is empty do nothing
    	if (empty($langCode)){
    		throw new Exception("Language is not defined");
    	}
    	
		//init the ClearFw l10n tools
        $translations = tao_models_classes_LanguageService::singleton()->getServerBundle($langCode);
        l10n::init($translations);

        $serviceManager = \oat\oatbox\service\ServiceManager::getServiceManager();
        $extraPoService = $serviceManager->get(\oat\tao\model\i18n\ExtraPoService::SERVICE_ID);
        $extraPoCount = $extraPoService->requirePos();
    }
1043418
private function resolveContentType(array $parameters, array $languageCodes): ContentType
    {
        if (isset($parameters['contentType'])) {
            return $parameters['contentType'];
        }

        if (isset($parameters['contentTypeIdentifier'])) {
            return $this->loadContentType($parameters['contentTypeIdentifier'], $languageCodes);
        }

        throw new InvalidArgumentException(
            'ContentType',
            'No content type could be loaded from parameters'
        );
    }
173871
protected function getExistingKeywords($keywordList, $contentTypeId)
    {
        // Retrieving potentially existing keywords
        $query = $this->connection->createQueryBuilder();
        $query
            ->select(
                $this->connection->quoteIdentifier('id'),
                $this->connection->quoteIdentifier('keyword')
            )
            ->from($this->connection->quoteIdentifier(self::KEYWORD_TABLE))
            ->where(
                $query->expr()->andX(
                    $query->expr()->in(
                        $this->connection->quoteIdentifier('keyword'),
                        ':keywordList'
                    ),
                    $query->expr()->eq(
                        $this->connection->quoteIdentifier('class_id'),
                        ':contentTypeId'
                    )
                )
            )
            ->setParameter(':keywordList', $keywordList, Connection::PARAM_STR_ARRAY)
            ->setParameter(':contentTypeId', $contentTypeId);

        $statement = $query->execute();

        $existingKeywordMap = [];
        foreach ($statement->fetchAll(\PDO::FETCH_ASSOC) as $row) {
            // filter out keywords that aren't the exact match (e.g. differ by case)
            if (!in_array($row['keyword'], $keywordList)) {
                continue;
            }
            $existingKeywordMap[$row['keyword']] = $row['id'];
        }

        return $existingKeywordMap;
    }
1204699
public function loadContentTypeDraftFieldDefinitionList($contentTypeId)
    {
        $contentTypeDraft = $this->contentTypeService->loadContentTypeDraft($contentTypeId);

        return new Values\FieldDefinitionList(
            $contentTypeDraft,
            $contentTypeDraft->getFieldDefinitions()
        );
    }
1136915
public function buildFieldUpdateForm(
        FormBuilderInterface $formBuilder,
        FieldDefinition $fieldDefinition,
        Content $content,
        $languageCode
    ) {
        $this->buildFieldForm($formBuilder, $fieldDefinition, $languageCode, $content);
    }
1024505
public function deleteTranslationFromVersion($contentId, $versionNo, $languageCode)
    {
        $language = $this->languageHandler->loadByLanguageCode($languageCode);

        $this->connection->beginTransaction();
        try {
            $this->deleteTranslationFromContentVersions($contentId, $language->id, $versionNo);
            $this->deleteTranslationFromContentNames($contentId, $languageCode, $versionNo);

            $this->connection->commit();
        } catch (DBALException $e) {
            $this->connection->rollBack();
            throw $e;
        }
    }
870271
public function removeContentTypeTranslation(int $contentTypeId, string $languageCode): Type
    {
        $this->logger->logCall(__METHOD__, ['id' => $contentTypeId, 'languageCode' => $languageCode]);
        $return = $this->persistenceHandler->contentTypeHandler()->removeContentTypeTranslation(
            $contentTypeId,
            $languageCode
        );

        $this->cache->invalidateTags(['type-' . $contentTypeId, 'type-map', 'content-fields-type-' . $contentTypeId]);

        return $return;
    }
1279160
public function sendApiRestEncode($code=200, $data = NULL, $options= 0, $contentType='application/json'){        
        $this->sendApiRest($code, json_encode($data, $options), $contentType);
    }
1319883
protected function isLanguageAlwaysAvailable(Content $content, $languageCode)
    {
        return
            $content->versionInfo->contentInfo->alwaysAvailable &&
            $content->versionInfo->contentInfo->mainLanguageCode === $languageCode
        ;
    }
933993
public function loadContentTypeFieldDefinitionList($contentTypeId)
    {
        $contentType = $this->contentTypeService->loadContentType($contentTypeId, Language::ALL);

        return new Values\FieldDefinitionList(
            $contentType,
            $contentType->getFieldDefinitions()
        );
    }
1373144
private function mapContentDraft(VersionInfo $draft, ContentType $contentType): array
    {
        $contentInfo = $draft->getContentInfo();

        return [
            'id' => new VersionId(
                $contentInfo->id,
                $draft->versionNo
            ),
            'contentId' => $contentInfo->id,
            'name' => $draft->getName(),
            'type' => $contentType->getName(),
            'content_type' => $contentType,
            'language' => $draft->initialLanguageCode,
            'version' => $draft->versionNo,
            'modified' => $draft->modificationDate,
        ];
    }
732260
public function create($languageCode) {
    $mappings = $this->getMappings();

    if (!isset($mappings[$languageCode])) {
      throw new \InvalidArgumentException('The language code is not part of the supported list. Please see GoogleSupportedLanguages\LanguageFactory::getMappings() for reference.');
    }

    return new $mappings[$languageCode]();
  }
275725
public function draftHasNoConflictAction(int $contentId, string $languageCode): Response
    {
        $content = $this->contentService->loadContent($contentId);
        $location = $this->locationService->loadLocation($content->contentInfo->mainLocationId);
        $contentInfo = $content->contentInfo;

        try {
            $contentDraftHasConflict = (new ContentDraftHasConflict($this->contentService, $languageCode))->isSatisfiedBy($contentInfo);
        } catch (UnauthorizedException $e) {
            $error = $this->translator->trans(
                /** @Desc("Cannot check if the draft has no conflict with other drafts. %error%. ") */
                'content.draft.conflict.error',
                ['%error%' => $e->getMessage()],
                'content'
            );

            return new Response($error, Response::HTTP_FORBIDDEN);
        }

        if ($contentDraftHasConflict) {
            $versionsDataset = $this->datasetFactory->versions();
            $versionsDataset->load($contentInfo);
            $conflictedDrafts = $versionsDataset->getConflictedDraftVersions($contentInfo->currentVersionNo, $languageCode);

            $modalContent = $this->renderView('@ezdesign/content/modal_draft_conflict.html.twig', [
                'conflicted_drafts' => $conflictedDrafts,
                'location' => $location,
                'content_is_user' => (new ContentIsUser($this->userService))->isSatisfiedBy($content),
            ]);

            return new Response($modalContent, Response::HTTP_CONFLICT);
        }

        return new Response();
    }
197466
public function getOne($languageCode, $locale = 'en')
	{

		$result = $this->has($languageCode, $locale);

		if (!$result)
		{
			throw new LanguageNotFoundException($languageCode);
		}

		return $result;
	}
209739
public function listGlobalEntries($languageCode = null, $offset = 0, $limit = -1)
    {
        $limit = $limit === -1 ? self::MAX_LIMIT : $limit;

        /** @var $query \eZ\Publish\Core\Persistence\Database\SelectQuery */
        $query = $this->dbHandler->createSelectQuery();
        $query->select(
            $this->dbHandler->quoteColumn('action'),
            $this->dbHandler->quoteColumn('id'),
            $this->dbHandler->quoteColumn('link'),
            $this->dbHandler->quoteColumn('is_alias'),
            $this->dbHandler->quoteColumn('alias_redirects'),
            $this->dbHandler->quoteColumn('lang_mask'),
            $this->dbHandler->quoteColumn('is_original'),
            $this->dbHandler->quoteColumn('parent'),
            $this->dbHandler->quoteColumn('text_md5')
        )->from(
            $this->dbHandler->quoteTable($this->table)
        )->where(
            $query->expr->lAnd(
                $query->expr->eq(
                    $this->dbHandler->quoteColumn('action_type'),
                    $query->bindValue('module', null, \PDO::PARAM_STR)
                ),
                $query->expr->eq(
                    $this->dbHandler->quoteColumn('is_original'),
                    $query->bindValue(1, null, \PDO::PARAM_INT)
                ),
                $query->expr->eq(
                    $this->dbHandler->quoteColumn('is_alias'),
                    $query->bindValue(1, null, \PDO::PARAM_INT)
                )
            )
        )->limit(
            $limit,
            $offset
        );
        if (isset($languageCode)) {
            $query->where(
                $query->expr->gt(
                    $query->expr->bitAnd(
                        $this->dbHandler->quoteColumn('lang_mask'),
                        $query->bindValue(
                            $this->languageMaskGenerator->generateLanguageIndicator($languageCode, false),
                            null,
                            \PDO::PARAM_INT
                        )
                    ),
                    0
                )
            );
        }
        $statement = $query->prepare();
        $statement->execute();

        return $statement->fetchAll(\PDO::FETCH_ASSOC);
    }