@param Content $content
@param string  $languageCode

@return bool
165023
public function isLanguageVersionExist(Content $content, string $languageCode): bool
    {
        return \in_array($languageCode, $content->versionInfo->languageCodes);
    }
970019
public function response($content, $code)
    {
        $this->setJsonHeader();

        $this->setStatusCode($code);

        return $this->content($this->serializer->serialize($content));
    }
273710
public function deleteTranslationFromContent($contentId, $languageCode)
    {
        $language = $this->languageHandler->loadByLanguageCode($languageCode);

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

            $this->connection->commit();
        } catch (DBALException $e) {
            $this->connection->rollBack();
            throw $e;
        }
    }
149083
private function loadContent(int $contentId, string $language): Content
    {
        return $this->repository->getContentService()->loadContent($contentId, [$language]);
    }
924452
public static function getLocaleByCode($languageCode, $countryCode = null) {
		$class = 'Dater\Locale\\' . ucfirst(strtolower($languageCode)) . ($countryCode ? ucfirst(strtolower($countryCode)) : '');
		if(!class_exists($class)) {
			throw new \Exception('Unknown locale code. Class "' . $class . '" not found.');
		}
		return new $class();
	}
1234871
public function withContentType($contentType, $charset = null)
    {
        if (is_null($charset)) {
            return $this->withHeader('Content-Type', $contentType);
        }

        return $this->withHeader('Content-Type', $contentType . '; charset=' . $charset);
    }
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();
    }
199586
public static function languageCountryLocaleCode($languageCode, $countryCode)
    {
        $countryLocaleCodes = static::countryLocaleCodes($countryCode);
        $languageLocaleCodes = static::languageLocaleCodes($languageCode);
        if ($localeCodes = array_intersect($languageLocaleCodes, $countryLocaleCodes)) {
            return reset($localeCodes);
        }

        return \Locale::composeLocale([
            'language' => $languageCode,
            'region' => $countryCode,
        ]);
    }
1093817
public function loadByLanguageCode($languageCode)
    {
        $language = $this->cache->get('ez-language-code-' . $languageCode);
        if ($language === null) {
            $language = $this->innerHandler->loadByLanguageCode($languageCode);
            $this->storeCache([$language]);
        }

        return $language;
    }
604424
public function createNewFields(Content $content, Type $contentType)
    {
        $fieldsToCopy = array();
        $languageCodes = array();
        $fields = $this->getFieldMap($content->fields, $languageCodes);
        $languageCodes[$content->versionInfo->contentInfo->mainLanguageCode] = true;

        foreach ($contentType->fieldDefinitions as $fieldDefinition) {
            foreach (array_keys($languageCodes) as $languageCode) {
                // Create fields passed from struct
                if (isset($fields[$fieldDefinition->id][$languageCode])) {
                    $field = $fields[$fieldDefinition->id][$languageCode];
                    $this->createNewField($field, $content);
                } elseif (
                    !$fieldDefinition->isTranslatable
                    && isset($fields[$fieldDefinition->id][$content->versionInfo->contentInfo->mainLanguageCode])
                ) {
                    // Copy only for untranslatable field and when field in main language exists
                    // Only register here, process later as field copied should be already stored
                    $fieldsToCopy[$fieldDefinition->id][$languageCode] =
                        $fields[$fieldDefinition->id][$content->versionInfo->contentInfo->mainLanguageCode];
                } else { // In all other cases create empty field
                    $field = $this->getEmptyField($fieldDefinition, $languageCode);
                    $content->fields[] = $field;
                    $this->createNewField($field, $content);
                }
            }
        }

        $this->copyFields($fieldsToCopy, $content);
    }
1063442
private function isHandlingLanguage($code, $allLanguages)
    {
        if ($code == $this->baselanguage) {
            return false;
        }

        if ($allLanguages) {
            return true;
        }

        return in_array(substr($code, 0, 2), $this->languages);
    }
1167483
public function deleteTranslationFromContentFields($contentId, array $versions, $languageCode)
    {
        foreach ($versions as $versionInfo) {
            // FT-specific implementations require VersionInfo to delete data
            $fieldTypeIdsMap = $this->contentGateway->getFieldIdsByType(
                $versionInfo->contentInfo->id,
                $versionInfo->versionNo,
                $languageCode
            );

            foreach ($fieldTypeIdsMap as $fieldType => $ids) {
                $this->storageHandler->deleteFieldData($fieldType, $versionInfo, $ids);
            }
        }

        $this->contentGateway->deleteTranslatedFields($languageCode, $contentId);
    }
765504
function contentObjectAttributes( $languageCode = false, $asObject = true )
    {
        if ( $languageCode == false )
        {
            if ( $this->Status == eZContentObjectVersion::STATUS_DRAFT || $this->Status == eZContentObjectVersion::STATUS_INTERNAL_DRAFT || $this->Status == eZContentObjectVersion::STATUS_PENDING )
            {
                $languageCode = $this->initialLanguageCode();
            }
            else if ( $this->CurrentLanguage )
            {
                $languageCode = $this->CurrentLanguage;
            }
        }

        return eZContentObjectVersion::fetchAttributes( $this->Version, $this->ContentObjectID, $languageCode, $asObject );
    }
1259848
public function getPath($languageCode)
    {
        $route = $this->routes()->newQuery()
            ->where('language_code', $languageCode)
            ->first();
        if (empty($route->path)) {
            throw new DomainException("There is no route in '$languageCode' language for content: $this->id");
        }
        return $route->path;
    }
813298
private function resolveContentCreateForm(
        ContentCreateData $contentCreateData,
        string $languageCode
    ): FormInterface {
        return $this->formFactory->create(ContentEditType::class, $contentCreateData, [
            'languageCode' => $languageCode,
            'mainLanguageCode' => $languageCode,
            'drafts_enabled' => true,
        ]);
    }
389064
public function isLanguageAvailable($code, core_kernel_classes_Resource $usage)
    {
        $langClass = new core_kernel_classes_Class(static::CLASS_URI_LANGUAGES);
        $result = $langClass->searchInstances(
            array(
                OntologyRdf::RDF_VALUE => $code,
                static::PROPERTY_LANGUAGE_USAGES => $usage->getUri(),
            ),
            array('like' => false)
        );

        return !empty($result);
    }
526229
public function getLanguage($languageCode = null): ?string
    {
        $languageCode = $languageCode ? mb_strtoupper($languageCode) : null;

        return $this->get("languages.{$languageCode}") ?: (current($this->get('languages', [])) ?: null);
    }