Conversation block form translation SOLVED
Permalink
Just wanted to share what I just learned:
I recently built a multilingual site with C5.7.5.8 and noticed that while everything else was working fine, the Conversation block was always using the default language of the site, which was problematic, because the block was used on different language sections. The conversation form is retrieved with AJAX and that request seems to not "honor" the language of the page that the block is on, but rather uses the default language.
Finally got it to work as expected. This might be a bit hacky, but at least it works. I put the following code to /concrete/elements/conversation/display.php (or corresponding override!) after line 9:
Special thanks goes to mlocati in this thread:
https://www.concrete5.org/community/forums/internationalization/lang...
EDIT: Referenced wrong file. The correct one is /concrete/elements/conversation/display.php
I recently built a multilingual site with C5.7.5.8 and noticed that while everything else was working fine, the Conversation block was always using the default language of the site, which was problematic, because the block was used on different language sections. The conversation form is retrieved with AJAX and that request seems to not "honor" the language of the page that the block is on, but rather uses the default language.
Finally got it to work as expected. This might be a bit hacky, but at least it works. I put the following code to /concrete/elements/conversation/display.php (or corresponding override!) after line 9:
$ms = \Concrete\Core\Multilingual\Page\Section\Section::getBySectionOfSite($page); if (is_object($ms)) { Localization::changeLocale($ms->getLocale()); }
Special thanks goes to mlocati in this thread:
https://www.concrete5.org/community/forums/internationalization/lang...
EDIT: Referenced wrong file. The correct one is /concrete/elements/conversation/display.php
https://github.com/concrete5/concrete5/pulls...
This way it will be fixed in upcoming concrete5 versions and you don't have to apply an override (or fix the original file every time)!