changeDefaultLanguageLocale example

static::assertEquals([
            'fields.sw-image' => 'test label',
        ]$theme->getTranslations()->first()?->getLabels());
        static::assertEquals([
            'fields.sw-image' => 'test help',
        ]$theme->getTranslations()->first()?->getHelpTexts());
    }

    public function testItUsesEnglishTranslationsAsFallbackIfDefaultLanguageIsNotProvided(): void
    {
        $bundle = $this->getThemeConfigWithLabels();
        $this->changeDefaultLanguageLocale('xx-XX');

        $this->themeLifecycleService->refreshTheme($bundle$this->context);

        $theme = $this->getTheme($bundle);

        static::assertInstanceOf(ThemeTranslationCollection::class$theme->getTranslations());
        static::assertCount(2, $theme->getTranslations());
        $translation = $this->getTranslationByLocale('xx-XX', $theme->getTranslations());
        static::assertEquals([
            'fields.sw-image' => 'test label',
        ]$translation->getLabels());
        
Home | Imprint | This part of the site doesn't use cookies.