multilingual forms

jef2904 20 Jun, 2007
i am using joomfish for mulitilingual support on my website i add this php code below to the forms but joomfish does not use the
?lang=XX in the url every time only the first time you enter how can i make it show it even though it doesn't have that.



<? if (($_GET['lang']) == 'en')
{
$error = 'Please fill in the requiered fields';
$firstname = 'First Name: ';
$lastname = 'Last Name: ';
$companyname = 'Company Name: ' ;
$companytitle = 'Title: ' ; 
$email2 = 'Email: ' ;
$telephone = 'Phone: ' ;
$interest = 'Service of Primary Interest: ' ;
}
else if (($_GET['lang'] == 'es'))
{
$error = 'Por favor llena los campos obligatoios marcados con un asteriscos.';
$firstname = 'Nombre: ';
$lastname = 'Apellido: ';
$companyname = 'Nombre de Compañia: ' ;
$companytitle = 'Titulo: ' ; 
$email2 = 'Correo Electronico: ' ;

?>






GreyHead 20 Jun, 2007
Hi,

I'm not sure what you mean by "does not use the ?lang=XX in the url every time"? Is this when the page is submitted and there is a validation problem? Or when you use the same url a second time?

Bob
Max_admin 20 Jun, 2007
Hi,

You can switch joomfish languages by this variable :


<?php

global $mosConfing_lang;

 if ($mosConfing_lang == 'english')

{

$error = 'Please fill in the requiered fields';

$firstname = 'First Name: ';

$lastname = 'Last Name: ';

$companyname = 'Company Name: ' ;

$companytitle = 'Title: ' ; 

$email2 = 'Email: ' ;

$telephone = 'Phone: ' ;

$interest = 'Service of Primary Interest: ' ;

}

else if ($mosConfing_lang == 'espanish')

{

$error = 'Por favor llena los campos obligatoios marcados con un asteriscos.';

$firstname = 'Nombre: ';

$lastname = 'Apellido: ';

$companyname = 'Nombre de Compañia: ' ;

$companytitle = 'Titulo: ' ; 

$email2 = 'Correo Electronico: ' ;



?>


This time languages by its name at the language manager!

Cheers

Max
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
GreyHead 20 Jun, 2007
Hi,

I'm pretty certain that Max meant to type $mosConfig_lang (without the extra 'n').

This is also a good place to use a switch statement:
global $mosConfig_lang;
switch ( $mosConfig_lang) {

case 'espanish':
  $error        = 'Por favor llena los campos obligatoios marcados con un asteriscos.';
  $firstname    = 'Nombre: ';
  $lastname     = 'Apellido: ';
  $companyname  = 'Nombre de Compañia: ' ;
  $companytitle = 'Titulo: ' ; 
  $email2       = 'Correo Electronico: ' ;
  $telephone    = 'Phone: ' ;
  $interest     = 'Service of Primary Interest: ' ;
break;

case 'english':
default:
  $error        = 'Please fill in the required fields';
  $firstname    = 'First Name: ';
  $lastname     = 'Last Name: ';
  $companyname  = 'Company Name: ' ;
  $companytitle = 'Title: ' ; 
  $email2       = 'Email: ' ;
  $telephone    = 'Phone: ' ;
  $interest     = 'Service of Primary Interest: ' ;
break;
}
Bob

Post edited by: GreyHead, at: 2007/06/20 13:50<br><br>Post edited by: GreyHead, at: 2007/06/20 13:53
Max_admin 20 Jun, 2007
Yeah, good catch, thanks Bob!!!
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
chini 31 Jul, 2007
Hi
I'm new to Chronoforms. I don't know where I have to put this code for switching the languages.

Thanks for your help.

Cheers

Chini
GreyHead 31 Jul, 2007
Hi chini,

Exactly what are you trying to do?

There's an example in this thread of a form that switches between two languages depending on the language the user has in their profile. Would this do what you need?

Bob
CyberWoolf 31 Aug, 2007
This is great! I was just asked about this.. where exactly do you put this wonderful bit of code? Does it go in the form html area or called in a file?
Max_admin 31 Aug, 2007
Hi,

You can do this in the form HTML box, use the $mosConfig_lang global variable to switch between different form codes based on language :


<?php
global $mosConfig_lang;
if($mosConfig_lang == 'english'){
?>
English form code here
<?php
}else{
?>
French form code goes here
<?php
}
?>
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
CyberWoolf 13 Sep, 2007
Thank you so much! Worked great!
joayala 03 Jan, 2008
I'm testing this great component and my site is in spanish, can some one tell me how can I change the language only for the validation message errors?

Thanks in advance
Jos
GreyHead 03 Jan, 2008
Hi Jos,

The error messages are all in components/com_chronocontact/js/validation.js near the end of the file (around line 228). I think you can just replace the English phrase with a Spanish one. Here's the first one:[code] ['required', 'This is a required field.', function(v) {[/code]Bob
joayala 04 Jan, 2008
thanks for your answer Bob,

To test, I changed only that line...

from:

['required', 'This is a required field.', function(v) {

to

['required', 'Este dato es requerido.', function(v) {

But now, it doesn't work the validation and using firebug it show me errors in the "v has no properties" in "validation.js" file.

Any clue how to fix that?

Regards
Jos

BTW I just paid for a license of your component.
GreyHead 04 Jan, 2008
Hi Jos,

Thanks for buying the license.

Changing the validation.js file works OK for me (see image). Please check carefully that there aren't any typos creeping in. I also had to force a cache refresh of the form page to get the new text to show up.

Bob

multilingual forms image 1<br><br>Post edited by: GreyHead, at: 2008/01/04 12:15
joayala 05 Jan, 2008
Thanks Bob, now is working.

I was using Joomla Xplorer to edit that file and at the end it was inserting "&nbsp;" instead of spaces, I don't no way, but the good news is that now is working my translation.

Regards
Jos<br><br>Post edited by: GreyHead, at: 2008/01/05 12:36
GreyHead 05 Jan, 2008
Hi Jos,

Yes, &nspb; would break the JavaScript for sure. Good catch.

Bob
joayala 09 Jan, 2008
BTW... great component, congrats!!

Regards
Jos
gscholman 20 Oct, 2008
Hey guys,

I am kind of getting the point of how to make the forms work with Joom!Fish. But i have like 6 languages on my site. What is the code then going to be? I'm totally not a PHP coder. I use the latest Chronoforms and Joomfish version.

Thanks in advance
This topic is locked and no more replies can be posted.