<?php
$lang =& JFactory::getLanguage();
switch ( $lang->getName() ) {
case 'english':
?>
english form code
<?php
break;
case 'nederlands':
default:
?>
Dutch form code
<?php
break;
}
?>
......but this solution is not working for me. Form jumps to default language and stays there. Do someone knows how to?
I'm using Joomla 1.5 face-meh-blank
Add a line of code to echo $lang->getName() and see what values are being returned. This *should* work if you have the correct (case-sensitive) values in the cases.
Bob
Hi NickN,
Add a line of code to echo $lang->getName() and see what values are being returned. This *should* work if you have the correct (case-sensitive) values in the cases.
Bob
Tnx for the replay Bob. I have replaced the code:
switch ( $lang->getName() )
With this one:
echo $lang->getName();?>
This is the replay I have:
Parse error: syntax error, unexpected T_CASE in W:\var\www\test\components\com_chronocontact\chronocontact.html.php(83) : eval()'d code on line 72
I supposed to change the case to right one (line 72 is the case)? Is this right?
Thank you man to point me the right way. My case was not right, echo showed me the right language. Replaced and runs like hell🙂
Great tool, time to by a license😉
Thanks
Lee
whats your joomla version ? can you show me the progress you made with the code, the steps above posted by Bob are straight forward.
cheers,
Max
Thanks
Lee
Cheers
Max
<?php
$lang =& JFactory::getLanguage();
echo $lang->getName();
switch ( $lang->getName() ) {
{
case 'english':
?>
english form code
<?php
break;
case 'welsh':
default:
?>
Welsh form code
This displays no content.
Thanks
<?php
$lang =& JFactory::getLanguage();
echo $lang->getName() ) {
{
case 'english':
?>
english form code
<?php
break;
case 'welsh':
default:
?>
Welsh form code
<?php
$lang =& JFactory::getLanguage();
echo $lang->getName();
switch ( $lang->getName() ) {
{
case 'english':
?>
english form code
<?php
break;
case 'welsh':
default:
?>
Welsh form code
<?php
break;
}
?>
Thanks
That's how the language files work in the basic Joomal 1.5 (without Joomfish) so it sounds perfect.
Bob
Lee
Hope you have a solution for this also, i want my form not in 2 different languages but in 8 (english, usa, dutch, german, polish, italian, french and russian). English and USA can be the same language. I really hope there is a solution for this beceause i really need this.
Regards,
Gijs
Either method could be adapted to include on of 8 languages.
Perhaps others can provide the php for listing more than two options in the PHP, I'm no PHP expert.
Thank's in advance!
Regards,
Gijs
Show me here a "piece" of your form code with one or two fields with their labels and I will show you an example!
Cheers,
Max
<div class="form_item">
<div class="form_element cf_heading">
<h4 id="" class="cf_text">Personal details:</h4></div>
<div class="clear"> </div></div>
<div class="form_item">
<div class="form_element cf_textbox">
<label class="cf_label">Name:</label><input class="cf_inputbox required" maxlength="150" size="30" id="text_2" name="text_2" type="text"></div>
<div class="clear"> </div></div>
<div class="form_item"><div class="form_element cf_textbox"><label class="cf_label">Organisation:</label><input class="cf_inputbox required" maxlength="150" size="30" id="text_3" name="text_3" type="text"></div>
<div class="clear"> </div></div>
<div class="form_item"><div class="form_element cf_textbox"><label class="cf_label">Address:</label><input class="cf_inputbox required" maxlength="150" size="30" id="text_4" name="text_4" type="text"></div>
These are the first 3 fields. I didn't yet label all the fields with a unique name (made this form with the Form wizard).
Name
with: <?php echo JText::_( 'NAME' ) ?>
for example and then go to the language file of your site and add: NAME=Name
or Name=Nom
whatever your language was.Cheers,
Max
Just to add a bit to Max's reply. You can safely use the format of
<?php echo JText::_( 'Please enter your name' ) ?>
If there is a language define like PLEASE ENTER YOUR NAME=Geef uw naam
nl-NL.com_chronocontact.ini file or PLEASE ENTER YOUR NAME=Inserisci il tuo nome
in the it-IT.com_chronocontact.ini file then Joomla will use these values depending on the current language setting for the site or the user. If the entry isn't found then it will default to 'Please enter your name'.Bob
1.
<?php
$lang =& JFactory::getLanguage();
echo $lang->getName();
switch ( $lang->getName() ) {
{
case 'English':
?>
[b]
<div class="form_item"><div class="form_element cf_heading"><h3 id="" class="cf_text">Online Trading Platform</h3></div><div class="clear"> </div></div><div class="form_item"><div class="form_element cf_text"><span class="cf_text">Please fill the details below in order to open a new account</span></div><div class="clear"> </div></div><div class="form_item"><div class="form_element cf_textbox"><label class="cf_label">Name</label><input class="cf_inputbox required validate-alphanum" maxlength="50" size="30" id="text_2" name="text_2" type="text"><a onclick="return false;" class="tooltiplink"><img src="components/com_chronocontact/css/images/tooltip.png" class="tooltipimg" border="0" width="16" height="16"></a><div class="tooltipdiv">Name :: Please fill your name here</div></div><div class="clear"> </div></div><div class="form_item"><div class="form_element cf_textbox"><label class="cf_label">Last Name</label><input class="cf_inputbox validate-alphanum" maxlength="50" size="30" id="text_4" name="text_4" type="text"><a onclick="return false;" class="tooltiplink"><img src="components/com_chronocontact/css/images/tooltip.png" class="tooltipimg" border="0" width="16" height="16"></a><div class="tooltipdiv">Last Name :: Your last name</div></div><div class="clear"> </div></div><div class="form_item"><div class="form_element cf_textbox"><label class="cf_label">Phone</label><input class="cf_inputbox validate-number" maxlength="50" size="30" id="text_6" name="text_6" type="text"><a onclick="return false;" class="tooltiplink"><img src="components/com_chronocontact/css/images/tooltip.png" class="tooltipimg" border="0" width="16" height="16"></a><div class="tooltipdiv">Phone :: Your Home/Office number</div></div><div class="clear"> </div></div><div class="form_item"><div class="form_element cf_textbox"><label class="cf_label">Mobile</label><input class="cf_inputbox validate-number" maxlength="50" size="30" id="text_7" name="text_7" type="text"><a onclick="return false;" class="tooltiplink"><img src="components/com_chronocontact/css/images/tooltip.png" class="tooltipimg" border="0" width="16" height="16"></a><div class="tooltipdiv">Mobile :: Your Mobile number</div></div><div class="clear"> </div></div><div class="form_item"><div class="form_element cf_textbox"><label class="cf_label">Email</label><input class="cf_inputbox required validate-email" maxlength="50" size="30" id="text_5" name="text_5" type="text"><a onclick="return false;" class="tooltiplink"><img src="components/com_chronocontact/css/images/tooltip.png" class="tooltipimg" border="0" width="16" height="16"></a><div class="tooltipdiv">Email :: like myemail@myhost.com</div><div class="clear"> </div></div></div>
<div class="form_item"><div class="form_element cf_button"><input value="Online Trading" name="undefined" type="submit"><a onclick="return false;" class="tooltiplink"><img src="components/com_chronocontact/css/images/tooltip.png" class="tooltipimg" border="0" width="16" height="16"></a><div class="tooltipdiv">Online Trading :: Continue to online trading</div></div><div class="clear"> </div></div>[/b]
<?php
break;
case 'Hebrew':
default:
?>
<div class="form_item"><div class="form_element cf_heading"><h3 id="" class="cf_text">Online Trading Platform</h3></div><div class="clear"> </div></div><div class="form_item"><div class="form_element cf_text"><span class="cf_text">אנא מלא את הפרטים הבאים כדי לפתוח חשבון</span></div><div class="clear"> </div></div><div class="form_item"><div class="form_element cf_textbox"><label class="cf_label">Name</label><input class="cf_inputbox required validate-alphanum" maxlength="50" size="30" id="text_2" name="text_2" type="text"><a onclick="return false;" class="tooltiplink"><img src="components/com_chronocontact/css/images/tooltip.png" class="tooltipimg" border="0" width="16" height="16"></a><div class="tooltipdiv">Name :: Please fill your name here</div></div><div class="clear"> </div></div><div class="form_item"><div class="form_element cf_textbox"><label class="cf_label">Last Name</label><input class="cf_inputbox validate-alphanum" maxlength="50" size="30" id="text_4" name="text_4" type="text"><a onclick="return false;" class="tooltiplink"><img src="components/com_chronocontact/css/images/tooltip.png" class="tooltipimg" border="0" width="16" height="16"></a><div class="tooltipdiv">Last Name :: Your last name</div></div><div class="clear"> </div></div><div class="form_item"><div class="form_element cf_textbox"><label class="cf_label">Phone</label><input class="cf_inputbox validate-number" maxlength="50" size="30" id="text_6" name="text_6" type="text"><a onclick="return false;" class="tooltiplink"><img src="components/com_chronocontact/css/images/tooltip.png" class="tooltipimg" border="0" width="16" height="16"></a><div class="tooltipdiv">Phone :: Your Home/Office number</div></div><div class="clear"> </div></div><div class="form_item"><div class="form_element cf_textbox"><label class="cf_label">Mobile</label><input class="cf_inputbox validate-number" maxlength="50" size="30" id="text_7" name="text_7" type="text"><a onclick="return false;" class="tooltiplink"><img src="components/com_chronocontact/css/images/tooltip.png" class="tooltipimg" border="0" width="16" height="16"></a><div class="tooltipdiv">Mobile :: Your Mobile number</div></div><div class="clear"> </div></div><div class="form_item"><div class="form_element cf_textbox"><label class="cf_label">Email</label><input class="cf_inputbox required validate-email" maxlength="50" size="30" id="text_5" name="text_5" type="text"><a onclick="return false;" class="tooltiplink"><img src="components/com_chronocontact/css/images/tooltip.png" class="tooltipimg" border="0" width="16" height="16"></a><div class="tooltipdiv">Email :: like myemail@myhost.com</div><div class="clear"> </div></div></div>
<div class="form_item"><div class="form_element cf_button"><input value="Online Trading" name="undefined" type="submit"><a onclick="return false;" class="tooltiplink"><img src="components/com_chronocontact/css/images/tooltip.png" class="tooltipimg" border="0" width="16" height="16"></a><div class="tooltipdiv">Online Trading :: Continue to online trading</div></div><div class="clear"> </div></div>
<?php
break;
}
?>
In this case I get this error: Parse error: parse error, expecting `T_CASE' or `T_DEFAULT' or `'}'' in C:\xampp\htdocs\gofxtrade\components\com_chronocontact\chronocontact.html.php(320) : eval()'d code on line 52. In this case I've tried this:
<div class="form_item"><div class="form_element cf_heading"><h3 id="" class="cf_text">Online Trading Platform</h3></div><div class="clear"> </div></div><div class="form_item"><div class="form_element cf_text"><span class="cf_text"><?php echo JText::_( 'Please fill the details below in order to open a new account' ) ?></span></div><div class="clear"> </div></div><div class="form_item"><div class="form_element cf_textbox"><label class="cf_label">Name</label><input class="cf_inputbox required validate-alphanum" maxlength="50" size="30" id="text_2" name="text_2" type="text"><a onclick="return false;" class="tooltiplink"><img src="components/com_chronocontact/css/images/tooltip.png" class="tooltipimg" border="0" width="16" height="16"></a><div class="tooltipdiv">Name :: Please fill your name here</div></div><div class="clear"> </div></div><div class="form_item"><div class="form_element cf_textbox"><label class="cf_label">Last Name</label><input class="cf_inputbox validate-alphanum" maxlength="50" size="30" id="text_4" name="text_4" type="text"><a onclick="return false;" class="tooltiplink"><img src="components/com_chronocontact/css/images/tooltip.png" class="tooltipimg" border="0" width="16" height="16"></a><div class="tooltipdiv">Last Name :: Your last name</div></div><div class="clear"> </div></div><div class="form_item"><div class="form_element cf_textbox"><label class="cf_label">Phone</label><input class="cf_inputbox validate-number" maxlength="50" size="30" id="text_6" name="text_6" type="text"><a onclick="return false;" class="tooltiplink"><img src="components/com_chronocontact/css/images/tooltip.png" class="tooltipimg" border="0" width="16" height="16"></a><div class="tooltipdiv">Phone :: Your Home/Office number</div></div><div class="clear"> </div></div><div class="form_item"><div class="form_element cf_textbox"><label class="cf_label">Mobile</label><input class="cf_inputbox validate-number" maxlength="50" size="30" id="text_7" name="text_7" type="text"><a onclick="return false;" class="tooltiplink"><img src="components/com_chronocontact/css/images/tooltip.png" class="tooltipimg" border="0" width="16" height="16"></a><div class="tooltipdiv">Mobile :: Your Mobile number</div></div><div class="clear"> </div></div><div class="form_item"><div class="form_element cf_textbox"><label class="cf_label">Email</label><input class="cf_inputbox required validate-email" maxlength="50" size="30" id="text_5" name="text_5" type="text"><a onclick="return false;" class="tooltiplink"><img src="components/com_chronocontact/css/images/tooltip.png" class="tooltipimg" border="0" width="16" height="16"></a><div class="tooltipdiv">Email :: like myemail@myhost.com</div><div class="clear"> </div></div></div>
<div class="form_item"><div class="form_element cf_button"><input value="Online Trading" name="undefined" type="submit"><a onclick="return false;" class="tooltiplink"><img src="components/com_chronocontact/css/images/tooltip.png" class="tooltipimg" border="0" width="16" height="16"></a><div class="tooltipdiv">Online Trading :: Continue to online trading</div></div><div class="clear"> </div></div>
I've created inside \language\he-IL\ directory the file he-IL.com_chronocontact.ini and put the [english=hebrew] lines BUT it doesn't work.Thank you very much for your help
The Error message is because you have a misplaced { in your code. The first block should be something like this
<?php
$lang =& JFactory::getLanguage();
// echo $lang->getName(); // <--only use this in testing to get the correct language name
switch ( $lang->getName() ) {
case 'Hebrew' :
?>
//put the Hebrew form html here
<?php
break;
case 'English' :
default :
?>
//put the English form html here
<?php
break;
}
?>
Bob
Translation within the source code? Or is there a possibility to change the text
in the form code menu?
You can add it in the title attribute of the tag that calls the validation
<input . . . class='required' title="You gotta type stuff in here!" />
There's also an option to put it in a separate div but I forget the syntax - ask me tomorrow if you need it.Bob
I'm using 2 chrono forms and 4 languages in my web site, but i can't understend some things here.
1. How can i see my form code? ( so i can replace labels)
2. Which method is easy to use to make this working.?
3. Which language file I need to edit and add the fields?
( Sorry for my language mistakes🙂 )
The latest release RC3 has a multi-language plugin that you can try out.
Bob
http://www.chronoengine.com/forums/index.php?option=com_chronoforums&cont=posts&f=4&t=13295&start=0&st=0&sk=t&sd=a
Cheers
Max
Hi bobanmak,
The latest release RC3 has a multi-language plugin that you can try out.
Bob
Thanks Bob,
this release it's very good🙂 Congratulations!
But I need a little bit help here.. What I need to put in "Language Strings" , can u give me a sample :
Boban
please check this plugin, I didn;t have time to test it yet, you may be able to report how it works for you:
http://www.chronoengine.com/forums/index.php?option=com_chronoforums&cont=posts&f=4&t=13295&start=0&st=0&sk=t&sd=a
Cheers
Max
I installed this plugin, but i can't go on with this, it isn't funcioning for me.
Boban
regarding the plugin in the link, can you please reply in that thread so the owner can respond to your problem ? the plugin is not mine and I may not be able to help with it yet!
regarding the built in Chronoforms plugin for multi language, tell me please what are you trying to translate ?
Max
Hi,
regarding the plugin in the link, can you please reply in that thread so the owner can respond to your problem ? the plugin is not mine and I may not be able to help with it yet!
regarding the built in Chronoforms plugin for multi language, tell me please what are you trying to translate ?
Max
I'm trying to translate the frontend form with the intro text (I need 4 languages site). I need some help for the syntax, an what I need to put in "Language Strings" . Please give me an example . ( I use the latest rc3 chrono forms version)
Boban
you must have the multi language plugin enabled in the plugins tab of the form!
now in the forms manager, check the form and open the multi language plugin config page!
follow the guidelines in the page, here is my config for a 2 languages form, English and french with English set as the default language!
Cheers
Max
Hi Boban,
you must have the multi language plugin enabled in the plugins tab of the form!
now in the forms manager, check the form and open the multi language plugin config page!
follow the guidelines in the page, here is my config for a 2 languages form, English and french with English set as the default language!
Cheers
Max
Thanks a lot. This is so simple, and very helpfull.
Boban
i found the plugin offered by simpleweb did not work for me. The multi language plugin in RC3 was much better.
Any word on how to accomplish this?
I see you found the thread,
I think you just add the text you want to translate on a new line
Label1=This is the label for this field
Label2=This is the label for the other field
===
Label1=Dette er betegnelsen for dette område
Label2=Dette er betegnelsen for de andre områder
Bob
Ok let me try that. Will report! I was not using Label 1= I was putting the actual string Ihr Name=Nome etc
Ok let me try that. Will report! I was not using Label 1= I was putting the actual string Ihr Name=Nome etc
this should work fine too!🙂
Max
This multi language plugin is brillinat!
Is it possible to translate somehow the validation messages (like This is a required field.) as well?
I was not able to do that with the above plugin. Nevertheless find the file including these verification terms, but have no idea what to do?
If you have any suggestions, please let me know.
Thx in advance
There are a couple of ways round this - the easiest is to use a title attribute e.g. title='Ovo polje je obavezan unos' in the input tag.
Bob
Thanks for your quick action!
Honestly as I am not experienced with chronoforms it is a bit too much for me :-)
What is the imput tag? Where should I paste the above title attribute?
Please detail this trick!
Thanks
This is basic html - there are good tutorials at w3schools.com
Bob
Could you please provide me with some exact examples?
Your help would be highly appreciated.
Thx in advance
please show me your form code and tell me one field of those you want to change the validation message for!
Regards
Max