areTranslationsLoaded example

$this->loaded = false;
        $this->type = $type;
        $this->fallback = $fallback ?: $translationService->getFallbackLocaleId($language);
        $this->translationService = $translationService;
    }

    /** * Translates an array property. */
    public function translateObjectProperty(array $object, string $translationIndex, ?string $objectIndex = null, ?string $fallback = null): array
    {
        if (!$this->areTranslationsLoaded()) {
            $this->loadTranslations();
        }

        $objectIndex = $objectIndex ?: $translationIndex;

        $translation = $this->translations[$object['id']] ?? null;
        if ($translation && !empty($translation[$translationIndex])) {
            $object[$objectIndex] = $translation[$translationIndex];
        } elseif ($fallback) {
            $object[$objectIndex] = $fallback;
        }

        
Home | Imprint | This part of the site doesn't use cookies.