This forum is no longer open and is for reading/searching only.
Please use our new MachForm Community Forum instead.
MachForm Community Forums » MachForm 2
Multi language
Started 16 years ago by edpaep | 36 posts |
-
Hi,
Since there is a centralized language file since the last upgrade, is it now possible to manage forms for multi-language sites with different messages for each form according to the language?
Thanks.Posted 16 years ago # -
It is possible, but based on form id.
You will need to modify your language.php to allow this.First, create a new file for each language. For example:
- language-en.php (use this for the default english language file)
- language-de.php
- language-fr.php
..etcCopy the whole content of language.php file to those files and translate it for each language.
Put those files into your "includes" folder.
Next, remove the whole content of language.php and insert the following code:
<?php $form_id = (int) $_REQUEST['id']; switch ($form_id){ case 1 : require('language-de.php');break; case 2 : require('language-fr.php');break; default: require('language-en.php');break; } ?>
In the above sample, form with id = 1 would load "language-de.php", form with id = 2 would load "language-fr.php", while the rest would load language-en.php.Adjust those id number as your preference.
MachForm Founder
Posted 16 years ago # -
A nice feature would be a option to choose language on a "per-form basis" (for us with forms in different languages).
Posted 16 years ago # -
Actually the above hack allow you to choose language on a "per-form basis".
It would be great to have this implemented in the form builder though.
I'm putting this into our feature request list. Thanks!MachForm Founder
Posted 16 years ago # -
That was exactly what I meant. Would be great if the language-template would be used in the administration system as well when creating forms.
Posted 16 years ago # -
Ahh I see. Sorry for that :-)
Anybody willing to share any version of language.php other than english?
It would be great to have the others.MachForm Founder
Posted 16 years ago # -
I can share german version :-)
Posted 16 years ago # -
I have the spanish version of language.php available, but there is more to translate in other modules, like form validation and others.
So it would be a good idea to have ALL messages and legends in the same language file so the machform can be completely multilanguage for the sake of users that don't know about php programming and editing.
If that is done I can take care of the spanish module.Posted 16 years ago # -
hi!
I can send you the Portuguese Brazil!!
how can I send??????????
Posted 16 years ago # -
awesome!
Send me your language file please. Mail to: customer.service [at] appnitro.com
ggmaury -- the form validation messages are included in language.php file already. Am I missing something?
MachForm Founder
Posted 16 years ago # -
In version 2.0d the "back" and "submit"-buttons at the form review are lacking translation. (~ row 2400 in view-functions.php).
Any news regarding the ability to choose language per form in the administration area? (i'm about to add it myself)Posted 16 years ago # -
Oops.. I think I missed that one.
Please add this to your language.php translation:$lang['back_button'] = 'Back';
I'll update the package soon.Regarding the ability to choose language from admin area, I don't have any plan to release new version with new feature yet. Sorry. I'm afraid you will need to add it yourself for now.
MachForm Founder
Posted 16 years ago # -
Hi Yuniar,
Do you also have a french language file? In return I can provide you the Dutch language file.
Best regards,
DonovanPosted 15 years ago # -
No, I don't have the French language yet. Sorry.
But I do have the Dutch language file already.MachForm Founder
Posted 15 years ago # -
Hi Yuniar, is there any way to get this package? Or at least some of the languages (French,German,Italian and Dutch) ? I looked in the customer downloads but it´s not there :)
Posted 15 years ago # -
I will work on a french version... I need it for one of my clients...
Posted 15 years ago # -
To get/send the files, just mail to: customer.service [at] appnitro.com
MachForm Founder
Posted 15 years ago # -
Too bad this sollution is incomplete... It does not work on embed PHP forms.
Any suggestion to fix that?Posted 15 years ago # -
The best I came up with...
I suggest the following sollution in the language.php if the form would be used as enbedded PHP:
if(isset($_REQUEST['id'])){
$form_id = (int) $_REQUEST['id'];
} else {
if(!isset($form_id)){
$form_id = 0;
}
}
switch ($form_id){
case 1 :
require('language_hun.php');break;
case 2 :
require('language_hun.php');break;
default:
require('language_enu.php');break;
}
And when you embed the PHP code it needs a slight change from the one proposed in the admin panel:
$form_id = 2; //replace the number with your form ID - this is the new row I added
require( "./machform.php"); //be sure the path will be okay
$mf_param['form_id'] = 2; //replace the number with your form ID
$mf_param['base_path'] ="./"; //also this path should be checked carefully
display_machform($mf_param);
Anybody with a better sollution?
Posted 15 years ago # -
Hi Yuniar, I tried your solution.
<?php
$form_id = (int) $_REQUEST['id'];
switch ($form_id){
case 1 : require('language-de.php');break;
case 2 : require('language-fr.php');break;
default: require('language-en.php');break;
}
?>It indeed works but somehow it make problems for Export to Excel functionality.
If you call file language-en.php from language.php using above switch the Exported Excel become unreadable. It took me hours to recognize this but i still don't understand the root cause.Posted 15 years ago #
Reply »
You must log in to post.