Multilanguage simple form

Cumenda 03 Oct, 2007
Hi,
I'm working on a restiling of my website with joomla and I'm testing the ChronoEngine component for 2 forms and It looks great!
I have no experience in programming but anyway the component seems easy to work for my simple forms.
The site is multilingual (Joomfish component for translate the contents): Italian / English.
How I can set up the form to work with the above languages?

Just to understand, and working with the basic form You have on Your website how I can have the fields in the correct language selected with Joomfish?:

English:

Company: <input name="name" value="" type="text"><br />
E-mail: <input name="email" value="" type="text"><br />
<input name="submit" value="Submit" type="submit">


Italian:

Società: <input name="name" value="" type="text"><br />
E-mail: <input name="email" value="" type="text"><br />
<input name="submit" value="Submit" type="submit">


Thank You for Your support<br><br>Post edited by: Cumenda, at: 2007/10/03 12:52
GreyHead 03 Oct, 2007
Hi Cumenda,

Here's some code from another thread that should make this work. In the ChronoForms HTML field put your form code using a structure like this:
<?php
global $mosConfig_lang;
switch ( $mosConfig_lang) {

case 'italian':
?>
// Italian code goes here
<?php
break;

case 'english':
default:
?>
// English code goes here
<?php
break;
}
?>
This will work with any number of languages by adding extra 'case . . . break' blocks and will default to english if nothing is specified.

Make sure that the case 'languagename' has an entry that matches the Joomla language identifier.

If your code is complex it may be simpler to define text variables here and use those in the code later, that way you only have to put the html in once and it's much easier to maintain. There's an example of that in this thread.

Bob
Cumenda 03 Oct, 2007
Hi Bob,
Your support is very serious!
Now, the form automatically switch between Italian and English.
I will do some other tests with ChronoEngine component than I would like to support Your great work with a new registration.
Thank You again
Ciao
mamboklaus 01 Jun, 2008
Hi all of you!
First of all:
Thanks for this cool chronoforms! It took me only half n hour to understand, thats great!
But this multilanguage thing makes me headache🙂
I put this code in the form html code aerea:
<?php global $mosConfig_lang; switch ( $mosConfig_lang) { case 'english': ?>
<p>english html paste here:</p>
<?php break; case 'german': default: ?>
<p>german html paste here: and its the default language!</p>
<?php break; } ?>
but whether I change to english or german its all the same --> german
Joommla Version 1.5.3 - Chronoforms 2.5 J1.5 RC3.1
Maybe I use the wrong case 'language', becasue whether I use any other language - which I did not install it always show german..
I have no experience in php.. who can help me to fin my mistake.
At the end: sorry for my english.. its a real german english🙂
Thank you all out ther for helping!
GreyHead 01 Jun, 2008
Hi mamboklaus,

That's code from Joomla 1.0.x - the $mosConfig_lang - so probably won't work with Joomla 1.5 unless legacy mode is on. There will be an equivalent for Joomla 1.5 but it has to be hunted down.

Bob
mamboklaus 01 Jun, 2008
Thanks Bob,
at least I know that I did nothing wrong:-) So I need to find another way for my 2 language form.. mhhhh
regards from gemany
klaus
GreyHead 01 Jun, 2008
Hi Klaus,

Not tested but try this please:
<?php 
$lang =& JFactory::getLanguage();
switch ( $lang->getName() ) {
  case 'english': 
?> 
<p>english html paste here:</p> 
<?php
  break; 
  case 'german': 
  default: 
?> 
<p>german html paste here: and its the default language!</p> 
<?php 
  break; 
} 
?>
Bob
mamboklaus 01 Jun, 2008
mhh
sorry...
I put this in:
<?php 
$lang =& JFactory::getLanguage();
switch ( $lang->getName() ) {
case 'english': 
?> 
<p>english html paste here:</p> 
<?php
break; 
case 'german': 
default: 
?> 
<p>german html paste here: and its the default language!</p> 
<?php 
break; 
} 
?>
but still only shows german ... sth else wrong maybe need to check..
This topic is locked and no more replies can be posted.