27-Mar-2023, 08:30 AM
I have been using Commentics for a few months, and it is a great product.
I have customized Commentics for the Finnish and English languages. I load the Commentics area to webpages by an AJAX call. The call will be handled with the following code.
This code works well. Commentics appears in Finnish on Finnish pages and in English on other pages. However, when a user submits a new comment (=makes AJAX call), the replies are always in English. It seems that the language information is not passed. What should I modify so that the language information would be passed in AJAX calls so the replies would be in the same language as the form.
I have customized Commentics for the Finnish and English languages. I load the Commentics area to webpages by an AJAX call. The call will be handled with the following code.
Code:
if (!isset($_POST["article"]) || !isset($_POST["language"])) return "Comment area parameters missing";
$cmtx_identifier = $_POST["article"];
$cmtx_reference = [code_that_return_pagetitle];
$cmtx_url = [code_that_returns_page_url];
$cmtx_folder = '/comments/';
if ([code_that_return_website_language] == "fi") $cmtx_language = "finnish";
else $cmtx_language = "english";
require($_SERVER['DOCUMENT_ROOT'] . $cmtx_folder . 'frontend/index.php');
This code works well. Commentics appears in Finnish on Finnish pages and in English on other pages. However, when a user submits a new comment (=makes AJAX call), the replies are always in English. It seems that the language information is not passed. What should I modify so that the language information would be passed in AJAX calls so the replies would be in the same language as the form.