source/php/Event.php
public function saveLanguage()
    {
        // Bail if Polylang is not active
        if (!is_plugin_active('polylang-pro/polylang.php')) {
            return;
        }

        // Apply language to the event
        if (!empty($this->lang)) {
            pll_set_post_language($this->ID, $this->lang);
        }

        // Define which events are translations of each other
        if (!empty($this->translations)) {
            $translations = $this->translations;
            // Get locally installed languages
            $localLangs = pll_languages_list();
            // Remove all languages that don't exist locally
            $translations = array_filter(
                $translations,
                function ($translation) use ($localLangs) {
                    return in_array($translation, $localLangs);
                },
                ARRAY_FILTER_USE_KEY
            );

            // Replace the old IDs with new events IDs
            foreach ($translations as $key => &$id) {
                $id = $this->getEventByOriginalId($id);
                if (!$id) {
                    // Remove if event cant't be found
                    unset($translations[$key]);
                }
            }
            // Define event translations
            pll_save_post_translations($translations);
        }
    }
public function saveLanguage()
    {
        // Bail if Polylang is not active
        if (!is_plugin_active('polylang-pro/polylang.php')) {
            return;
        }

        // Apply language to the event
        if (!empty($this->lang)) {
            pll_set_post_language($this->ID, $this->lang);
        }

        // Define which events are translations of each other
        if (!empty($this->translations)) {
            $translations = $this->translations;
            // Get locally installed languages
            $localLangs = pll_languages_list();
            // Remove all languages that don't exist locally
            $translations = array_filter(
                $translations,
                function ($translation) use ($localLangs) {
                    return in_array($translation, $localLangs);
                },
                ARRAY_FILTER_USE_KEY
            );

            // Replace the old IDs with new events IDs
            foreach ($translations as $key => &$id) {
                $id = $this->getEventByOriginalId($id);
                if (!$id) {
                    // Remove if event cant't be found
                    unset($translations[$key]);
                }
            }
            // Define event translations
            pll_save_post_translations($translations);
        }
    }
Apply language and translations to the event.
Compatible with the plugin 'Polylang'