From: Daintrees <p.d...@pa...> - 2004-09-07 01:27:04
|
Glad to have you back Luca. As noted previosuly, I am also very keen on having the ability to mak= e translations in a web-form that feed through into the application immediately. I have been exchanging email with Rom regarding this and= have basically spec'd up the way this could be done by reading in a meesag= es.po file and showing the original msgid strings and the following msgstr = string. Having edited and re-written the messages.po file using a simple php = scrip behind the scenes re-running the gettext utility to create the .mo fi= le. Stopping and starting apache does not seem to be required. Rom is kee= n to get into this project - it would certainly have wider appeal than jus= t webERP and would give us the advantages you are seeking as well as th= e generic localisation code used by most php applications. The way we have things will allow for the translation effort to proce= ed with no impact on the usability of the system. The two issues important to you are also citical for me to: 1. having the application working at any time, even during translati= on 2. having a simple way to translate without the danger of destroying= the application. We have to modify the scripts under either scenario - the gettext met= hod I believe will be a heck of a lot less work and could be done with conc= erted effort by us all within the month. The .po file can be edited at will an copied around for translators t= o work on at their leisure - notebook or wherever without connectivity. The = system still clicks over. Using the web form translation proposed by Rom thi= s could also be done on line. Having gone a little way down this track I feel committed to this app= roach Luca. The web-form editing application Rom has suggested also looks t= o address our key concerns too. >A translation with the gettext approach is done without > simultaneously looking at the application. This is a problem although the .po file does tell you in which script= the string appears - so you can look at the english application. All approaches are a compromise and with the method we have chosen - = I think we can build a pretty good system. Phil ----- Original Message -----=20 =46rom: "ing. Luca Turlon Don=E0" <luc...@pd...> To: <web...@li...> Sent: Tuesday, September 07, 2004 2:34 AM Subject: [Web-erp-developers] Italian Translation > Hello Phil, > sorry for my silence, but I had some troubles that kept me away fro= m work. > I've seen that you started to work on the gettext solution. > > I've spent some time last week to study the approach of gettext, an= d my > opinion is that we the gettext solution is efficient but has the pr= oblem that > the translations can be done without any control, i.e. you simply c= hange a > text file. > > Given thsi I have started thinking how I could get the best from th= e gettext > approach and still keeping the db repository for the languages. > I made some experiment and sorted out the following. > > In my "language.php" file I've defined a function translate(), whic= h receives > a parameter which can be a string or an identifier. The function us= es the > $lang array, which contains all the translations needed, and which = is loaded > at the beginning. > > function translate($idOfLabelToBeTranslated) > { > global $lang; > if ($lang[$idOfLabelToBeTranslated]!=3Dnull) > return $lang[$idOfLabelToBeTranslated]; > else > return $idOfLabelToBeTranslated; > } > > As you can see translate simply returns the translated message, whi= ch has then > to be echoed (so it is very similar to gettext_noop...) > > I also enlarged the db column containing the label identifier: now = it's 100 > chars and can be enlarged again. > Since $idOfLabelToBeTranslated can be a string you can maintain cod= e > readability, as you can see in the following chunk of code from > SelectCustomer.php > > .... > if ($_POST['Search']=3D=3Dtranslate("Search Now")){ > > If ($_POST['Keywords'] AND $_POST['CustCode']) { > $msg=3D translate("Customer name keywords have been used in > preference to the customer code extract entered."); > $_POST["Keywords"] =3D strtoupper($_POST["Keywords"]); > } > If ($_POST['Keywords']=3D=3D"" AND $_POST['CustCode']=3D=3D"") { > $msg=3Dtranslate("At least one customer name keyword OR an > extract of a customer code must be entered for the search"); > ..... > > As you can understand, using this approach I am addressing your mai= n concern, > which is maintaining the code easy to read. > > But also I am addressing my 2 concerns: having the application work= ing at any > time, even during translation, and having a simple way to translate without > the danger of destroying the application. These issues are very imp= ortant to > me; since I believe that a translator have to be free to see exactl= y where a > certain sentence appears, in order to deeply understand the meaning= and give a > proper translation. A translation with the gettext approach is done without > simultaneously looking at the application. Using my approach you ca= n have one > browser on the application and the other one in the application cre= ated for > translation (i.e. some php pages that show the original and let you= write the > translation in a form) > > Now I am trying to solve the problem of parameters within a sentenc= e, and in > particular the fact that the position of parameters can change from= one > language to another (see the english-german example in the gettext > documentation).. > > Finally: Phil, if you don't like this approach, i am going to bend = down and > conform to you decision. The use of "translate" function is exactly= as > gettext_noop, so it'll be easy to adapt. But please first try to co= nsider the > db solution. > Luca > > > ------------------------------------------------------- > 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=3D5047&alloc_id=3D10808&op=3Dclick > _______________________________________________ > Web-erp-developers mailing list > Web...@li... > https://lists.sourceforge.net/lists/listinfo/web-erp-developers > |