UPDATES EasyBlog 6.0.14 Released! Joomla 5.x and PHP 8.x compatible now!

Helpdesk

Your Time
Our Time
Response Time
24 — 48 hours
We strive to provide the fastest ever response possible. However, we are not super beings.

Allow at least 24 — 48 hours
  Support is offline
Our team is away during the weekend. Some answers may already be available on our documentation

Rest assured that we will get back to your posts as soon as the week starts!
  Support is offline

Easyblog compatibility with Falang

Martin · ·
1:16 AM Friday, 04 November 2016
None
This post is a continuation of this: https://stackideas.com/forums/easyblog-falang-translation-compatibility#reply-293483

The most important part is that EB include compatibility with Falang as soon as possible.

Now, to help you do this faster, i explain that Falang is a component + plugin that allows to have your site multilingual without having to duplicate content in each language.
The component allows you to translate content of different components.
The plugin "intercept" DB queries.
When user browse website in default language the plugin returns "original" content from original table in DB.
When user browse website in different language the plugin returns the translated content from Falang table in DB.

In the case of EB, on version 3.9 this was working fine. As there was no revision table. So the content was loaded from post table or from falang table.

Now in v5, the revision feature load the EB content from revision table, and this content is JSON coded. Falang would be able to intercept the queries to revision table, but there may be many revisions for a single article, then it will not be possible/practical to translate every revision. Moreover, the revision table hold the post coded in JSON. But falang can only translate HTML.

So the solution to this may be to allow Falang to load content from post table instead of revision when user is browsing translated content in FE.

The actual modification available made by Stephane (creator of Falang) is this code, you should include in /administrator/components/com_easyblog/includes/postpost.php near line 558:


public function checkoutFromRevision()
{
$workbench = $this->revision->getContent();

//start modification
if (JFile::exists(JPATH_ADMINISTRATOR . '/components/com_falang/classes/FalangManager.class.php')) {
$default_site_language =JComponentHelper::getParams('com_languages')->get("site","en-GB");
$JLang = JFactory::getLanguage();
$currentLanguage = $JLang->getTag;
if($currentLanguage != $default_site_language ){
$workbench=null;
}
}
//end modification

if (! $workbench) {

// somehow the revision id is exists but the revisions.content is empty.
// we need to regenerate the revisions.content.
$this->checkoutFromPost();

} else {
$this->setWorkbench($workbench);
}

$this->revision_id = $this->revision->id;
}


But im having problems with this modification. My website is native in Spanish, and Falang translations are in English. But for some strange reason, many of my post are getting overwritten with English content. So now i have the post and the translation in English.

I think this could be caused because when the $workbench = null EB "rebuild" the post with content from #__easyblog_post table. But as Falang returns translated content from falang table instead of post table, the rebuilded post is now in english.
The replies under this section are restricted to logged in users or users with an active subscription with us