multilingual forms

Post any questions you may have here

multilingual forms

Postby jef2904 on Wed Jun 20, 2007 5:39 am

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.


Code: Select all
<? 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: ' ;

?>






jef2904
Fresh Boarder
 
Posts: 1
Joined: Tue Jun 19, 2007 10:24 pm

Re:multilingual forms

Postby GreyHead on Wed Jun 20, 2007 11:05 am

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
Bob Janes
info at greyhead.net
ChronoForms Support If you like ChronoForms please vote or post a review at Joomla.org
User avatar
GreyHead
Platinum Boarder
 
Posts: 3788
Joined: Tue May 29, 2007 10:15 pm
Location: Brittany

Re:multilingual forms

Postby admin on Wed Jun 20, 2007 4:35 pm

Hi,

You can switch joomfish languages by this variable :

Code: Select all
<?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
ChronoForms/ChronoConnectivity/ChronoComments Developer Thanks for using our components!
If you have any problems with any extension please tell us.
If you like any of our extensions please post a review at Joomla.org
Want users to submit their content to your website ? try Submit Story
Want to list/edit/delete your data ? try ChronoConnectivity
Want to have stylish AJAX comments ? try ChronoComments
User avatar
admin
Platinum Boarder
 
Posts: 4034
Joined: Mon Aug 14, 2006 5:29 am

Re:multilingual forms

Postby GreyHead on Wed Jun 20, 2007 5:49 pm

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:
Code: Select all
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
Bob Janes
info at greyhead.net
ChronoForms Support If you like ChronoForms please vote or post a review at Joomla.org
User avatar
GreyHead
Platinum Boarder
 
Posts: 3788
Joined: Tue May 29, 2007 10:15 pm
Location: Brittany

Re:multilingual forms

Postby admin on Wed Jun 20, 2007 7:14 pm

Yeah, good catch, thanks Bob!!!
ChronoForms/ChronoConnectivity/ChronoComments Developer Thanks for using our components!
If you have any problems with any extension please tell us.
If you like any of our extensions please post a review at Joomla.org
Want users to submit their content to your website ? try Submit Story
Want to list/edit/delete your data ? try ChronoConnectivity
Want to have stylish AJAX comments ? try ChronoComments
User avatar
admin
Platinum Boarder
 
Posts: 4034
Joined: Mon Aug 14, 2006 5:29 am

Re:multilingual forms

Postby chini on Tue Jul 31, 2007 1:14 am

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
chini
Fresh Boarder
 
Posts: 1
Joined: Mon Jul 30, 2007 6:04 pm

Re:multilingual forms

Postby GreyHead on Tue Jul 31, 2007 4:16 am

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
Bob Janes
info at greyhead.net
ChronoForms Support If you like ChronoForms please vote or post a review at Joomla.org
User avatar
GreyHead
Platinum Boarder
 
Posts: 3788
Joined: Tue May 29, 2007 10:15 pm
Location: Brittany

Re:multilingual forms

Postby CyberWoolf on Fri Aug 31, 2007 2:40 am

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?
CyberWoolf
Fresh Boarder
 
Posts: 10
Joined: Mon Aug 20, 2007 11:33 pm

Re:multilingual forms

Postby admin on Fri Aug 31, 2007 3:58 am

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 :

Code: Select all
<?php
global $mosConfig_lang;
if($mosConfig_lang == 'english'){
?>
English form code here
<?php
}else{
?>
French form code goes here
<?php
}
?>
ChronoForms/ChronoConnectivity/ChronoComments Developer Thanks for using our components!
If you have any problems with any extension please tell us.
If you like any of our extensions please post a review at Joomla.org
Want users to submit their content to your website ? try Submit Story
Want to list/edit/delete your data ? try ChronoConnectivity
Want to have stylish AJAX comments ? try ChronoComments
User avatar
admin
Platinum Boarder
 
Posts: 4034
Joined: Mon Aug 14, 2006 5:29 am

Re:multilingual forms

Postby CyberWoolf on Thu Sep 13, 2007 3:54 am

Thank you so much! Worked great!
CyberWoolf
Fresh Boarder
 
Posts: 10
Joined: Mon Aug 20, 2007 11:33 pm

Re:multilingual forms

Postby joayala on Thu Jan 03, 2008 5:35 am

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
joayala
Fresh Boarder
 
Posts: 18
Joined: Sun Dec 30, 2007 7:18 pm

Re:multilingual forms

Postby GreyHead on Thu Jan 03, 2008 6:35 am

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: Select all
   ['required', 'This is a required field.', function(v) {
Bob
Bob Janes
info at greyhead.net
ChronoForms Support If you like ChronoForms please vote or post a review at Joomla.org
User avatar
GreyHead
Platinum Boarder
 
Posts: 3788
Joined: Tue May 29, 2007 10:15 pm
Location: Brittany

Re:multilingual forms

Postby joayala on Fri Jan 04, 2008 7:03 am

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.
joayala
Fresh Boarder
 
Posts: 18
Joined: Sun Dec 30, 2007 7:18 pm

Re:multilingual forms

Postby GreyHead on Fri Jan 04, 2008 5:14 pm

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

Image<br><br>Post edited by: GreyHead, at: 2008/01/04 12:15
Bob Janes
info at greyhead.net
ChronoForms Support If you like ChronoForms please vote or post a review at Joomla.org
User avatar
GreyHead
Platinum Boarder
 
Posts: 3788
Joined: Tue May 29, 2007 10:15 pm
Location: Brittany

Re:multilingual forms

Postby joayala on Sat Jan 05, 2008 9:29 am

Thanks Bob, now is working.

I was using Joomla Xplorer to edit that file and at the end it was inserting "&amp;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
joayala
Fresh Boarder
 
Posts: 18
Joined: Sun Dec 30, 2007 7:18 pm

Next

Return to ChronoForms Questions & Answers

Who is online

Users browsing this forum: GreyHead, MSN [Bot], MSNbot Media, Yahoo [Bot] and 5 guests