Skip to content
Discussion options

You must be logged in to vote

You could pull that off with a custom module that listens to the Element::EVENT_DEFINE_KEYWORDS event:

use craft\base\Element;
use craft\base\Event;
use craft\events\DefineAttributeKeywordsEvent;

Event::on(Element::class, Element::EVENT_DEFINE_KEYWORDS, function(DefineAttributeKeywordsEvent $event) {
    /** @var Element $element */
    $element = $event->sender;

    if (empty($element->useGermanContent) || $element->site->handle === 'de') {
        return;
    }

    /** @var Element|null $localized */
    $localized = $element->getLocalized()->site('de')->one();

    if ($localized) {
        $event->keywords = $localized->getSearchKeywords($event->attribute);
    }
});

Replies: 2 comments 3 replies

Comment options

You must be logged in to vote
3 replies
@ursbraem
Comment options

@brandonkelly
Comment options

Answer selected by ursbraem
@ursbraem
Comment options

Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Ideas
Labels
internationalization 🌐 features related to internationalization or localization
3 participants