This is the community forum. For a developer response use the Client Area.
Follow us on Facebook, Twitter and YouTube!

Yet another take at multi-language setup
#1

To start with: if this thing (multi-language integration) is already working and I've just failed finding it on the forum and on the site, please let me know and I will remove my post as not-useful/redundant.
Meanwhile, here are my two cents.
I have 4-language site. English and French I've downloaded from here. I saw some Spanish related posts but can't see it in the download section. And I am working currently on the Russian translation.
BUT: before doing any translation and looking for new languages, I needed to make sure that the comments module front-end language switches automatically with the change of my site's interface language.
I have to admit that I am not experienced at all in OO programming. So, I might've easily missed something important.

And here goes my solution.
1) on my page where the the Commentics module is included via "require($_SERVER['DOCUMENT_ROOT'] . $cmtx_folder . 'frontend/index.php');",
 before that I've added the following line:
$_SESSION['cur_lang']=$cmtx_cur_language;
where $cmtx_cur_language variable holds "english", "russian" etc.

2) in the file /commentics/system/startup.php right after these lines:
$cmtx_setting = new \Commentics\Setting($cmtx_registry);
$cmtx_registry->set('setting', $cmtx_setting);
I've added one line:
if (isset($_SESSION['cur_lang'])) { $cmtx_setting->set('language_frontend', $_SESSION['cur_lang']); }
This overrides the DB front-end language value with whatever is supplied via that SESSION var.

So far, at least on my local server it worked well.
I didn't have chance to test anything email related though and didn't do any modifications in that area.
So far I've only implemented the English comments on my site.
If this thread lives I will update it later when I add another language.

PS I did see the old solution of someone related to this issue. But I couldn't recognize the folders in his post. And I think it was only applicable to something like Worldpress or some other CMS. Anyway, this wouldn't work for me.
Reply
#2

Yours is a good solution. I added something similar to the development version of Commentics a few weeks ago, so this will be in the next version.

Change 1
https://github.com/commentics/commentics...c1ce852ed0

Change 2
https://github.com/commentics/commentics...3a9bc54cb4

Then in the integration code you can put this:
PHP Code:
<?php 
$cmtx_language
= 'russian';

Have you completed the interview?
Reply
#3

Great! Thank you, Steven!
Will wait for the new version then))
Reply


Possibly Related Threads…
Thread / Author Replies Views Last Post
Last Post by Steven
31-Mar-2023, 06:54 PM
Last Post by pizzaboi
17-Nov-2016, 10:38 PM
Last Post by pizzaboi
17-Nov-2016, 08:12 PM

Forum Jump:


Users browsing this thread: 1 Guest(s)