"Site Interface" translations

Permalink Browser Info Environment
Hi,

Our client has translated 100's of items of text, but one of them is causing problems. We created an auto-responder email in /mail/contact_form_auto_responder.php with the following content;

<?php
defined('C5_EXECUTE') or die("Access Denied.");
$subject = t("Thank you for your inquiry");
$body = t("Thank you for submitting your inquiry, one of our experienced sales engineers will be in touch with you shortly.");
?>


These two items were then translated by the client into French, German, Spanish and Dutch.

For some reason, only the French one is working. The German, Spanish and Dutch ones appear in English.

I have checked everything and think this might be down to Cache - do you know where I can safely clear cache and have them rebuilt properly?

This is how I am calling it, in my code located at "/blocks/form/controller.php"

if(stristr($this->surveyName, "Contact Us"))
{
   // auto responder
   $mh = Loader::helper('mail');
   $mh->to($email);
   $mh->from(FORM_BLOCK_SENDER_EMAIL); 
   $mh->load('contact_form_auto_responder');
   @$mh->sendMail();
}


Kind Regards

James

Type: Discussion
Status: Resolved
jcrooke
View Replies:
Mainio replied on at Permalink Reply
Mainio
Hi James,

I think this came into the wrong add-on (as it's more Translations Manager specific) but doesn't matter as long as we have some reference point for this issue.

If the code that you posted below lies within the action_submit_form function, then it is in fact because of a known bug in concrete5.

There has been some in-depth conversation about this issue with the i18n community members and the core team here:
http://www.concrete5.org/marketplace/addons/internationalization/fo...

If you can also cast your "vote" to fix these issues in that thread, it would be extremely helpful to get these solved some day as the core team would realize that it's not just an issue with few i18n community members.

There is also one suggested solution to the tools/actions issue in that thread and it's this code:
$mh = Loader::helper('default_language', 'multilingual');
$mh->setupSiteInterfaceLocalization();


In addition to that, you'll also need to tell the system which translations you want to load and this is where it gets awkward. You need to do few modifications:
1. In the form that you're submitting, you need to pass the current page CID in the form in order to know the correct language section in the processing code
2. Then in addition to the code posted above, you'll need to tell the system to set the current page to the one that you passed through your hidden field

This happens as follows (e.g. if you used targetCID as the field name):
$target = Page::getByID($_REQUEST['targetCID']);
if (is_object($target) && !$target->isError()) {
  $req = Request::get();
  $req->setCurrentPage($target);
  // AND BELOW THIS LINE, YOU SHOULD ADD THE OTHER CODE SNIPPET
}


Best,
Antti
jcrooke replied on at Permalink Reply
jcrooke
Thanks Antti

I just added this code, at the top of the action_submit_form() function;

$mh = Loader::helper('default_language', 'multilingual');
$mh->setupSiteInterfaceLocalization();


And it fixed it!

Cheers

James
Mainio replied on at Permalink Reply
Mainio
Oh yeah, actually it does. Because the multilingual remembers the last section you've browsed, I didn't remember that!

Great that you got it solved, could you also please post to the other thread as well that you've experienced this issue?
Mainio replied on at Permalink Reply
Mainio
Here's the link once again to the other thread if you missed it:
http://www.concrete5.org/marketplace/addons/internationalization/fo...

concrete5 Environment Information

Browser User-Agent String

Hide Post Content

This will replace the post content with the message: "Content has been removed by an Administrator"

Hide Content

Request Refund

You have not specified a license for this support ticket. You must have a valid license assigned to a support ticket to request a refund.