[Solved] form builder, bilingual labels

Have a question or a suggestion about a 3rd party addon module or plugin?
Let us know here.
Post Reply
marties
Forum Members
Forum Members
Posts: 34
Joined: Tue Jan 11, 2005 11:22 am

[Solved] form builder, bilingual labels

Post by marties »

Hello,

i'm planning to use the form builder on a bilingual website (english/french) the form i design will send email and write the result to a csv file.

How would you design a unique form with labels in french or english (according to the page) but with same id/name for the elements so that the submitted form will write in the same csv file ?

I also can't manage to have labels correctly encoded in french independently from the form elements (input, select...)


Thanks a lot for your advices


ps: cms is 1.3, formbuilder is 0.5.3
Last edited by marties on Fri Jun 13, 2008 10:03 am, edited 1 time in total.
calguy1000
Support Guru
Support Guru
Posts: 8169
Joined: Tue Oct 19, 2004 6:44 pm

Re: form builder

Post by calguy1000 »

Formbuilder (infact most modules) doesn't support multilang.

But for simple label translations, this can probably be done with a few simple modifications to the module, a template rewrite, and a few small module_custom/FormBuilder/lang/.php files.

1) do a backup
2) in FormBuilder/FormBuilder.module.php:DoAction
    add:  $smarty->assign_by_ref('formbuilder',$this);
3) in your form templates, change this stuff:

Code: Select all

<label{if $entry->multiple_parts != 1} for="{$entry->input_id}"{/if}>{$entry->name}
to

Code: Select all

<label{if $entry->multiple_parts != 1} for="{$entry->input_id}"{/if}>{$formbuilder->Lang(entry->name)}
4) Create two files:
module_custom/FormBuilder/lang/en_US.php
module_custom/FormBuilder/lang/fr_FR.php

and in those php files (so you need at the bottom
add lines like this:
$lang['XXXX'] = 'something';
where XXXX is the field names you've created.
Follow me on twitter
Please post system information from "Extensions >> System Information" (there is a bbcode option) on all posts asking for assistance.
--------------------
If you can't bother explaining your problem well, you shouldn't expect much in the way of assistance.
marties
Forum Members
Forum Members
Posts: 34
Joined: Tue Jan 11, 2005 11:22 am

Re: form builder

Post by marties »

Thanks for your help,

i'm stuck with these errors while browsing the page :

Notice: Undefined variable: smarty in /home/biodev/www/modules/FormBuilder/FormBuilder.module.php on line 181

Fatal error: Call to a member function assign_by_ref() on a non-object in /home/biodev/www/modules/FormBuilder/FormBuilder.module.php on line 181



Here is what i've done :

1- in /config.php i've enabled smary tags
$config['use_smarty_php_tags'] = true;

2- in /modules/FormBuilder/FormBuilder.module.php:DoAction  (you mean in the DoAction function !? Yes ?)

i have added the smarty line (line 181 in the file)

function DoAction($name,$id,$params,$returnid='')
{
$smarty->assign_by_ref('formbuilder',$this);
$this->module_id = $id;
parent::DoAction($name,$id,$params,$returnid);
}

3- i've modified the form template accordingly

4- created the two files in /module_custom/FormBuilder/lang/


Thanks
marties
Forum Members
Forum Members
Posts: 34
Joined: Tue Jan 11, 2005 11:22 am

Re: [Solved] form builder, bilingual labels

Post by marties »

Hello,

as there was no news from anyone to my post and as the answer from Calguy1000 (thanks a lot anyway for your time spread) unfortunately didn't work, i made the labels show both language on the same form.

For example:

First name / Prénom

After the submit i redirect on a thank you page accordingly to the language.
Sonya

Re: form builder

Post by Sonya »

marties wrote: $smarty->assign_by_ref('formbuilder',$this);
should be
$this->smarty->assign_by_ref('formbuilder',$this);
marties
Forum Members
Forum Members
Posts: 34
Joined: Tue Jan 11, 2005 11:22 am

Re: [Solved] form builder, bilingual labels

Post by marties »

too bad it's a bit late

i'll try for my next dev

Thanks
Post Reply

Return to “Modules/Add-Ons”