Differentiate link depending on language

NJM 04 Jun, 2015
Hi,

I read and used succesfully a very interesting tut on how to replace the Registration link to a chronoform-form.
https://www.chronoengine.com/faqs/57-cfv4/cfv4-actions/2634-how-can-i-replace-the-joomla-registration-link.html
I was wondering how i can split the redirect to different pages/languages. Now it goes to default with a redirect.

<?php
$app = JFactory::getApplication();
$app->redirect('index.php?option=com_chronoforms5&chronoform=my_form_name');
?>

What if you want the English one go to ('index.php?option=com_chronoforms5&chronoform=my_form_name_english'); and the French one go to ('index.php?option=com_chronoforms5&chronoform=my_form_name_french');

Thanks in advance for feedback
Kind regards
GreyHead 04 Jun, 2015
Hi noeljm,

First, I would avoid having separate forms for different languages, the Locales settings in ChronoForms will (almost always) allow you to show the same form in different languages. Please see this FAQ

If you do need to go to different forms you can use the Joomla! language methods:
<?php
$lang = JFactory::getLanguage();
$tag = $lang->getTag();
switch ( $tag ) {
  case 'en-GB':
    $form_name = 'my_form_name_english';
    break;
  case 'fr-FR':
    $form_name = 'my_form_name_french';
    break;
}
$app = JFactory::getApplication();
$app->redirect('index.php?option=com_chronoforms5&chronoform='.$form_name);
?>

Bob
This topic is locked and no more replies can be posted.