From: <luc...@pd...> - 2004-09-08 08:32:19
|
Hello all. As stated in my previous message, I was trying to solve the p= roblem of sentences with one or more parameters. As an example just consi= der -"Display ". $ModuleName . " options:"- in www_users. Here's my prop= osed solution. I am using special tags in the tobetranslated and transla= ted sentence, i.e : ENGLISH: Display __Parameter1__ options ITALIAN: M= ostra opzioni per il modulo __Parameter1__ when I have to translate t= his sentence I make this call: translate('Display __Parameter1__ options= ',$ModuleName) Here's the definition of the function translate: funct= ion translate($idOfLabelToBeTranslated) { global $lang; if ($lan= g[$idOfLabelToBeTranslated]!=3Dnull){ $numargs =3D func_num_args()= ; if($numargs >1){ $arg_list =3D func_get_args(); = $returnString=3D$lang[$idOfLabelToBeTranslated]; for ($i =3D 0= ; $i < $numargs; $i++) { //echo "Argument $i is: " . $arg_list= [$i] . "<br />\n"; $returnString =3D str_replace('__Parameter'= .$i.'__',$arg_list[$i],$returnString); } return $return= String; } else //number of arguments is 1 return = $lang[$idOfLabelToBeTranslated]; } else //there is no translated = label in the array return $idOfLabelToBeTranslated; } As you ca= n see it takes a variable number of arguments. If we have more than 1 arg= umentes, i.e. some parameters have to be inserted in the sentence, it sim= ply gets the translated label, which contains the varios strings __Parame= ter1__ ... __ParameterN__. Then it substitutes the parameter string with = the values passed as arguments. The main concern I still have on this = solution is: "__ParameterN__" as the tobereplaced string is cabled, thus= every translator has to keep in mind to strictly use this formalism. Of = course any suggestion on how to choose a formalism wich can be surely not= confused with any real life word, will be appreciated. |
From: Hani N. <ha...@na...> - 2004-09-08 09:09:36
|
Hi guys just a thought, When we did this stuff in OA we felt there was a strong requirement not to require gettext compiled into php. I am not sure it should have been such a strong requirement, but I did not want to have to install it at home and my stupid host did not have it installed at the time (he has it now). I also don't think it hurts anyway, so you might as well have it. We used this: http://phptal.sourceforge.net/bagpack/GetText/ I modified it slightly to remove the dependency to pear and also created a lang.php which created a few shortcut functions (like _() which used GetText). It also provides all this variable stuff. For example _set("name",$name); _set("occupation",$occupation); echo _("${name} works as a ${occupation}"); Once you guys settle on the approach I can give you a hand with some scripts although you would have to let me know which ones :) Good luck, Hani luc...@pd... wrote: >*This message was transferred with a trial version of CommuniGate(tm) Pro* >Hello all. >As stated in my previous message, I was trying to solve the problem of sentences with one or more parameters. As an example just consider -"Display ". $ModuleName . " options:"- in www_users. >Here's my proposed solution. >I am using special tags in the tobetranslated and translated sentence, i.e : >ENGLISH: Display __Parameter1__ options >ITALIAN: Mostra opzioni per il modulo __Parameter1__ > >when I have to translate this sentence I make this call: >translate('Display __Parameter1__ options',$ModuleName) > >Here's the definition of the function translate: >function translate($idOfLabelToBeTranslated) >{ > global $lang; > if ($lang[$idOfLabelToBeTranslated]!=null){ > $numargs = func_num_args(); > if($numargs >1){ > $arg_list = func_get_args(); > $returnString=$lang[$idOfLabelToBeTranslated]; > for ($i = 0; $i < $numargs; $i++) { > //echo "Argument $i is: " . $arg_list[$i] . "<br />\n"; > $returnString = str_replace('__Parameter'.$i.'__',$arg_list[$i],$returnString); > } > return $returnString; > } > else //number of arguments is 1 > return $lang[$idOfLabelToBeTranslated]; > } > else //there is no translated label in the array > return $idOfLabelToBeTranslated; >} > >As you can see it takes a variable number of arguments. If we have more than 1 argumentes, i.e. some parameters have to be inserted in the sentence, it simply gets the translated label, which contains the varios strings __Parameter1__ ... __ParameterN__. Then it substitutes the parameter string with the values passed as arguments. > >The main concern I still have on this solution is: >"__ParameterN__" as the tobereplaced string is cabled, thus every translator has to keep in mind to strictly use this formalism. Of course any suggestion on how to choose a formalism wich can be surely not confused with any real life word, will be appreciated. > > > >------------------------------------------------------- >This SF.Net email is sponsored by BEA Weblogic Workshop >FREE Java Enterprise J2EE developer tools! >Get your free copy of BEA WebLogic Workshop 8.1 today. >http://ads.osdn.com/?ad_idP47&alloc_id808&op=click >_______________________________________________ >Web-erp-developers mailing list >Web...@li... >https://lists.sourceforge.net/lists/listinfo/web-erp-developers > > > > |
From: skaill <sk...@ro...> - 2004-09-08 13:17:56
|
Glad to see there's agreement on which software solution to use. I believe this is the same package Jesse also recommended. It has the variables interpolation within translated strings. Even if it doesn't get built into the base webERP, those of us who need the software answer should be able to build it in with almost no modifications to webERP. It is a self-contained addition where webERP only knows it's calling gettext whether it's built in or calls the "software" answer. Steve ----- Original Message ----- From: "Hani Naguib" <ha...@na...> To: <web...@li...> Sent: Wednesday, September 08, 2004 5:09 AM Subject: Re: [Web-erp-developers] Translation of sentence with parameters... > Hi guys just a thought, > When we did this stuff in OA we felt there was a strong > requirement not to require gettext compiled into php. I am not sure > it should have been such a strong requirement, but I did not want to > have to install it at home and my stupid host did not have it installed at > the time (he has it now). I also don't think it hurts anyway, so you might > as well have it. > We used this: > http://phptal.sourceforge.net/bagpack/GetText/ > I modified it slightly to remove the dependency to pear and also created > a lang.php which created a few shortcut functions (like _() which used > GetText). > > It also provides all this variable stuff. For example > > _set("name",$name); > _set("occupation",$occupation); > echo _("${name} works as a ${occupation}"); > > Once you guys settle on the approach I can give you a hand with some scripts > although you would have to let me know which ones :) > > Good luck, > Hani > > > luc...@pd... wrote: > > >*This message was transferred with a trial version of CommuniGate(tm) Pro* > >Hello all. > >As stated in my previous message, I was trying to solve the problem of sentences with one or more parameters. As an example just consider -"Display ". $ModuleName . " options:"- in www_users. > >Here's my proposed solution. > >I am using special tags in the tobetranslated and translated sentence, i.e : > >ENGLISH: Display __Parameter1__ options > >ITALIAN: Mostra opzioni per il modulo __Parameter1__ > > > >when I have to translate this sentence I make this call: > >translate('Display __Parameter1__ options',$ModuleName) > > > >Here's the definition of the function translate: > >function translate($idOfLabelToBeTranslated) > >{ > > global $lang; > > if ($lang[$idOfLabelToBeTranslated]!=null){ > > $numargs = func_num_args(); > > if($numargs >1){ > > $arg_list = func_get_args(); > > $returnString=$lang[$idOfLabelToBeTranslated]; > > for ($i = 0; $i < $numargs; $i++) { > > //echo "Argument $i is: " . $arg_list[$i] . "<br />\n"; > > $returnString = str_replace('__Parameter'.$i.'__',$arg_list[$i],$returnString); > > } > > return $returnString; > > } > > else //number of arguments is 1 > > return $lang[$idOfLabelToBeTranslated]; > > } > > else //there is no translated label in the array > > return $idOfLabelToBeTranslated; > >} > > > >As you can see it takes a variable number of arguments. If we have more than 1 argumentes, i.e. some parameters have to be inserted in the sentence, it simply gets the translated label, which contains the varios strings __Parameter1__ ... __ParameterN__. Then it substitutes the parameter string with the values passed as arguments. > > > >The main concern I still have on this solution is: > >"__ParameterN__" as the tobereplaced string is cabled, thus every translator has to keep in mind to strictly use this formalism. Of course any suggestion on how to choose a formalism wich can be surely not confused with any real life word, will be appreciated. > > > > > > > >------------------------------------------------------- > >This SF.Net email is sponsored by BEA Weblogic Workshop > >FREE Java Enterprise J2EE developer tools! > >Get your free copy of BEA WebLogic Workshop 8.1 today. > >http://ads.osdn.com/?ad_idP47&alloc_id808&op=click > >_______________________________________________ > >Web-erp-developers mailing list > >Web...@li... > >https://lists.sourceforge.net/lists/listinfo/web-erp-developers > > > > > > > > > > > > ------------------------------------------------------- > This SF.Net email is sponsored by BEA Weblogic Workshop > FREE Java Enterprise J2EE developer tools! > Get your free copy of BEA WebLogic Workshop 8.1 today. > http://ads.osdn.com/?ad_id=5047&alloc_id=10808&op=click > _______________________________________________ > Web-erp-developers mailing list > Web...@li... > https://lists.sourceforge.net/lists/listinfo/web-erp-developers |
From: Phil D. <we...@pa...> - 2004-09-10 08:17:16
|
> Once you guys settle on the approach I can give you a hand with some scripts > although you would have to let me know which ones :) Hani, Forget the last 2 on that list ie DiscountCategories.php Victor DiscountMatrix.php Victor Victor is already onto these. Phil |
From: Hani N. <ha...@na...> - 2004-09-10 10:10:33
|
Hi Phil, I was not following the mailing list's messages too close, so I don't know where this list is present. Could someone send me a pointer? Thanks, Hani Phil Daintree wrote: >*This message was transferred with a trial version of CommuniGate(tm) Pro* > > >>Once you guys settle on the approach I can give you a hand with some scripts >>although you would have to let me know which ones :) >> >> > > >Hani, > >Forget the last 2 on that list ie >DiscountCategories.php Victor >DiscountMatrix.php Victor > >Victor is already onto these. > >Phil > > > >------------------------------------------------------- >This SF.Net email is sponsored by: YOU BE THE JUDGE. Be one of 170 >Project Admins to receive an Apple iPod Mini FREE for your judgement on >who ports your project to Linux PPC the best. Sponsored by IBM. >Deadline: Sept. 13. Go here: http://sf.net/ppc_contest.php >_______________________________________________ >Web-erp-developers mailing list >Web...@li... >https://lists.sourceforge.net/lists/listinfo/web-erp-developers > > > > |
From: Phil D. <we...@pa...> - 2004-09-11 03:38:41
|
> Once you guys settle on the approach I can give you a hand with some scripts > although you would have to let me know which ones :) > Hani, I noticed you kind offer and have pulled a couple off the list in alpabetical order ... DebtorsAtPeriodEnd.php Hani DeliveryDetails.php Hani DiscountCategories.php Hani DiscountMatrix.php Hani Many thanks Phil |
From: Hani N. <ha...@na...> - 2004-09-11 23:33:50
Attachments:
DebtorsAtPeriodEnd.php
|
Hi Phil, I have attached the DebtorsAtPeriodEnd.php with my modifications. I am not familiar with your code so I would appreciate if you could have a look at this and make sure I have not done anything stupid or missed things that should have been translated. I did notice a few things. 'includes/session.inc' includes 'includes/LanguageSetup.php' at the end of the file. This means that the language stuff breaks initially on a system that does not have gettext installed, since the _() function is not defined until the LanguageSetup is called but session.inc uses it before including LanguageSetup. In DebtorsAtPeriodEnd.php I moved the include session.php to the start of the script so I could set the title. I don't know what the implications of doing that are in your code. But I suspect I should not have done that! Could you let me know what the policy is for what includes I should use prior to setting the title? Hani Phil Daintree wrote: >*This message was transferred with a trial version of CommuniGate(tm) Pro* > > >>Once you guys settle on the approach I can give you a hand with some scripts >>although you would have to let me know which ones :) >> >> >> > >Hani, > >I noticed you kind offer and have pulled a couple off the list in >alpabetical order ... > >DebtorsAtPeriodEnd.php Hani >DeliveryDetails.php Hani >DiscountCategories.php Hani >DiscountMatrix.php Hani > > >Many thanks > >Phil > > > >------------------------------------------------------- >This SF.Net email is sponsored by: YOU BE THE JUDGE. Be one of 170 >Project Admins to receive an Apple iPod Mini FREE for your judgement on >who ports your project to Linux PPC the best. Sponsored by IBM. >Deadline: Sept. 13. Go here: http://sf.net/ppc_contest.php >_______________________________________________ >Web-erp-developers mailing list >Web...@li... >https://lists.sourceforge.net/lists/listinfo/web-erp-developers > > > > |
From: Phil D. <we...@pa...> - 2004-09-08 09:14:18
|
This is a good example. Why couldn't the translation string in messages.po be as follows msgid = "Display" msgstr = "Mostra opzioni per il modulo" msgid = "options" msgstr =' ' the output for the English version is: Display $module options the output for the Italian version is: Mostra opzioni per il modulo $module Ok, I know this wouldn't work in some situations but the point is that there are work arounds that might involve more imaginative use of language rather than complex code and additional classes that would work in a good proportion of cases. I would rather us explore these options first. If we absolutely had to, as a last resort, after every other avenue had failed, and there really is no other way ..... and AFTER we have all the scripts 'gettextified' using the absolute bare minimum of "fancy stuff" and if then there is still dissatisfaction I would prefer to use a gettext class: http://phptal.sourceforge.net/bagpack/GetText/doc/gettext.variableinterpolation.html this creates another dependence though and I really really only want to depend on PHP and a DB - nothing else. If it comes to this then it would be better if we could include the minimal additional files in the distribution so there is nothing extra to worry about in terms of PEAR classes to install. Phil On Wed, 2004-09-08 at 20:31, luc...@pd... wrote: > Hello all. > As stated in my previous message, I was trying to solve the problem of sentences with one or more parameters. As an example just consider -"Display ". $ModuleName . " options:"- in www_users. > Here's my proposed solution. > I am using special tags in the tobetranslated and translated sentence, i.e : > ENGLISH: Display __Parameter1__ options > ITALIAN: Mostra opzioni per il modulo __Parameter1__ > > when I have to translate this sentence I make this call: > translate('Display __Parameter1__ options',$ModuleName) > > Here's the definition of the function translate: > function translate($idOfLabelToBeTranslated) > { > global $lang; > if ($lang[$idOfLabelToBeTranslated]!=null){ > $numargs = func_num_args(); > if($numargs >1){ > $arg_list = func_get_args(); > $returnString=$lang[$idOfLabelToBeTranslated]; > for ($i = 0; $i < $numargs; $i++) { > //echo "Argument $i is: " . $arg_list[$i] . "<br />\n"; > $returnString = str_replace('__Parameter'.$i.'__',$arg_list[$i],$returnString); > } > return $returnString; > } > else //number of arguments is 1 > return $lang[$idOfLabelToBeTranslated]; > } > else //there is no translated label in the array > return $idOfLabelToBeTranslated; > } > > As you can see it takes a variable number of arguments. If we have more than 1 argumentes, i.e. some parameters have to be inserted in the sentence, it simply gets the translated label, which contains the varios strings __Parameter1__ ... __ParameterN__. Then it substitutes the parameter string with the values passed as arguments. > > The main concern I still have on this solution is: > "__ParameterN__" as the tobereplaced string is cabled, thus every translator has to keep in mind to strictly use this formalism. Of course any suggestion on how to choose a formalism wich can be surely not confused with any real life word, will be appreciated. > > |
From: Hani N. <ha...@na...> - 2004-09-08 10:06:00
|
Hi Phil, The class you mention below is the one I was talking about. It depends on PEAR but removing this dependency was really simple although I can't remember exactly what the dependency was, but it only took 30 mins to figure it out last time. In the end you end up with this extra class (one php file) and I also had another php file (language.php) in which I wrote some shortcut functions. This removes the need for having gettext compiled into php. Remember most translators will probably be working on their home pc, which probably does not have gettext. I seem to remember it was an involving process to get gettext into php. As for the variables issue I guess it will boil down to your preferrence, since it is not a very common thing, it should not affect 80% of the translations, but would mean someone translating into a new language may one day need to change the code. By the way there is also an even less common feature to keep in mind that has to do with the quantity of objects within translations. For example 'You have 2 ITEMS in your bag" is fine for numbers above 1, but 'You have 1 ITEMS in your bag" is incorrect. In Arabic it is even worse :) since there are three forms to consider, single, dual and plural. :) Hani Phil Daintree wrote: >*This message was transferred with a trial version of CommuniGate(tm) Pro* >This is a good example. > >Why couldn't the translation string in messages.po be as follows > >msgid = "Display" >msgstr = "Mostra opzioni per il modulo" > >msgid = "options" >msgstr =' ' > >the output for the English version is: > >Display $module options > >the output for the Italian version is: > >Mostra opzioni per il modulo $module > >Ok, I know this wouldn't work in some situations but the point is that >there are work arounds that might involve more imaginative use of >language rather than complex code and additional classes that would work >in a good proportion of cases. I would rather us explore these options >first. > >If we absolutely had to, >as a last resort, >after every other avenue had failed, >and there really is no other way ..... > >and AFTER we have all the scripts 'gettextified' using the absolute bare >minimum of "fancy stuff" and if then there is still dissatisfaction I >would prefer to use a gettext class: > >http://phptal.sourceforge.net/bagpack/GetText/doc/gettext.variableinterpolation.html > >this creates another dependence though and I really really only want to >depend on PHP and a DB - nothing else. If it comes to this then it would >be better if we could include the minimal additional files in the >distribution so there is nothing extra to worry about in terms of PEAR >classes to install. > >Phil > > >On Wed, 2004-09-08 at 20:31, luc...@pd... wrote: > > >>Hello all. >>As stated in my previous message, I was trying to solve the problem of sentences with one or more parameters. As an example just consider -"Display ". $ModuleName . " options:"- in www_users. >>Here's my proposed solution. >>I am using special tags in the tobetranslated and translated sentence, i.e : >>ENGLISH: Display __Parameter1__ options >>ITALIAN: Mostra opzioni per il modulo __Parameter1__ >> >>when I have to translate this sentence I make this call: >>translate('Display __Parameter1__ options',$ModuleName) >> >>Here's the definition of the function translate: >>function translate($idOfLabelToBeTranslated) >>{ >> global $lang; >> if ($lang[$idOfLabelToBeTranslated]!=null){ >> $numargs = func_num_args(); >> if($numargs >1){ >> $arg_list = func_get_args(); >> $returnString=$lang[$idOfLabelToBeTranslated]; >> for ($i = 0; $i < $numargs; $i++) { >> //echo "Argument $i is: " . $arg_list[$i] . "<br />\n"; >> $returnString = str_replace('__Parameter'.$i.'__',$arg_list[$i],$returnString); >> } >> return $returnString; >> } >> else //number of arguments is 1 >> return $lang[$idOfLabelToBeTranslated]; >> } >> else //there is no translated label in the array >> return $idOfLabelToBeTranslated; >>} >> >>As you can see it takes a variable number of arguments. If we have more than 1 argumentes, i.e. some parameters have to be inserted in the sentence, it simply gets the translated label, which contains the varios strings __Parameter1__ ... __ParameterN__. Then it substitutes the parameter string with the values passed as arguments. >> >>The main concern I still have on this solution is: >>"__ParameterN__" as the tobereplaced string is cabled, thus every translator has to keep in mind to strictly use this formalism. Of course any suggestion on how to choose a formalism wich can be surely not confused with any real life word, will be appreciated. >> >> >> >> > > > > >------------------------------------------------------- >This SF.Net email is sponsored by BEA Weblogic Workshop >FREE Java Enterprise J2EE developer tools! >Get your free copy of BEA WebLogic Workshop 8.1 today. >http://ads.osdn.com/?ad_id=5047&alloc_id=10808&op=click >_______________________________________________ >Web-erp-developers mailing list >Web...@li... >https://lists.sourceforge.net/lists/listinfo/web-erp-developers > > > > |
From: Phil D. <we...@pa...> - 2004-09-08 10:18:48
|
Looks like we crossed messages. I will have a look at this class in more detail - if I must :-( It would be a good feature not to be dependent on gettext being compiled in. It does say stable. Its miserable to have to declare variables like this though! P On Wed, 2004-09-08 at 22:05, Hani Naguib wrote: > Hi Phil, > The class you mention below is the one I was talking about. It depends > on PEAR but > removing this dependency was really simple although I can't remember > exactly what > the dependency was, but it only took 30 mins to figure it out last time. > > In the end you end up with this extra class (one php file) and I also > had another php > file (language.php) in which I wrote some shortcut functions. This > removes the need for > having gettext compiled into php. Remember most translators will > probably be working > on their home pc, which probably does not have gettext. I seem to > remember it was an > involving process to get gettext into php. > > As for the variables issue I guess it will boil down to your > preferrence, since it is not a very > common thing, it should not affect 80% of the translations, but would > mean someone > translating into a new language may one day need to change the code. > > By the way there is also an even less common feature to keep in mind > that has to do with > the quantity of objects within translations. For example > > 'You have 2 ITEMS in your bag" is fine for numbers above 1, but > 'You have 1 ITEMS in your bag" is incorrect. > > In Arabic it is even worse :) since there are three forms to consider, > single, dual and plural. :) > > Hani > > Phil Daintree wrote: > > >*This message was transferred with a trial version of CommuniGate(tm) Pro* > >This is a good example. > > > >Why couldn't the translation string in messages.po be as follows > > > >msgid = "Display" > >msgstr = "Mostra opzioni per il modulo" > > > >msgid = "options" > >msgstr =' ' > > > >the output for the English version is: > > > >Display $module options > > > >the output for the Italian version is: > > > >Mostra opzioni per il modulo $module > > > >Ok, I know this wouldn't work in some situations but the point is that > >there are work arounds that might involve more imaginative use of > >language rather than complex code and additional classes that would work > >in a good proportion of cases. I would rather us explore these options > >first. > > > >If we absolutely had to, > >as a last resort, > >after every other avenue had failed, > >and there really is no other way ..... > > > >and AFTER we have all the scripts 'gettextified' using the absolute bare > >minimum of "fancy stuff" and if then there is still dissatisfaction I > >would prefer to use a gettext class: > > > >http://phptal.sourceforge.net/bagpack/GetText/doc/gettext.variableinterpolation.html > > > >this creates another dependence though and I really really only want to > >depend on PHP and a DB - nothing else. If it comes to this then it would > >be better if we could include the minimal additional files in the > >distribution so there is nothing extra to worry about in terms of PEAR > >classes to install. > > > >Phil > > > > > >On Wed, 2004-09-08 at 20:31, luc...@pd... wrote: > > > > > >>Hello all. > >>As stated in my previous message, I was trying to solve the problem of sentences with one or more parameters. As an example just consider -"Display ". $ModuleName . " options:"- in www_users. > >>Here's my proposed solution. > >>I am using special tags in the tobetranslated and translated sentence, i.e : > >>ENGLISH: Display __Parameter1__ options > >>ITALIAN: Mostra opzioni per il modulo __Parameter1__ > >> > >>when I have to translate this sentence I make this call: > >>translate('Display __Parameter1__ options',$ModuleName) > >> > >>Here's the definition of the function translate: > >>function translate($idOfLabelToBeTranslated) > >>{ > >> global $lang; > >> if ($lang[$idOfLabelToBeTranslated]!=null){ > >> $numargs = func_num_args(); > >> if($numargs >1){ > >> $arg_list = func_get_args(); > >> $returnString=$lang[$idOfLabelToBeTranslated]; > >> for ($i = 0; $i < $numargs; $i++) { > >> //echo "Argument $i is: " . $arg_list[$i] . "<br />\n"; > >> $returnString = str_replace('__Parameter'.$i.'__',$arg_list[$i],$returnString); > >> } > >> return $returnString; > >> } > >> else //number of arguments is 1 > >> return $lang[$idOfLabelToBeTranslated]; > >> } > >> else //there is no translated label in the array > >> return $idOfLabelToBeTranslated; > >>} > >> > >>As you can see it takes a variable number of arguments. If we have more than 1 argumentes, i.e. some parameters have to be inserted in the sentence, it simply gets the translated label, which contains the varios strings __Parameter1__ ... __ParameterN__. Then it substitutes the parameter string with the values passed as arguments. > >> > >>The main concern I still have on this solution is: > >>"__ParameterN__" as the tobereplaced string is cabled, thus every translator has to keep in mind to strictly use this formalism. Of course any suggestion on how to choose a formalism wich can be surely not confused with any real life word, will be appreciated. > >> > >> > >> > >> > > > > > > > > > >------------------------------------------------------- > >This SF.Net email is sponsored by BEA Weblogic Workshop > >FREE Java Enterprise J2EE developer tools! > >Get your free copy of BEA WebLogic Workshop 8.1 today. > >http://ads.osdn.com/?ad_id=5047&alloc_id=10808&op=click > >_______________________________________________ > >Web-erp-developers mailing list > >Web...@li... > >https://lists.sourceforge.net/lists/listinfo/web-erp-developers > > > > > > > > > > > > ------------------------------------------------------- > This SF.Net email is sponsored by BEA Weblogic Workshop > FREE Java Enterprise J2EE developer tools! > Get your free copy of BEA WebLogic Workshop 8.1 today. > http://ads.osdn.com/?ad_id=5047&alloc_id=10808&op=click > _______________________________________________ > Web-erp-developers mailing list > Web...@li... > https://lists.sourceforge.net/lists/listinfo/web-erp-developers > |
From: Jesse P. <je...@st...> - 2004-09-08 10:55:39
|
Phil, if you like a Class like this but need help unnecessary dependencies, let me/us know and I'll see what I can do. I'd rather see what I believe to be more complete translations, but will certainly support whatever is decided upon. btw, are you just sitting on the updated set of scripts I sent you recently waiting for this to play out? Do let me know if you have problems - I will work out any bugs if you find them, but I feel much more confident about the updated set. let me know. jesse Phil Daintree wrote: >Looks like we crossed messages. >I will have a look at this class in more detail - if I must :-( It would >be a good feature not to be dependent on gettext being compiled in. It >does say stable. Its miserable to have to declare variables like this >though! > >P > >On Wed, 2004-09-08 at 22:05, Hani Naguib wrote: > > >>Hi Phil, >>The class you mention below is the one I was talking about. It depends >>on PEAR but >>removing this dependency was really simple although I can't remember >>exactly what >>the dependency was, but it only took 30 mins to figure it out last time. >> >>In the end you end up with this extra class (one php file) and I also >>had another php >>file (language.php) in which I wrote some shortcut functions. This >>removes the need for >>having gettext compiled into php. Remember most translators will >>probably be working >>on their home pc, which probably does not have gettext. I seem to >>remember it was an >>involving process to get gettext into php. >> >>As for the variables issue I guess it will boil down to your >>preferrence, since it is not a very >>common thing, it should not affect 80% of the translations, but would >>mean someone >>translating into a new language may one day need to change the code. >> >>By the way there is also an even less common feature to keep in mind >>that has to do with >>the quantity of objects within translations. For example >> >>'You have 2 ITEMS in your bag" is fine for numbers above 1, but >>'You have 1 ITEMS in your bag" is incorrect. >> >>In Arabic it is even worse :) since there are three forms to consider, >>single, dual and plural. :) >> >>Hani >> >>Phil Daintree wrote: >> >> >> >>>*This message was transferred with a trial version of CommuniGate(tm) Pro* >>>This is a good example. >>> >>>Why couldn't the translation string in messages.po be as follows >>> >>>msgid = "Display" >>>msgstr = "Mostra opzioni per il modulo" >>> >>>msgid = "options" >>>msgstr =' ' >>> >>>the output for the English version is: >>> >>>Display $module options >>> >>>the output for the Italian version is: >>> >>>Mostra opzioni per il modulo $module >>> >>>Ok, I know this wouldn't work in some situations but the point is that >>>there are work arounds that might involve more imaginative use of >>>language rather than complex code and additional classes that would work >>>in a good proportion of cases. I would rather us explore these options >>>first. >>> >>>If we absolutely had to, >>>as a last resort, >>>after every other avenue had failed, >>>and there really is no other way ..... >>> >>>and AFTER we have all the scripts 'gettextified' using the absolute bare >>>minimum of "fancy stuff" and if then there is still dissatisfaction I >>>would prefer to use a gettext class: >>> >>>http://phptal.sourceforge.net/bagpack/GetText/doc/gettext.variableinterpolation.html >>> >>>this creates another dependence though and I really really only want to >>>depend on PHP and a DB - nothing else. If it comes to this then it would >>>be better if we could include the minimal additional files in the >>>distribution so there is nothing extra to worry about in terms of PEAR >>>classes to install. >>> >>>Phil >>> >>> >>>On Wed, 2004-09-08 at 20:31, luc...@pd... wrote: >>> >>> >>> >>> >>>>Hello all. >>>>As stated in my previous message, I was trying to solve the problem of sentences with one or more parameters. As an example just consider -"Display ". $ModuleName . " options:"- in www_users. >>>>Here's my proposed solution. >>>>I am using special tags in the tobetranslated and translated sentence, i.e : >>>>ENGLISH: Display __Parameter1__ options >>>>ITALIAN: Mostra opzioni per il modulo __Parameter1__ >>>> >>>>when I have to translate this sentence I make this call: >>>>translate('Display __Parameter1__ options',$ModuleName) >>>> >>>>Here's the definition of the function translate: >>>>function translate($idOfLabelToBeTranslated) >>>>{ >>>> global $lang; >>>> if ($lang[$idOfLabelToBeTranslated]!=null){ >>>> $numargs = func_num_args(); >>>> if($numargs >1){ >>>> $arg_list = func_get_args(); >>>> $returnString=$lang[$idOfLabelToBeTranslated]; >>>> for ($i = 0; $i < $numargs; $i++) { >>>> //echo "Argument $i is: " . $arg_list[$i] . "<br />\n"; >>>> $returnString = str_replace('__Parameter'.$i.'__',$arg_list[$i],$returnString); >>>> } >>>> return $returnString; >>>> } >>>> else //number of arguments is 1 >>>> return $lang[$idOfLabelToBeTranslated]; >>>> } >>>> else //there is no translated label in the array >>>> return $idOfLabelToBeTranslated; >>>>} >>>> >>>>As you can see it takes a variable number of arguments. If we have more than 1 argumentes, i.e. some parameters have to be inserted in the sentence, it simply gets the translated label, which contains the varios strings __Parameter1__ ... __ParameterN__. Then it substitutes the parameter string with the values passed as arguments. >>>> >>>>The main concern I still have on this solution is: >>>>"__ParameterN__" as the tobereplaced string is cabled, thus every translator has to keep in mind to strictly use this formalism. Of course any suggestion on how to choose a formalism wich can be surely not confused with any real life word, will be appreciated. >>>> >>>> >>>> >>>> >>>> >>>> >>> >>> >>>------------------------------------------------------- >>>This SF.Net email is sponsored by BEA Weblogic Workshop >>>FREE Java Enterprise J2EE developer tools! >>>Get your free copy of BEA WebLogic Workshop 8.1 today. >>>http://ads.osdn.com/?ad_id=5047&alloc_id=10808&op=click >>>_______________________________________________ >>>Web-erp-developers mailing list >>>Web...@li... >>>https://lists.sourceforge.net/lists/listinfo/web-erp-developers >>> >>> >>> >>> >>> >>> >> >>------------------------------------------------------- >>This SF.Net email is sponsored by BEA Weblogic Workshop >>FREE Java Enterprise J2EE developer tools! >>Get your free copy of BEA WebLogic Workshop 8.1 today. >>http://ads.osdn.com/?ad_id=5047&alloc_id=10808&op=click >>_______________________________________________ >>Web-erp-developers mailing list >>Web...@li... >>https://lists.sourceforge.net/lists/listinfo/web-erp-developers >> >> >> > > > >------------------------------------------------------- >This SF.Net email is sponsored by BEA Weblogic Workshop >FREE Java Enterprise J2EE developer tools! >Get your free copy of BEA WebLogic Workshop 8.1 today. >http://ads.osdn.com/?ad_id=5047&alloc_id=10808&op=click >_______________________________________________ >Web-erp-developers mailing list >Web...@li... >https://lists.sourceforge.net/lists/listinfo/web-erp-developers > > |
From: Daintrees <p.d...@pa...> - 2004-09-08 19:59:07
|
I have yet to test them out and you mentioned they are yet to go through the translation exercise anyway. I should make a call on the translation stuff later class or no class. Phil ----- Original Message ----- From: "Jesse Peterson" <je...@st...> To: <web...@li...> Sent: Wednesday, September 08, 2004 10:55 PM Subject: Re: [Web-erp-developers] Translation of sentence with parameters... > Phil, if you like a Class like this but need help unnecessary > dependencies, let me/us know and I'll see what I can do. > I'd rather see what I believe to be more complete translations, but will > certainly support whatever is decided upon. > > btw, are you just sitting on the updated set of scripts I sent you > recently waiting for this to play out? Do let me know if you have > problems - I will work out any bugs if you find them, but I feel much > more confident about the updated set. let me know. > > jesse > > Phil Daintree wrote: > > >Looks like we crossed messages. > >I will have a look at this class in more detail - if I must :-( It would > >be a good feature not to be dependent on gettext being compiled in. It > >does say stable. Its miserable to have to declare variables like this > >though! > > > >P > > > >On Wed, 2004-09-08 at 22:05, Hani Naguib wrote: > > > > > >>Hi Phil, > >>The class you mention below is the one I was talking about. It depends > >>on PEAR but > >>removing this dependency was really simple although I can't remember > >>exactly what > >>the dependency was, but it only took 30 mins to figure it out last time. > >> > >>In the end you end up with this extra class (one php file) and I also > >>had another php > >>file (language.php) in which I wrote some shortcut functions. This > >>removes the need for > >>having gettext compiled into php. Remember most translators will > >>probably be working > >>on their home pc, which probably does not have gettext. I seem to > >>remember it was an > >>involving process to get gettext into php. > >> > >>As for the variables issue I guess it will boil down to your > >>preferrence, since it is not a very > >>common thing, it should not affect 80% of the translations, but would > >>mean someone > >>translating into a new language may one day need to change the code. > >> > >>By the way there is also an even less common feature to keep in mind > >>that has to do with > >>the quantity of objects within translations. For example > >> > >>'You have 2 ITEMS in your bag" is fine for numbers above 1, but > >>'You have 1 ITEMS in your bag" is incorrect. > >> > >>In Arabic it is even worse :) since there are three forms to consider, > >>single, dual and plural. :) > >> > >>Hani > >> > >>Phil Daintree wrote: > >> > >> > >> > >>>*This message was transferred with a trial version of CommuniGate(tm) Pro* > >>>This is a good example. > >>> > >>>Why couldn't the translation string in messages.po be as follows > >>> > >>>msgid = "Display" > >>>msgstr = "Mostra opzioni per il modulo" > >>> > >>>msgid = "options" > >>>msgstr =' ' > >>> > >>>the output for the English version is: > >>> > >>>Display $module options > >>> > >>>the output for the Italian version is: > >>> > >>>Mostra opzioni per il modulo $module > >>> > >>>Ok, I know this wouldn't work in some situations but the point is that > >>>there are work arounds that might involve more imaginative use of > >>>language rather than complex code and additional classes that would work > >>>in a good proportion of cases. I would rather us explore these options > >>>first. > >>> > >>>If we absolutely had to, > >>>as a last resort, > >>>after every other avenue had failed, > >>>and there really is no other way ..... > >>> > >>>and AFTER we have all the scripts 'gettextified' using the absolute bare > >>>minimum of "fancy stuff" and if then there is still dissatisfaction I > >>>would prefer to use a gettext class: > >>> > >>>http://phptal.sourceforge.net/bagpack/GetText/doc/gettext.variableinterpo lation.html > >>> > >>>this creates another dependence though and I really really only want to > >>>depend on PHP and a DB - nothing else. If it comes to this then it would > >>>be better if we could include the minimal additional files in the > >>>distribution so there is nothing extra to worry about in terms of PEAR > >>>classes to install. > >>> > >>>Phil > >>> > >>> > >>>On Wed, 2004-09-08 at 20:31, luc...@pd... wrote: > >>> > >>> > >>> > >>> > >>>>Hello all. > >>>>As stated in my previous message, I was trying to solve the problem of sentences with one or more parameters. As an example just consider -"Display ". $ModuleName . " options:"- in www_users. > >>>>Here's my proposed solution. > >>>>I am using special tags in the tobetranslated and translated sentence, i.e : > >>>>ENGLISH: Display __Parameter1__ options > >>>>ITALIAN: Mostra opzioni per il modulo __Parameter1__ > >>>> > >>>>when I have to translate this sentence I make this call: > >>>>translate('Display __Parameter1__ options',$ModuleName) > >>>> > >>>>Here's the definition of the function translate: > >>>>function translate($idOfLabelToBeTranslated) > >>>>{ > >>>> global $lang; > >>>> if ($lang[$idOfLabelToBeTranslated]!=null){ > >>>> $numargs = func_num_args(); > >>>> if($numargs >1){ > >>>> $arg_list = func_get_args(); > >>>> $returnString=$lang[$idOfLabelToBeTranslated]; > >>>> for ($i = 0; $i < $numargs; $i++) { > >>>> //echo "Argument $i is: " . $arg_list[$i] . "<br />\n"; > >>>> $returnString = str_replace('__Parameter'.$i.'__',$arg_list[$i],$returnString); > >>>> } > >>>> return $returnString; > >>>> } > >>>> else //number of arguments is 1 > >>>> return $lang[$idOfLabelToBeTranslated]; > >>>> } > >>>> else //there is no translated label in the array > >>>> return $idOfLabelToBeTranslated; > >>>>} > >>>> > >>>>As you can see it takes a variable number of arguments. If we have more than 1 argumentes, i.e. some parameters have to be inserted in the sentence, it simply gets the translated label, which contains the varios strings __Parameter1__ ... __ParameterN__. Then it substitutes the parameter string with the values passed as arguments. > >>>> > >>>>The main concern I still have on this solution is: > >>>>"__ParameterN__" as the tobereplaced string is cabled, thus every translator has to keep in mind to strictly use this formalism. Of course any suggestion on how to choose a formalism wich can be surely not confused with any real life word, will be appreciated. > >>>> > >>>> > >>>> > >>>> > >>>> > >>>> > >>> > >>> > >>>------------------------------------------------------- > >>>This SF.Net email is sponsored by BEA Weblogic Workshop > >>>FREE Java Enterprise J2EE developer tools! > >>>Get your free copy of BEA WebLogic Workshop 8.1 today. > >>>http://ads.osdn.com/?ad_id=5047&alloc_id=10808&op=click > >>>_______________________________________________ > >>>Web-erp-developers mailing list > >>>Web...@li... > >>>https://lists.sourceforge.net/lists/listinfo/web-erp-developers > >>> > >>> > >>> > >>> > >>> > >>> > >> > >>------------------------------------------------------- > >>This SF.Net email is sponsored by BEA Weblogic Workshop > >>FREE Java Enterprise J2EE developer tools! > >>Get your free copy of BEA WebLogic Workshop 8.1 today. > >>http://ads.osdn.com/?ad_id=5047&alloc_id=10808&op=click > >>_______________________________________________ > >>Web-erp-developers mailing list > >>Web...@li... > >>https://lists.sourceforge.net/lists/listinfo/web-erp-developers > >> > >> > >> > > > > > > > >------------------------------------------------------- > >This SF.Net email is sponsored by BEA Weblogic Workshop > >FREE Java Enterprise J2EE developer tools! > >Get your free copy of BEA WebLogic Workshop 8.1 today. > >http://ads.osdn.com/?ad_id=5047&alloc_id=10808&op=click > >_______________________________________________ > >Web-erp-developers mailing list > >Web...@li... > >https://lists.sourceforge.net/lists/listinfo/web-erp-developers > > > > > > > ------------------------------------------------------- > This SF.Net email is sponsored by BEA Weblogic Workshop > FREE Java Enterprise J2EE developer tools! > Get your free copy of BEA WebLogic Workshop 8.1 today. > http://ads.osdn.com/?ad_id=5047&alloc_id=10808&op=click > _______________________________________________ > Web-erp-developers mailing list > Web...@li... > https://lists.sourceforge.net/lists/listinfo/web-erp-developers > |
From: skaill <sk...@ro...> - 2004-09-08 20:48:52
|
Whatever you decide, Phil I am just happy to have Multilanguage and will work on changing the scripts accordingly. I am, however, still not keen on the variable interpolation (embedded variables within strings). I just see dangers. I see the translator screwing up the variable name, dropping it all together, etc. Unless it uses the built in gettext for ALL but strings with variable interpolation then I see much more demand on the server. They are my main concerns from what I understand so far. I would, however, like an alternative software gettext included for those who can't have a built in gettext. Variable interpolation and a software gettext for those that don't have are, however, two separate issues. It's just that the software gettext has the ability to address both issues if wanted. Steve ----- Original Message ----- From: "Daintrees" <p.d...@pa...> To: <web...@li...> Sent: Wednesday, September 08, 2004 4:00 PM Subject: Re: [Web-erp-developers] Translation of sentence with parameters... > I have yet to test them out and you mentioned they are yet to go through the > translation exercise anyway. > I should make a call on the translation stuff later class or no class. > > Phil > ----- Original Message ----- > From: "Jesse Peterson" <je...@st...> > To: <web...@li...> > Sent: Wednesday, September 08, 2004 10:55 PM > Subject: Re: [Web-erp-developers] Translation of sentence with parameters... > > > > Phil, if you like a Class like this but need help unnecessary > > dependencies, let me/us know and I'll see what I can do. > > I'd rather see what I believe to be more complete translations, but will > > certainly support whatever is decided upon. > > > > btw, are you just sitting on the updated set of scripts I sent you > > recently waiting for this to play out? Do let me know if you have > > problems - I will work out any bugs if you find them, but I feel much > > more confident about the updated set. let me know. > > > > jesse > > > > Phil Daintree wrote: > > > > >Looks like we crossed messages. > > >I will have a look at this class in more detail - if I must :-( It would > > >be a good feature not to be dependent on gettext being compiled in. It > > >does say stable. Its miserable to have to declare variables like this > > >though! > > > > > >P > > > > > >On Wed, 2004-09-08 at 22:05, Hani Naguib wrote: > > > > > > > > >>Hi Phil, > > >>The class you mention below is the one I was talking about. It depends > > >>on PEAR but > > >>removing this dependency was really simple although I can't remember > > >>exactly what > > >>the dependency was, but it only took 30 mins to figure it out last time. > > >> > > >>In the end you end up with this extra class (one php file) and I also > > >>had another php > > >>file (language.php) in which I wrote some shortcut functions. This > > >>removes the need for > > >>having gettext compiled into php. Remember most translators will > > >>probably be working > > >>on their home pc, which probably does not have gettext. I seem to > > >>remember it was an > > >>involving process to get gettext into php. > > >> > > >>As for the variables issue I guess it will boil down to your > > >>preferrence, since it is not a very > > >>common thing, it should not affect 80% of the translations, but would > > >>mean someone > > >>translating into a new language may one day need to change the code. > > >> > > >>By the way there is also an even less common feature to keep in mind > > >>that has to do with > > >>the quantity of objects within translations. For example > > >> > > >>'You have 2 ITEMS in your bag" is fine for numbers above 1, but > > >>'You have 1 ITEMS in your bag" is incorrect. > > >> > > >>In Arabic it is even worse :) since there are three forms to consider, > > >>single, dual and plural. :) > > >> > > >>Hani > > >> > > >>Phil Daintree wrote: > > >> > > >> > > >> > > >>>*This message was transferred with a trial version of CommuniGate(tm) > Pro* > > >>>This is a good example. > > >>> > > >>>Why couldn't the translation string in messages.po be as follows > > >>> > > >>>msgid = "Display" > > >>>msgstr = "Mostra opzioni per il modulo" > > >>> > > >>>msgid = "options" > > >>>msgstr =' ' > > >>> > > >>>the output for the English version is: > > >>> > > >>>Display $module options > > >>> > > >>>the output for the Italian version is: > > >>> > > >>>Mostra opzioni per il modulo $module > > >>> > > >>>Ok, I know this wouldn't work in some situations but the point is that > > >>>there are work arounds that might involve more imaginative use of > > >>>language rather than complex code and additional classes that would > work > > >>>in a good proportion of cases. I would rather us explore these options > > >>>first. > > >>> > > >>>If we absolutely had to, > > >>>as a last resort, > > >>>after every other avenue had failed, > > >>>and there really is no other way ..... > > >>> > > >>>and AFTER we have all the scripts 'gettextified' using the absolute > bare > > >>>minimum of "fancy stuff" and if then there is still dissatisfaction I > > >>>would prefer to use a gettext class: > > >>> > > > >>>http://phptal.sourceforge.net/bagpack/GetText/doc/gettext.variableinterpo > lation.html > > >>> > > >>>this creates another dependence though and I really really only want to > > >>>depend on PHP and a DB - nothing else. If it comes to this then it > would > > >>>be better if we could include the minimal additional files in the > > >>>distribution so there is nothing extra to worry about in terms of PEAR > > >>>classes to install. > > >>> > > >>>Phil > > >>> > > >>> > > >>>On Wed, 2004-09-08 at 20:31, luc...@pd... wrote: > > >>> > > >>> > > >>> > > >>> > > >>>>Hello all. > > >>>>As stated in my previous message, I was trying to solve the problem of > sentences with one or more parameters. As an example just consider -"Display > ". $ModuleName . " options:"- in www_users. > > >>>>Here's my proposed solution. > > >>>>I am using special tags in the tobetranslated and translated sentence, > i.e : > > >>>>ENGLISH: Display __Parameter1__ options > > >>>>ITALIAN: Mostra opzioni per il modulo __Parameter1__ > > >>>> > > >>>>when I have to translate this sentence I make this call: > > >>>>translate('Display __Parameter1__ options',$ModuleName) > > >>>> > > >>>>Here's the definition of the function translate: > > >>>>function translate($idOfLabelToBeTranslated) > > >>>>{ > > >>>> global $lang; > > >>>> if ($lang[$idOfLabelToBeTranslated]!=null){ > > >>>> $numargs = func_num_args(); > > >>>> if($numargs >1){ > > >>>> $arg_list = func_get_args(); > > >>>> $returnString=$lang[$idOfLabelToBeTranslated]; > > >>>> for ($i = 0; $i < $numargs; $i++) { > > >>>> //echo "Argument $i is: " . $arg_list[$i] . "<br />\n"; > > >>>> $returnString = > str_replace('__Parameter'.$i.'__',$arg_list[$i],$returnString); > > >>>> } > > >>>> return $returnString; > > >>>> } > > >>>> else //number of arguments is 1 > > >>>> return $lang[$idOfLabelToBeTranslated]; > > >>>> } > > >>>> else //there is no translated label in the array > > >>>> return $idOfLabelToBeTranslated; > > >>>>} > > >>>> > > >>>>As you can see it takes a variable number of arguments. If we have > more than 1 argumentes, i.e. some parameters have to be inserted in the > sentence, it simply gets the translated label, which contains the varios > strings __Parameter1__ ... __ParameterN__. Then it substitutes the parameter > string with the values passed as arguments. > > >>>> > > >>>>The main concern I still have on this solution is: > > >>>>"__ParameterN__" as the tobereplaced string is cabled, thus every > translator has to keep in mind to strictly use this formalism. Of course any > suggestion on how to choose a formalism wich can be surely not confused with > any real life word, will be appreciated. > > >>>> > > >>>> > > >>>> > > >>>> > > >>>> > > >>>> > > >>> > > >>> > > >>>------------------------------------------------------- > > >>>This SF.Net email is sponsored by BEA Weblogic Workshop > > >>>FREE Java Enterprise J2EE developer tools! > > >>>Get your free copy of BEA WebLogic Workshop 8.1 today. > > >>>http://ads.osdn.com/?ad_id=5047&alloc_id=10808&op=click > > >>>_______________________________________________ > > >>>Web-erp-developers mailing list > > >>>Web...@li... > > >>>https://lists.sourceforge.net/lists/listinfo/web-erp-developers > > >>> > > >>> > > >>> > > >>> > > >>> > > >>> > > >> > > >>------------------------------------------------------- > > >>This SF.Net email is sponsored by BEA Weblogic Workshop > > >>FREE Java Enterprise J2EE developer tools! > > >>Get your free copy of BEA WebLogic Workshop 8.1 today. > > >>http://ads.osdn.com/?ad_id=5047&alloc_id=10808&op=click > > >>_______________________________________________ > > >>Web-erp-developers mailing list > > >>Web...@li... > > >>https://lists.sourceforge.net/lists/listinfo/web-erp-developers > > >> > > >> > > >> > > > > > > > > > > > >------------------------------------------------------- > > >This SF.Net email is sponsored by BEA Weblogic Workshop > > >FREE Java Enterprise J2EE developer tools! > > >Get your free copy of BEA WebLogic Workshop 8.1 today. > > >http://ads.osdn.com/?ad_id=5047&alloc_id=10808&op=click > > >_______________________________________________ > > >Web-erp-developers mailing list > > >Web...@li... > > >https://lists.sourceforge.net/lists/listinfo/web-erp-developers > > > > > > > > > > > > ------------------------------------------------------- > > This SF.Net email is sponsored by BEA Weblogic Workshop > > FREE Java Enterprise J2EE developer tools! > > Get your free copy of BEA WebLogic Workshop 8.1 today. > > http://ads.osdn.com/?ad_id=5047&alloc_id=10808&op=click > > _______________________________________________ > > Web-erp-developers mailing list > > Web...@li... > > https://lists.sourceforge.net/lists/listinfo/web-erp-developers > > > > > > ------------------------------------------------------- > This SF.Net email is sponsored by BEA Weblogic Workshop > FREE Java Enterprise J2EE developer tools! > Get your free copy of BEA WebLogic Workshop 8.1 today. > http://ads.osdn.com/?ad_id=5047&alloc_id=10808&op=click > _______________________________________________ > Web-erp-developers mailing list > Web...@li... > https://lists.sourceforge.net/lists/listinfo/web-erp-developers |
From: Phil D. <we...@pa...> - 2004-09-08 11:01:07
|
> > on PEAR but > > removing this dependency was really simple although I can't remember > > exactly what > > the dependency was, but it only took 30 mins to figure it out last time. Looks like it was just the raiseerror function ? I had a look at OA GetText.php class and looked at a diff between them and the current class. This class is actually pretty minimal ;-) As I understand it this will read the .po file into an array every page... must be a shocker performance wise!! I guess it is only a fall back though. If the _ function is already there - ie gettext already compiled into PHP then how can the variable stuff work. It would simply by-pass the class altogether would it not?? Your shortcut function only works as mine did to see if ! function_exists('_'). How could we over-ride the existing function to use this class - which appears to use gettext native if it can then if not fall back to parsing the .po file into an array. I think Luca's DB method might be preferrable to this albeit we are into cut and paste big time - which gettext overcomes fantastically with xgettext. With the DB method at least we only retrieve the strings for the script not the whole lot. This needs even more thought!! Phil Phil |
From: skaill <sk...@ro...> - 2004-09-08 13:45:37
|
When using the built in gettext you cannot have variables interpolated within strings. Therefore I would still suggest not to do it or you are relying on the software version always. I do believe the software version should be included though for those who cannot have it installed. It also sounds easy enough to include it and you're saying it's stable. Checking whether the built in function exists and to call it or call the software version is the only other thing that needs to be done. Other than that we would be on the same plan we were on as far as changing the pages to provide translation. Nothing would change about that. Steve ----- Original Message ----- From: "Phil Daintree" <we...@pa...> To: <web...@li...> Sent: Wednesday, September 08, 2004 7:01 AM Subject: Re: [Web-erp-developers] Translation of sentence with parameters... > > > > on PEAR but > > > removing this dependency was really simple although I can't remember > > > exactly what > > > the dependency was, but it only took 30 mins to figure it out last time. > > > Looks like it was just the raiseerror function ? > I had a look at OA GetText.php class and looked at a diff between them > and the current class. > > This class is actually pretty minimal ;-) > > As I understand it this will read the .po file into an array every > page... must be a shocker performance wise!! I guess it is only a fall > back though. > > If the _ function is already there - ie gettext already compiled into > PHP then how can the variable stuff work. It would simply by-pass the > class altogether would it not?? Your shortcut function only works as > mine did to see if ! function_exists('_'). How could we over-ride the > existing function to use this class - which appears to use gettext > native if it can then if not fall back to parsing the .po file into an > array. > > I think Luca's DB method might be preferrable to this albeit we are into > cut and paste big time - which gettext overcomes fantastically with > xgettext. With the DB method at least we only retrieve the strings for > the script not the whole lot. > > This needs even more thought!! > > Phil > > Phil > > > > > ------------------------------------------------------- > This SF.Net email is sponsored by BEA Weblogic Workshop > FREE Java Enterprise J2EE developer tools! > Get your free copy of BEA WebLogic Workshop 8.1 today. > http://ads.osdn.com/?ad_id=5047&alloc_id=10808&op=click > _______________________________________________ > Web-erp-developers mailing list > Web...@li... > https://lists.sourceforge.net/lists/listinfo/web-erp-developers |
From: Hani N. <ha...@na...> - 2004-09-08 14:06:30
|
skaill wrote: >When using the built in gettext you cannot have variables interpolated >within strings. Therefore I would still suggest not to do it or you are >relying on the software version always. I do believe the software version >should be included though for those who cannot have it installed. It also >sounds easy enough to include it and you're saying it's stable. > > Using the script will give you the ability of having variables interpolated, so I would suggest using it. If you have gettext it will use it AND give you variable interpolation, if you dont it will still work. This is a tiny 18k script I dont see why you would not want to use it. To me it boils down to this; If you are going to use gettext then you should use this script if you are going to use a db approach do it in a way that allows you to use gettext tools such as xgettext. I would go further and say in a db approach you should be able to give translators .po and .pot files which they can use in a proper translation oriented editor. That might mean creating a few scripts that populate/merge/update the db given .po files. Having said that I think the db version is overkill. |
From: skaill <sk...@ro...> - 2004-09-08 14:47:27
|
I think I'm confused. I thought the script was an alternative to the built in gettext. Guess I just don't understand how it can use the built in gettext when the variables are embedded in the strings unless it ends up using the alternative software gettext every time. I'm not crazy about the db solution. It's a one shot instead of well known and tested. I think there are other ways such as building a tool that extracts the strings in the po and puts them into a database if you want to work with the database for other reasons. Building another tool that takes the database and makes a po. From what I've seen it would not be difficult to build such tools. Steve ----- Original Message ----- From: "Hani Naguib" <ha...@na...> To: <web...@li...> Sent: Wednesday, September 08, 2004 10:06 AM Subject: Re: [Web-erp-developers] Translation of sentence with parameters... > skaill wrote: > > >When using the built in gettext you cannot have variables interpolated > >within strings. Therefore I would still suggest not to do it or you are > >relying on the software version always. I do believe the software version > >should be included though for those who cannot have it installed. It also > >sounds easy enough to include it and you're saying it's stable. > > > > > Using the script will give you the ability of having variables > interpolated, so I would suggest using it. > If you have gettext it will use it AND give you variable interpolation, > if you dont it will still work. > This is a tiny 18k script I dont see why you would not want to use it. > To me it boils down to this; > If you are going to use gettext then you should use this script if you > are going to use a db approach > do it in a way that allows you to use gettext tools such as xgettext. I > would go further and say > in a db approach you should be able to give translators .po and .pot > files which they can use in > a proper translation oriented editor. That might mean creating a few > scripts that populate/merge/update the db given .po files. > > Having said that I think the db version is overkill. > > > ------------------------------------------------------- > This SF.Net email is sponsored by BEA Weblogic Workshop > FREE Java Enterprise J2EE developer tools! > Get your free copy of BEA WebLogic Workshop 8.1 today. > http://ads.osdn.com/?ad_id=5047&alloc_id=10808&op=click > _______________________________________________ > Web-erp-developers mailing list > Web...@li... > https://lists.sourceforge.net/lists/listinfo/web-erp-developers |
From: Hani N. <ha...@na...> - 2004-09-08 13:45:41
|
Phil Daintree wrote: > >If the _ function is already there - ie gettext already compiled into >PHP then how can the variable stuff work. It would simply by-pass the >class altogether would it not?? Your shortcut function only works as >mine did to see if ! function_exists('_'). How could we over-ride the >existing function to use this class - which appears to use gettext >native if it can then if not fall back to parsing the .po file into an >array. > > > Good point, does the compiled version of gettext define a _(), I had assumed it only had the gettext() method. If it does you would need to call GetText::gettext() or create a more suitable alias. >I think Luca's DB method might be preferrable to this albeit we are into >cut and paste big time - which gettext overcomes fantastically with >xgettext. With the DB method at least we only retrieve the strings for >the script not the whole lot. > > > Just a thought if you go down this way you can still use xgettext to extract the strings for you. You could then create a couple of scripts for populating your db etc... |
From: Daintrees <p.d...@pa...> - 2004-09-09 01:31:12
|
Wow this is torture! The original objection to multi-language was the compromise to readability ... with gettext _() this is not really all that bad - it just took me a year to figure out (following Hani/Sherif's departure with OA). However, declaring variables for substitution in other positions gets more messy - another class file which is really only necessary for this and those who don't comile gettext into PHP - pretty few by all accounts is just a waste if we dont use variable substitution. Yes we could use it, but it would be dog slow and introduce more complexity than we need - we don't have to use it and the penalty is variable substituion and one or two (ok Jesse 4 or 5 dodgy translations) Complied in gettext gives us translation with some compromises in the interests of code readability - this makes the decision more simple. The php class could be built on as a hack quite easily for those who can't get gettext proper running as Steve mentions. We could and have gone round and round on this - In the final analysis I would prefer us to use: -gettext compiled in as a necessary requirement for translation - ensuring performance is not an issue -system works without gettext - just passing through the original string - no variable substitution in the interests of simplicity and readability but at the expense of completly accurate translations The good news there are 10 scripts already done this way. The bad news is that this pleases no-one .... Luca wants a db solution. Steve wants the gettext class without substitution - for gettext functionality without compilation/enabling .dlls Jesse wants the gettext class and substition - I think Hani and Jesse are on the same wavelength. I do hope you guys will all get in behind me though. Thanks for all the comments. Phil ----- Original Message ----- From: "Hani Naguib" <ha...@na...> To: <web...@li...> Sent: Thursday, September 09, 2004 1:45 AM Subject: Re: [Web-erp-developers] Translation of sentence with parameters... > Phil Daintree wrote: > > > > >If the _ function is already there - ie gettext already compiled into > >PHP then how can the variable stuff work. It would simply by-pass the > >class altogether would it not?? Your shortcut function only works as > >mine did to see if ! function_exists('_'). How could we over-ride the > >existing function to use this class - which appears to use gettext > >native if it can then if not fall back to parsing the .po file into an > >array. > > > > > > > Good point, does the compiled version of gettext define a _(), I had > assumed it only had the > gettext() method. If it does you would need to call GetText::gettext() > or create a more suitable > alias. > > >I think Luca's DB method might be preferrable to this albeit we are into > >cut and paste big time - which gettext overcomes fantastically with > >xgettext. With the DB method at least we only retrieve the strings for > >the script not the whole lot. > > > > > > > Just a thought if you go down this way you can still use xgettext to > extract the strings for you. > You could then create a couple of scripts for populating your db etc... > > > ------------------------------------------------------- > This SF.Net email is sponsored by BEA Weblogic Workshop > FREE Java Enterprise J2EE developer tools! > Get your free copy of BEA WebLogic Workshop 8.1 today. > http://ads.osdn.com/?ad_id=5047&alloc_id=10808&op=click > _______________________________________________ > Web-erp-developers mailing list > Web...@li... > https://lists.sourceforge.net/lists/listinfo/web-erp-developers > |
From: skaill <sk...@ro...> - 2004-09-09 01:58:29
|
There has always been a better way to do things since the beginning of time. We could take the opportunity to rework a bazillion other things too but would it get done and would it be done right?!Decisions have to be made at some point and they need to be made with the direction and interests of the project. I am fine with your decision as always Phil. I will build the software gettext in if and when I need it. Let's remember that it's a tough position we have put Phil in considering he wasn't that crazy about Multilanguage in the first place! Steve ----- Original Message ----- From: "Daintrees" <p.d...@pa...> To: <web...@li...> Sent: Wednesday, September 08, 2004 9:33 PM Subject: Re: [Web-erp-developers] Translation of sentence with parameters... > Wow this is torture! > > The original objection to multi-language was the compromise to readability > ... with gettext _() this is not really all that bad - it just took me a > year to figure out (following Hani/Sherif's departure with OA). However, > declaring variables for substitution in other positions gets more messy - > another class file which is really only necessary for this and those who > don't comile gettext into PHP - pretty few by all accounts is just a waste > if we dont use variable substitution. Yes we could use it, but it would be > dog slow and introduce more complexity than we need - we don't have to use > it and the penalty is variable substituion and one or two (ok Jesse 4 or 5 > dodgy translations) > > Complied in gettext gives us translation with some compromises in the > interests of code readability - this makes the decision more simple. The php > class could be built on as a hack quite easily for those who can't get > gettext proper running as Steve mentions. > > We could and have gone round and round on this - > > In the final analysis I would prefer us to use: > > -gettext compiled in as a necessary requirement for translation - ensuring > performance is not an issue > -system works without gettext - just passing through the original string > - no variable substitution in the interests of simplicity and readability > but at the expense of completly accurate translations > > The good news there are 10 scripts already done this way. > > The bad news is that this pleases no-one .... > > Luca wants a db solution. > Steve wants the gettext class without substitution - for gettext > functionality without compilation/enabling .dlls > Jesse wants the gettext class and substition - I think Hani and Jesse are on > the same wavelength. > > I do hope you guys will all get in behind me though. > > Thanks for all the comments. > > Phil > ----- Original Message ----- > From: "Hani Naguib" <ha...@na...> > To: <web...@li...> > Sent: Thursday, September 09, 2004 1:45 AM > Subject: Re: [Web-erp-developers] Translation of sentence with parameters... > > > > Phil Daintree wrote: > > > > > > > >If the _ function is already there - ie gettext already compiled into > > >PHP then how can the variable stuff work. It would simply by-pass the > > >class altogether would it not?? Your shortcut function only works as > > >mine did to see if ! function_exists('_'). How could we over-ride the > > >existing function to use this class - which appears to use gettext > > >native if it can then if not fall back to parsing the .po file into an > > >array. > > > > > > > > > > > Good point, does the compiled version of gettext define a _(), I had > > assumed it only had the > > gettext() method. If it does you would need to call GetText::gettext() > > or create a more suitable > > alias. > > > > >I think Luca's DB method might be preferrable to this albeit we are into > > >cut and paste big time - which gettext overcomes fantastically with > > >xgettext. With the DB method at least we only retrieve the strings for > > >the script not the whole lot. > > > > > > > > > > > Just a thought if you go down this way you can still use xgettext to > > extract the strings for you. > > You could then create a couple of scripts for populating your db etc... > > > > > > ------------------------------------------------------- > > This SF.Net email is sponsored by BEA Weblogic Workshop > > FREE Java Enterprise J2EE developer tools! > > Get your free copy of BEA WebLogic Workshop 8.1 today. > > http://ads.osdn.com/?ad_id=5047&alloc_id=10808&op=click > > _______________________________________________ > > Web-erp-developers mailing list > > Web...@li... > > https://lists.sourceforge.net/lists/listinfo/web-erp-developers > > > > > > ------------------------------------------------------- > This SF.Net email is sponsored by BEA Weblogic Workshop > FREE Java Enterprise J2EE developer tools! > Get your free copy of BEA WebLogic Workshop 8.1 today. > http://ads.osdn.com/?ad_id=5047&alloc_id=10808&op=click > _______________________________________________ > Web-erp-developers mailing list > Web...@li... > https://lists.sourceforge.net/lists/listinfo/web-erp-developers |
From: Phil D. <we...@pa...> - 2004-09-10 14:20:44
|
15 scripts done team. There's a bunch of people listening on the developers list and if anyone fancies a crack at a couple of scripts do please let me know. We need all the help we can muster on this. Phil |
From: skaill <sk...@ro...> - 2004-09-10 14:49:16
|
I'm trying to commit myself to doing one a day at the beginning of the day before it gets crazy :O Seems to be taking about 30 mins per script. When done, searching through the entire file for $ is well worth it. This will find variables that may be left in strings but those strings have been changed to a single quote. A color coded editor such as HTML Kit helps too. Steve ----- Original Message ----- From: "Phil Daintree" <we...@pa...> To: <web...@li...> Sent: Friday, September 10, 2004 10:19 AM Subject: [Web-erp-developers] Multi-language > 15 scripts done team. > > There's a bunch of people listening on the developers list and if anyone > fancies a crack at a couple of scripts do please let me know. We need > all the help we can muster on this. > > Phil > > > > ------------------------------------------------------- > This SF.Net email is sponsored by: YOU BE THE JUDGE. Be one of 170 > Project Admins to receive an Apple iPod Mini FREE for your judgement on > who ports your project to Linux PPC the best. Sponsored by IBM. > Deadline: Sept. 13. Go here: http://sf.net/ppc_contest.php > _______________________________________________ > Web-erp-developers mailing list > Web...@li... > https://lists.sourceforge.net/lists/listinfo/web-erp-developers |
From: skaill <sk...@ro...> - 2004-09-08 13:35:45
|
I don't think you have to declare the variable though if you break the strings up into pieces the way we have been. That's only if the variables are embedded in the string. Steve ----- Original Message ----- From: "Phil Daintree" <we...@pa...> To: <web...@li...> Sent: Wednesday, September 08, 2004 6:19 AM Subject: Re: [Web-erp-developers] Translation of sentence with parameters... > Looks like we crossed messages. > I will have a look at this class in more detail - if I must :-( It would > be a good feature not to be dependent on gettext being compiled in. It > does say stable. Its miserable to have to declare variables like this > though! > > P > > On Wed, 2004-09-08 at 22:05, Hani Naguib wrote: > > Hi Phil, > > The class you mention below is the one I was talking about. It depends > > on PEAR but > > removing this dependency was really simple although I can't remember > > exactly what > > the dependency was, but it only took 30 mins to figure it out last time. > > > > In the end you end up with this extra class (one php file) and I also > > had another php > > file (language.php) in which I wrote some shortcut functions. This > > removes the need for > > having gettext compiled into php. Remember most translators will > > probably be working > > on their home pc, which probably does not have gettext. I seem to > > remember it was an > > involving process to get gettext into php. > > > > As for the variables issue I guess it will boil down to your > > preferrence, since it is not a very > > common thing, it should not affect 80% of the translations, but would > > mean someone > > translating into a new language may one day need to change the code. > > > > By the way there is also an even less common feature to keep in mind > > that has to do with > > the quantity of objects within translations. For example > > > > 'You have 2 ITEMS in your bag" is fine for numbers above 1, but > > 'You have 1 ITEMS in your bag" is incorrect. > > > > In Arabic it is even worse :) since there are three forms to consider, > > single, dual and plural. :) > > > > Hani > > > > Phil Daintree wrote: > > > > >*This message was transferred with a trial version of CommuniGate(tm) Pro* > > >This is a good example. > > > > > >Why couldn't the translation string in messages.po be as follows > > > > > >msgid = "Display" > > >msgstr = "Mostra opzioni per il modulo" > > > > > >msgid = "options" > > >msgstr =' ' > > > > > >the output for the English version is: > > > > > >Display $module options > > > > > >the output for the Italian version is: > > > > > >Mostra opzioni per il modulo $module > > > > > >Ok, I know this wouldn't work in some situations but the point is that > > >there are work arounds that might involve more imaginative use of > > >language rather than complex code and additional classes that would work > > >in a good proportion of cases. I would rather us explore these options > > >first. > > > > > >If we absolutely had to, > > >as a last resort, > > >after every other avenue had failed, > > >and there really is no other way ..... > > > > > >and AFTER we have all the scripts 'gettextified' using the absolute bare > > >minimum of "fancy stuff" and if then there is still dissatisfaction I > > >would prefer to use a gettext class: > > > > > >http://phptal.sourceforge.net/bagpack/GetText/doc/gettext.variableinterpola tion.html > > > > > >this creates another dependence though and I really really only want to > > >depend on PHP and a DB - nothing else. If it comes to this then it would > > >be better if we could include the minimal additional files in the > > >distribution so there is nothing extra to worry about in terms of PEAR > > >classes to install. > > > > > >Phil > > > > > > > > >On Wed, 2004-09-08 at 20:31, luc...@pd... wrote: > > > > > > > > >>Hello all. > > >>As stated in my previous message, I was trying to solve the problem of sentences with one or more parameters. As an example just consider -"Display ". $ModuleName . " options:"- in www_users. > > >>Here's my proposed solution. > > >>I am using special tags in the tobetranslated and translated sentence, i.e : > > >>ENGLISH: Display __Parameter1__ options > > >>ITALIAN: Mostra opzioni per il modulo __Parameter1__ > > >> > > >>when I have to translate this sentence I make this call: > > >>translate('Display __Parameter1__ options',$ModuleName) > > >> > > >>Here's the definition of the function translate: > > >>function translate($idOfLabelToBeTranslated) > > >>{ > > >> global $lang; > > >> if ($lang[$idOfLabelToBeTranslated]!=null){ > > >> $numargs = func_num_args(); > > >> if($numargs >1){ > > >> $arg_list = func_get_args(); > > >> $returnString=$lang[$idOfLabelToBeTranslated]; > > >> for ($i = 0; $i < $numargs; $i++) { > > >> //echo "Argument $i is: " . $arg_list[$i] . "<br />\n"; > > >> $returnString = str_replace('__Parameter'.$i.'__',$arg_list[$i],$returnString); > > >> } > > >> return $returnString; > > >> } > > >> else //number of arguments is 1 > > >> return $lang[$idOfLabelToBeTranslated]; > > >> } > > >> else //there is no translated label in the array > > >> return $idOfLabelToBeTranslated; > > >>} > > >> > > >>As you can see it takes a variable number of arguments. If we have more than 1 argumentes, i.e. some parameters have to be inserted in the sentence, it simply gets the translated label, which contains the varios strings __Parameter1__ ... __ParameterN__. Then it substitutes the parameter string with the values passed as arguments. > > >> > > >>The main concern I still have on this solution is: > > >>"__ParameterN__" as the tobereplaced string is cabled, thus every translator has to keep in mind to strictly use this formalism. Of course any suggestion on how to choose a formalism wich can be surely not confused with any real life word, will be appreciated. > > >> > > >> > > >> > > >> > > > > > > > > > > > > > > >------------------------------------------------------- > > >This SF.Net email is sponsored by BEA Weblogic Workshop > > >FREE Java Enterprise J2EE developer tools! > > >Get your free copy of BEA WebLogic Workshop 8.1 today. > > >http://ads.osdn.com/?ad_id=5047&alloc_id=10808&op=click > > >_______________________________________________ > > >Web-erp-developers mailing list > > >Web...@li... > > >https://lists.sourceforge.net/lists/listinfo/web-erp-developers > > > > > > > > > > > > > > > > > > > > ------------------------------------------------------- > > This SF.Net email is sponsored by BEA Weblogic Workshop > > FREE Java Enterprise J2EE developer tools! > > Get your free copy of BEA WebLogic Workshop 8.1 today. > > http://ads.osdn.com/?ad_id=5047&alloc_id=10808&op=click > > _______________________________________________ > > Web-erp-developers mailing list > > Web...@li... > > https://lists.sourceforge.net/lists/listinfo/web-erp-developers > > > > > > ------------------------------------------------------- > This SF.Net email is sponsored by BEA Weblogic Workshop > FREE Java Enterprise J2EE developer tools! > Get your free copy of BEA WebLogic Workshop 8.1 today. > http://ads.osdn.com/?ad_id=5047&alloc_id=10808&op=click > _______________________________________________ > Web-erp-developers mailing list > Web...@li... > https://lists.sourceforge.net/lists/listinfo/web-erp-developers |
From: Phil D. <we...@pa...> - 2004-09-12 06:38:56
|
It is a little more tricky with pdf report. A $title will not normally be required unless the input form is shown - PDFStarter_ros.inc has the authentication stuff in it and session initialisation and includes the LanguageSetup.php $title really only needs to be defined before a header.inc so the $title in reports should be moved to before the include('includes/header.inc'); Phil On Sun, 2004-09-12 at 11:33, Hani Naguib wrote: > Hi Phil, I have attached the DebtorsAtPeriodEnd.php with my modifications= . > I am not familiar with your code so I would appreciate if you could have=20 > a look at this and > make sure I have not done anything stupid or missed things that should=20 > have been translated. >=20 > I did notice a few things. > 'includes/session.inc' includes 'includes/LanguageSetup.php' at=20 > the end of the file. This means > that the language stuff breaks initially on a system that does not have=20 > gettext installed, since the _() function > is not defined until the LanguageSetup is called but session.inc uses it=20 > before including LanguageSetup. >=20 > In DebtorsAtPeriodEnd.php I moved the include session.php to the start=20 > of the script so I could set the title. > I don't know what the implications of doing that are in your code. But I=20 > suspect I should not have done that! > Could you let me know what the policy is for what includes I should use=20 > prior to setting the title? >=20 > Hani >=20 > Phil Daintree wrote: >=20 > >*This message was transferred with a trial version of CommuniGate(tm) Pr= o* > > =20 > > > >>Once you guys settle on the approach I can give you a hand with some sc= ripts > >>although you would have to let me know which ones :) > >> > >> =20 > >> > > > >Hani, > > > >I noticed you kind offer and have pulled a couple off the list in > >alpabetical order ... > > > >DebtorsAtPeriodEnd.php Hani > >DeliveryDetails.php Hani > >DiscountCategories.php Hani > >DiscountMatrix.php Hani > > > > > >Many thanks > > > >Phil > > > > > > > >------------------------------------------------------- > >This SF.Net email is sponsored by: YOU BE THE JUDGE. Be one of 170 > >Project Admins to receive an Apple iPod Mini FREE for your judgement on > >who ports your project to Linux PPC the best. Sponsored by IBM.=20 > >Deadline: Sept. 13. Go here: http://sf.net/ppc_contest.php > >_______________________________________________ > >Web-erp-developers mailing list > >Web...@li... > >https://lists.sourceforge.net/lists/listinfo/web-erp-developers > > > > > > =20 > > >=20 >=20 > ______________________________________________________________________ > =3D1 AND isset($_POST['ToCriteria']) AND > strlen($_POST['ToCriteria'])>=3D1){ include("config.php"); > include("includes/ConnectDB.inc"); > include("includes/PDFStarter_ros.inc"); $FontSize=3D12; > $pdf->addinfo('Title',"Customer Balance Listing"); > $pdf->addinfo('Subject','Customer Balances'); $PageNumber=3D0; > $line_height=3D12; /*Get the date of the last day in the period selected > */ $SQL =3D "SELECT LastDate_In_Period FROM Periods WHERE PeriodNo =3D " = . > $_POST['PeriodEnd']; $PeriodEndResult =3D DB_query($SQL,$db,"Could not > get the date of the last day in the period selected"); $PeriodRow =3D > DB_fetch_row($PeriodEndResult); $PeriodEndDate =3D > ConvertSQLDate($PeriodRow[0]); /*Now figure out the aged analysis for > the customer range under review */ $SQL =3D "SELECT > DebtorsMaster.DebtorNo, DebtorsMaster.Name, Currencies.Currency, > Sum((DebtorTrans.OvAmount + DebtorTrans.OvGST + DebtorTrans.OvFreight > + DebtorTrans.OvDiscount - DebtorTrans.Alloc)/DebtorTrans.Rate) AS > Balance, Sum(DebtorTrans.OvAmount + DebtorTrans.OvGST + > DebtorTrans.OvFreight + DebtorTrans.OvDiscount - DebtorTrans.Alloc) AS > FXBalance, Sum(CASE WHEN DebtorTrans.Prd > " . $_POST['PeriodEnd'] . " > THEN (DebtorTrans.OvAmount + DebtorTrans.OvGST + DebtorTrans.OvFreight > + DebtorTrans.OvDiscount)/DebtorTrans.Rate ELSE 0 END) AS > AfterDateTrans, Sum(CASE WHEN DebtorTrans.Prd > " . > $_POST['PeriodEnd'] . " THEN DebtorTrans.OvAmount + DebtorTrans.OvGST > + DebtorTrans.OvFreight + DebtorTrans.OvDiscount ELSE 0 END ) AS > FXAfterDateTrans FROM DebtorsMaster, Currencies, DebtorTrans WHERE > DebtorsMaster.CurrCode =3D Currencies.CurrAbrev AND > DebtorsMaster.DebtorNo =3D DebtorTrans.DebtorNo AND > DebtorsMaster.DebtorNo >=3D '" . $_POST['FromCriteria'] . "' AND > DebtorsMaster.DebtorNo <=3D '" . $_POST['ToCriteria'] . "' GROUP BY > DebtorsMaster.DebtorNo, DebtorsMaster.Name, Currencies.Currency"; > $CustomerResult =3D DB_query($SQL,$db); if (DB_error_no($db) !=3D0) { > $title =3D _("Customer Balances - Problem Report.... "); > include("includes/header.inc"); echo _("The customer details could not > be retrieved by the SQL because - ") . DB_error_msg($db); echo " > " . _("Back to the menu") . ""; if ($debug=3D=3D1){ echo " > $SQL"; } include("includes/footer.inc"); exit; } include > ("includes/PDFDebtorBalsPageHeader.inc"); $TotBal=3D0; While > ($DebtorBalances =3D DB_fetch_array($CustomerResult,$db)){ $Balance =3D > $DebtorBalances["Balance"] - $DebtorBalances['AfterDateTrans']; > $FXBalance =3D $DebtorBalances["FXBalance"] - > $DebtorBalances['FXAfterDateTrans']; if (ABS($Balance)>0.009 OR > ABS($FXBalance)>0.009) { $DisplayBalance =3D > number_format($DebtorBalances["Balance"] - > $DebtorBalances['AfterDateTrans'],2); $DisplayFXBalance =3D > number_format($DebtorBalances["FXBalance"] - > $DebtorBalances['FXAfterDateTrans'],2); $TotBal +=3D $Balance; > $LeftOvers =3D > $pdf->addTextWrap($Left_Margin,$YPos,220-$Left_Margin,$FontSize,$DebtorBa= lances["DebtorNo"] . " - " . $DebtorBalances["Name"],'left'); $LeftOvers = =3D $pdf->addTextWrap(220,$YPos,60,$FontSize,$DisplayBalance,'right'); $Lef= tOvers =3D $pdf->addTextWrap(280,$YPos,60,$FontSize,$DisplayFXBalance,'righ= t'); $LeftOvers =3D $pdf->addTextWrap(350,$YPos,100,$FontSize,$DebtorBalanc= es['Currency'],'left'); $YPos -=3D$line_height; if ($YPos < $Bottom_Margin = + $line_height){ include("includes/PDFDebtorBalsPageHeader.inc"); } } } /*e= nd customer aged analysis while loop */ $YPos -=3D$line_height; if ($YPos <= $Bottom_Margin + (2*$line_height)){ $PageNumber++; include("includes/PDFDe= btorBalsPageHeader.inc"); } $DisplayTotBalance =3D number_format($TotBal,2)= ; $LeftOvers =3D $pdf->addTextWrap(220,$YPos,60,$FontSize,$DisplayTotBalanc= e,'right'); $buf =3D $pdf->output(); $len =3D strlen($buf); header("Content= -type: application/pdf"); header("Content-Length: $len"); header("Content-D= isposition: inline; filename=3DDebtorBals.pdf"); header("Expires: 0"); head= er("Cache-Control: must-revalidate, post-check=3D0, pre-check=3D0"); header= ("Pragma: public"); $pdf->stream(); } else { /*The option to print PDF was = not hit */ include("includes/header.inc"); include("includes/SQL_CommonFunc= tions.inc"); $CompanyRecord =3D ReadInCompanyRecord($db); if (strlen($_POST= ['FromCriteria'])<1 || strlen($_POST['ToCriteria'])<1) { /*if $FromCriteria= is not set then show a form to allow input */ echo " > " . _("From Customer Code") .": > =20 > " . _("To Customer Code") . ": > =20 > " . _("Balances As At") . ": > "; $sql =3D "SELECT PeriodNo, > LastDate_In_Period FROM Periods"; > $Periods =3D > DB_query($sql,$db,_("Could not > retrieve period data > because"),_("The SQL that failed to > get the period data was:")); while > ($myrow =3D > DB_fetch_array($Periods,$db)){ echo > " >=20 > "; include("includes/footer.inc"); } /*end of else not PrintPDF */ ?> |
From: Phil D. <we...@pa...> - 2004-09-12 06:40:42
|
Many thanks Hani for this - I've just fixed that bit. Phil On Sun, 2004-09-12 at 11:33, Hani Naguib wrote: > Hi Phil, I have attached the DebtorsAtPeriodEnd.php with my modifications. > I am not familiar with your code so I would appreciate if you could have > a look at this and > make sure I have not done anything stupid or missed things that should > have been translated. > > I did notice a few things. > 'includes/session.inc' includes 'includes/LanguageSetup.php' at > the end of the file. This means > that the language stuff breaks initially on a system that does not have > gettext installed, since the _() function > is not defined until the LanguageSetup is called but session.inc uses it > before including LanguageSetup. > > In DebtorsAtPeriodEnd.php I moved the include session.php to the start > of the script so I could set the title. > I don't know what the implications of doing that are in your code. But I > suspect I should not have done that! > Could you let me know what the policy is for what includes I should use > prior to setting the title? > > Hani > > > |