[FX.php List] Approach for multiple language project

Steve Winter steve at bluecrocodile.co.nz
Sat Nov 21 11:39:36 MST 2009


For what it's worth, I've done what Dale is suggesting to meet your  
needs Jonathan previously and it works very well...

Cheers
Steve

Sent from my iPhone

On 21 Nov 2009, at 17:49, Dale Bengston <dbengston at tds.net> wrote:

> You could put your JS code in the page head and just use FMP queries  
> and PHP to fill in the error messages with the proper language text  
> for a given user. That's probably the easiest way.
>
> The hard (but cleaner) way is to generate a JS file using PHP. This  
> is how I do it, and it's a clean way to pass session variables into  
> JS. Your JS reference in the head of your page looks like this:
>
> <script language="javascript" src="scripts/constants.php" type="text/ 
> javascript"></script>
>
> Note that the html call is looking for JavaScript file, but it's  
> actually a PHP file. Then in the file, you do tihs:
>
> ----------------------------------
>
> <?php
>
> session_start();
> header('Content-type: text/javascript');
>
> ?>
>
>
> var thisVar = '<?php echo $_SESSION['thisVar'];?>';
> var thatVar = '<?php echo $_SESSION['that'Var';?>';
>
>
> ----------------------------------
>
> You get the idea. Even thought your calling a PHP file, it returns a  
> header that says it JavaScript so the html page interprets it  
> correctly. If you place this as the first "JavaScript" file  
> referenced in your <head></head>, then these variables will be  
> available to your other JS files.
>
> Dale
>
> PS You can also use this technique to retrieve PHP/database table  
> data to customize your CSS definitions.
>
>
> On Nov 21, 2009, at 11:23 AM, Jonathan Schwartz wrote:
>
>> ggt, Someone, Steve, Joel, Dale...
>>
>> Thanks very much for the insight.  The prospect of dealing with  
>> text changes manually versus allowing the client the ability to do  
>> it themselves is the key.
>>
>> I'm going with FileMaker.
>>
>> Now about the Javascript component.  Anyone have an example how I  
>> would execute form validation in Javascript , using FMP to supply  
>> the error message?
>>
>> J
>>
>>> Agreed. You could even have PHP write your JS validation script  
>>> according to the proper language, or at least write out variables  
>>> containing the translated text that your validation script uses  
>>> for display. I would strongly recommend storing all the translated  
>>> variations in tables.
>>>
>>> Dale
>>>
>>> On Nov 20, 2009, at 10:06 PM, Gjermund Gusland Thorsen wrote:
>>>
>>>> Mainly due to easy maintenance, and that the client can edit the
>>>> values themselves.
>>>>
>>>> ggt
>>>>
>>>> 2009/11/21 Jonathan Schwartz <jschwartz at exit445.com>:
>>>>> ggt... Thanks for the code.  Tell me why you think that storing  
>>>>> the variable
>>>>> data in FileMaker is better than in text files.
>>>>>
>>>>> J
>>>>>
>>>>> At 10:44 PM +0100 11/20/09, Gjermund Gusland Thorsen wrote:
>>>>>>
>>>>>> Untested, but I think this would do the job:
>>>>>>
>>>>>> Do not forget to have session_start(); at the top of every file.
>>>>>>
>>>>>> http://pastebin.com/f528f1f4
>>>>>>
>>>>>> ggt
>>>>>>
>>>>>> 2009/11/20 Gjermund Gusland Thorsen <ggt667 at gmail.com>:
>>>>>>>
>>>>>>> Please use FileMaker for those values,
>>>>>>> it will most likely save you alot of trouble.
>>>>>>>
>>>>>>> ggt
>>>>>>>
>>>>>>> 2009/11/20 Jonathan Schwartz <jschwartz at exit445.com>:
>>>>>>>>
>>>>>>>> Thanks for the sample code. Seeing all the "non-standard"  
>>>>>>>> characters
>>>>>>>> makes
>>>>>>>> me think of another question...whether FileMaker will handle  
>>>>>>>> these as
>>>>>>>> well
>>>>>>>> as in a text editor, if a text file method is used.
>>>>>>>>
>>>>>>>> Jonathan
>>>>>>>>
>>>>>>>> At 2:58 PM -0500 11/20/09, Someone wrote:
>>>>>>>>>
>>>>>>>>> Hi Jonathan,
>>>>>>>>> I did a project with 3 languages.
>>>>>>>>> The labels of each form were variables.
>>>>>>>>> Lucky the labels didn't change.
>>>>>>>>> If they'd changed often then maybe a database would have be  
>>>>>>>>> needed.
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> eg.
>>>>>>>>> if ($lang == 'en'){
>>>>>>>>>       $l_header = "Please complete the following billing
>>>>>>>>> information:";
>>>>>>>>>       $l_name = "Full Name";
>>>>>>>>>       $l_appears = "(as it appears on credit card)";
>>>>>>>>>       $l_card = "Credit Card Number";
>>>>>>>>>       $l_month = "Expiry Month";
>>>>>>>>>       $l_year = "Expiry Year";
>>>>>>>>>       $l_email = "Email address";
>>>>>>>>>       $l_regret = "We regret that we can only accept VISA and
>>>>>>>>> MasterCard
>>>>>>>>> payments at this time.";
>>>>>>>>>
>>>>>>>>> }elseif ($lang == 'fr'){
>>>>>>>>>       $l_header = "S'il vous plait remplissez les champs  
>>>>>>>>> suivants avec
>>>>>>>>> vos donnÈs:";
>>>>>>>>>       $l_name = "Nom";
>>>>>>>>>       $l_appears = "(du titulaire de la carte de credit)";
>>>>>>>>>       $l_card = "NumÈro de la carte de credit";
>>>>>>>>>       $l_month = "Mois d'ÈchÈance";
>>>>>>>>>       $l_year = "AnnÈe d'ÈchÈance";
>>>>>>>>>       $l_email = "Adresse Èlectronique";
>>>>>>>>>       $l_regret = " Paiement par carte VISA ou MasterCard  
>>>>>>>>> seulement";
>>>>>>>>>
>>>>>>>>> }elseif ($lang == 'es'){
>>>>>>>>>       $l_header = "Por favor complete la siguiente i 
>>>>>>>>> nformaciÛn de
>>>>>>>>> pago:";
>>>>>>>>>       $l_name = "Nombre completo";
>>>>>>>>>       $l_appears = "(tal como aparece en su tarjeta  
>>>>>>>>> de crÈdito)";
>>>>>>>>>       $l_card = "N mero de tarjeta de crÈdito";
>>>>>>>>>       $l_month = "Mes de vencimiento";
>>>>>>>>>       $l_year = "AÒo de vencimiento";
>>>>>>>>>       $l_email = "DirecciÛn electrÛnica";
>>>>>>>>>       $l_regret = "Pago por tarjeta VISA o MasterCard  
>>>>>>>>> solamente.";
>>>>>>>>>
>>>>>>>>> }
>>>>>>>>>
>>>>>>>>> On Nov 20, 2009, at 2:44 PM, Jonathan Schwartz wrote:
>>>>>>>>>
>>>>>>>>>> Hi Folks,
>>>>>>>>>>
>>>>>>>>>> I'm contemplating how to best approach a new project. The  
>>>>>>>>>> core of the
>>>>>>>>>> project is a multi-page online application form that is  
>>>>>>>>>> needed in 6
>>>>>>>>>> different languages.
>>>>>>>>>>
>>>>>>>>>> Obvioulsy, the process starts by defining each block of  
>>>>>>>>>> text in the
>>>>>>>>>> form...including error messaging... and assigning a unique  
>>>>>>>>>> variable.
>>>>>>>>>> The
>>>>>>>>>> variable gets populated from 6 different "buckets" of  
>>>>>>>>>> values of each
>>>>>>>>>> language after a master language variable is set.
>>>>>>>>>>
>>>>>>>>>> The question is how to store the text data.  I guess the  
>>>>>>>>>> choices are
>>>>>>>>>> either in individual languages php files, one for each  
>>>>>>>>>> language, and
>>>>>>>>>> including the appropriate files.  The other choice is  
>>>>>>>>>> storing the
>>>>>>>>>> text in a
>>>>>>>>>> FileMaker database.  The first option would be faster, but  
>>>>>>>>>> "more
>>>>>>>>>> technical"
>>>>>>>>>> to edit. The latter would require more processing power but  
>>>>>>>>>> be easier
>>>>>>>>>> to
>>>>>>>>>> edit and manage.
>>>>>>>>>>
>>>>>>>>>> A further complication is handling javascript forms  
>>>>>>>>>> validation in the
>>>>>>>>>> various languages as well.
>>>>>>>>>>
>>>>>>>>>> Anyone been down this road before?
>>>>>>>>>>
>>>>>>>>>> Thanks
>>>>>>>>>>
>>>>>>>>>> Jonathan
>>>>>>>>>> --
>>>>>>>>>> Jonathan Schwartz
>>>>>>>>>> Exit 445 Group
>>>>>>>>>> jonathan at exit445.com
>>>>>>>>>> http://www.exit445.com
>>>>>>>>>> 415-370-5011
>>>>>>>>>> _______________________________________________
>>>>>>>>>> FX.php_List mailing list
>>>>>>>>>> FX.php_List at mail.iviking.org
>>>>>>>>>> http://www.iviking.org/mailman/listinfo/fx.php_list
>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> _______________________________________________
>>>>>>>>> FX.php_List mailing list
>>>>>>>>> FX.php_List at mail.iviking.org
>>>>>>>>> http://www.iviking.org/mailman/listinfo/fx.php_list
>>>>>>>>
>>>>>>>>
>>>>>>>> --
>>>>>>>> Jonathan Schwartz
>>>>>>>> Exit 445 Group
>>>>>>>> jonathan at exit445.com
>>>>>>>> http://www.exit445.com
>>>>>>>> 415-370-5011
>>>>>>>> _______________________________________________
>>>>>>>> FX.php_List mailing list
>>>>>>>> FX.php_List at mail.iviking.org
>>>>>>>> http://www.iviking.org/mailman/listinfo/fx.php_list
>>>>>>>>
>>>>>>>
>>>>>> _______________________________________________
>>>>>> FX.php_List mailing list
>>>>>> FX.php_List at mail.iviking.org
>>>>>> http://www.iviking.org/mailman/listinfo/fx.php_list
>>>>>
>>>>>
>>>>> --
>>>>> Jonathan Schwartz
>>>>> Exit 445 Group
>>>>> jonathan at exit445.com
>>>>> http://www.exit445.com
>>>>> 415-370-5011
>>>>> _______________________________________________
>>>>> FX.php_List mailing list
>>>>> FX.php_List at mail.iviking.org
>>>>> http://www.iviking.org/mailman/listinfo/fx.php_list
>>>>>
>>>> _______________________________________________
>>>> FX.php_List mailing list
>>>> FX.php_List at mail.iviking.org
>>>> http://www.iviking.org/mailman/listinfo/fx.php_list
>>>
>>> _______________________________________________
>>> FX.php_List mailing list
>>> FX.php_List at mail.iviking.org
>>> http://www.iviking.org/mailman/listinfo/fx.php_list
>>
>>
>> --
>> Jonathan Schwartz
>> Exit 445 Group
>> jonathan at exit445.com
>> http://www.exit445.com
>> 415-370-5011
>> _______________________________________________
>> FX.php_List mailing list
>> FX.php_List at mail.iviking.org
>> http://www.iviking.org/mailman/listinfo/fx.php_list
>
> _______________________________________________
> FX.php_List mailing list
> FX.php_List at mail.iviking.org
> http://www.iviking.org/mailman/listinfo/fx.php_list



More information about the FX.php_List mailing list