Forums

Translating parts generated on events does not work

Marysia 16 May, 2016
Hi guys!

I have a problem, please help!

I have form on the multi-language page. I use events to generate parts of the form:
for example:
on = Puppy tunnel Set options Color
Pink = _Pink_
Blue=_Blue_

and I have locals to translate this _Pink_ to "Pink" or "Rosa" depending on the visitor's language.

I've just update everything - joomla and chronoform - and this parts are not translated any more. On the front-end I have _Pink_, _Blue_ in all languages.
It worked perfectly before updates and I've changed nothing in the form...
Any idea?
GreyHead 17 May, 2016
Hi Marysia,

Hmmm . . . I haven't seen this before. Do you know what versions you upgraded from? There haven't been any recent changes in the Locales code as far as I know.

Please take a Form Backup using the icon in the Forms Manager and post it here (use the private tags if you like) and I'll take a closer look.

Bob
Marysia 17 May, 2016
Hi,
I'm sorry, I didn't notice what version I had before.
I attached file, as you wish, but I'm not sure how to make it private?

This is private content

GreyHead 17 May, 2016
Hi Marysia,

To make an attachment private you have to put it 'inline' after uploading then put the 'private' tags round the link - I've done that for you as you can't edit posts here :-(

Bob
Marysia 17 May, 2016
Thanks a lot!
GreyHead 17 May, 2016
1 Likes
Hi Marysia,

There is a bug and I think I have a fix for you.

Please edit the file /administrator/components/com_chronoforms5/chronoforms/actions/html/html.php and,around line 649 add the extra line shown here:
        foreach($lines as $line){
          $opts = explode("=", $line);
          $options[$opts[0]] = $opts[1];
          $opts[1] = $form->translate($opts[1]); // <- add this line
          $return .= $target_field.'.append(\'<option value="'.$opts[0].'">'.trim($opts[1]).'</option>\');'."\n";
        }

Bob
Marysia 23 May, 2016
Hi GreyHead,
thank you very much! I really appreciate your help 🤔

I did what you've said and it works perfectly🙂
Thanks once more!
This topic is locked and no more replies can be posted.