Multilingual: Publish in multiple languages

Permalink
Hi,

I'm looking for a way for page editors to publish a page in multiple languages straight away.
The optimal solution would be checkboxes for all site languages, and when checked the page is published to all of those. Translation is not important at this stage.

Would this be possible using a custom attribute perhaps?

Edit:
I guess I want to call "create_new" on publish?
https://documentation.concrete5.org/api/8.0/Concrete/Controller/Back...

Thanks
Michael

View Replies:
skorge replied on at Permalink Reply
Anyone?

I guess I want to do something similar to what the Multilingual Blog extension does, but default all content to the same language.

https://www.concrete5.org/marketplace/addons/multilingual-blogs...
skorge replied on at Permalink Reply
I think I am on my way to find a solution to my problem. However I am a bit stuck at the end of it.

My idea is to listen for the page publish event, and then look at the page type and custom attributes for additional languages to publish in. The code below from /application/bootstrap/app.php passes trough without any errors, but it seems to just add a new version draft for the original locale instead of setting up a new page in the target locale.

Can anyone give me any hints what to look at?

<?php
Events::addListener('on_page_type_publish', function($event) {
    $page = $event->getPageObject();
    if ($page->getPageTypeHandle() == 'blog_entry') {
        $multilingualController = Core::make('\Concrete\Controller\Backend\Page\Multilingual');
        $multilingualController->setPageObject($page);
        $pageCollection = $page->getCollectionID();
        $pageSection = \Concrete\Core\Multilingual\Page\Section\Section::getBySectionOfSite($page);
        $pageLocaleText = $pageSection->getLanguageText();
        $targetLocale = \Concrete\Core\Multilingual\Page\Section\Section::getByLocale('nb_NO'); //Will be set from page attribute
        $targetLocaleCollection = $targetLocale->getCollectionID();
        $createNewData = array(
        'section' => $targetLocaleCollection,
        'cID' => $pageCollection
    );