Multilanguage simple form

Shows some Tutorials

Multilanguage simple form

Postby Cumenda on Wed Oct 03, 2007 4:51 pm

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:
Code: Select all
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:
Code: Select all
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
Cumenda
Fresh Boarder
 
Posts: 3
Joined: Wed Oct 03, 2007 9:36 am

Re:Multilanguage simple form

Postby GreyHead on Wed Oct 03, 2007 5:34 pm

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:
Code: Select all
<?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
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: 3176
Joined: Tue May 29, 2007 10:15 pm
Location: Brittany

Re:Multilanguage simple form

Postby Cumenda on Wed Oct 03, 2007 7:16 pm

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
Cumenda
Fresh Boarder
 
Posts: 3
Joined: Wed Oct 03, 2007 9:36 am

Re:Multilanguage simple form

Postby mamboklaus on Sun Jun 01, 2008 11:30 am

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:
Code: Select all
<?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!
mamboklaus
Fresh Boarder
 
Posts: 3
Joined: Sun Jun 01, 2008 11:18 am

Re:Multilanguage simple form

Postby GreyHead on Sun Jun 01, 2008 3:28 pm

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
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: 3176
Joined: Tue May 29, 2007 10:15 pm
Location: Brittany

Re:Multilanguage simple form

Postby mamboklaus on Sun Jun 01, 2008 3:50 pm

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
mamboklaus
Fresh Boarder
 
Posts: 3
Joined: Sun Jun 01, 2008 11:18 am

Re:Multilanguage simple form

Postby GreyHead on Sun Jun 01, 2008 5:05 pm

Hi Klaus,

Not tested but try this please:
Code: Select all
<?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
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: 3176
Joined: Tue May 29, 2007 10:15 pm
Location: Brittany

Re:Multilanguage simple form

Postby mamboklaus on Sun Jun 01, 2008 5:12 pm

mhh
sorry...
I put this in:
Code: Select all
<?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..
mamboklaus
Fresh Boarder
 
Posts: 3
Joined: Sun Jun 01, 2008 11:18 am


Return to How To

Who is online

Users browsing this forum: No registered users and 4 guests