From: Jesse P. <je...@st...> - 2004-09-05 17:00:10
|
I've done some testing and digging today and it would seem that there is no way to do the translation w/ variables I was talking about without either employing a wrapper class of sorts or using printf variable positioning syntax that could be very confusing. I did not test this, but it likely would be an easy class to drop in... http://phptal.sourceforge.net/bagpack/GetText/class.GetText.html It look like it is basically a wrapper to gettext... that would still require translators to be able to move around variables and a little extra typing on our part... I think having vars written in the ${varname} syntax would make it easier for a non-programmer, though. I'm just thinking about how bad the translations may get chopping up sentences... jesse Daintrees wrote: >Well I didn't actually test that bit. > >We are actually using xgettext to extract all the strings from the files >that have strings inside the gettext function calls. xgettext wont extract >strings that include variables inside them and with flagging enthusisasm for >multi-language - I don't want to have to take strings manually to the >messages.po I want this created automatically using xgettext. > >There is a chance that your suggestion might work Jesse, its just that if it >does, it would involve a LOT more work and introduce more possible causes of >problems. Translators would have to know to keep the name of the variable >exactly the same and might not. > >Phil > > >----- Original Message ----- >From: "skaill" <sk...@ro...> >To: <web...@li...> >Sent: Sunday, September 05, 2004 6:00 PM >Subject: Re: [Web-erp-developers] file imports for serial items > > > > >>Ah. And since we don't want the variables hard code translated then it >>wouldn't do to translate the entire string. >> >>Steve >> >>----- Original Message ----- >>From: "Jesse Peterson" <je...@st...> >>To: <web...@li...> >>Sent: Sunday, September 05, 2004 1:45 AM >>Subject: Re: [Web-erp-developers] file imports for serial items >> >> >> >> >>>php is interpreted in it's execution, but these functions occur within >>>the execution, so it was a crap shoot as to which way gettext is >>>written. Phil has repsonded to say he tested and that gettext in fact >>>does parse & interpret the string before matching it for translation. >>> >>>jesse >>> >>> >>>skaill wrote: >>> >>> >>> >>>>I could be way off track but I'm thinking that PHP is interpreted, not >>>>compiled. Therefore, it does not know what to do with a string until >>>> >>>> >it > > >>is >> >> >>>>executing the function/command upon that string. For instance, the >>>> >>>> >>function >> >> >>>>could be to simply copy the string. This means you would want to copy >>>> >>>> >>"Hi >> >> >>>>$UserID" as "Hi $UserID", not "Hi Tom". If so, it would be the echo >>>> >>>> >that > > >>>>indicates what to do with the string. Since the echo is executed after >>>> >>>> >>the >> >> >>>>gettext then the string passed to gettext would contain the variable >>>> >>>> >name > > >>>>and not the contents of the variable. >>>> >>>>Steve >>>> >>>>----- Original Message ----- >>>>From: "Jesse Peterson" <je...@st...> >>>>To: <web...@li...> >>>>Sent: Sunday, September 05, 2004 12:57 AM >>>>Subject: Re: [Web-erp-developers] file imports for serial items >>>> >>>> >>>> >>>> >>>> >>>> >>>>>No, my thought was the translator would be told that things starting >>>>>with $ were a variable, usually a number, (and I suppose a possible >>>>>explanation of that) so they could just move them around in the >>>>>translated string. I suppose a way to think of what I'm taking about >>>>> >>>>> >is > > >>>>>an array keyed by a full string, including variable, that had values >>>>> >>>>> >of > > >>>>>the translated string that should be used. >>>>>Alas, as you said, it does not work like that with gettext - I >>>>> >>>>> >supposed > > >>>>>the 'smart' it is depends on how you might wish it to work ;) And I >>>>>wasn't just suggesting it work the shorter code, it was really for the >>>>>more accurate translation to help make things look that much better in >>>>>the eyes of others. Still, being able to attract the user base of most >>>>>any language is a very good thing, so this project you guys have >>>>>undertaken is quite admirable. Glad I can help. >>>>> >>>>>jesse >>>>> >>>>> >>>>>Phil Daintree wrote: >>>>> >>>>> >>>>> >>>>> >>>>> >>>>>>Thinking a little more - we dont really want variable names >>>>>> >>>>>> >translated > > >>>>>>anyway - the scripts will always be in English and using the >>>>>> >>>>>> >variables > > >>>>>>would be tough if they were actually translated to something else. >>>>>> >>>>>>gettext works on a bunch on languages as well as PHP but it is really >>>>>>only working purely with strings. >>>>>> >>>>>>Phil >>>>>> >>>>>>On Sun, 2004-09-05 at 16:19, Jesse Peterson wrote: >>>>>> >>>>>> >>>>>> >>>>>> >>>>>> >>>>>> >>>>>>>>>That would be a great help re internationalization. >>>>>>>>> >>>>>>>>> >>>>>>>>> >>>>>>>>> >>>>>>>>> >>>>>>>>> >>>>>>>One question on this... I saw that you asked that this be done: >>>>>>> >>>>>>> >>>>>>> >>>>>>> >>>>>>> >>>>>>> >>>>>>> >>>>>>>>>echo "<P>A long string full of $NumberOfCharacters characters"; >>>>>>>>>would need to be re-written as: >>>>>>>>>echo '<P>' . _('A long string full of') . ' ' . >>>>>>>>> >>>>>>>>> >$NumberOfCharacters > > >>. >> >> >>>>>>>>> >>>>>>>>> >>>>' >>>> >>>> >>>> >>>> >>>>>>>>>' . _('characters'); >>>>>>>>> >>>>>>>>> >>>>>>>>> >>>>>>>>> >>>>>>>>> >>>>>>>>> >>>>>>>It makes perfect senses and is easy to follow. I also do not know >>>>>>> >>>>>>> >>>>>>> >>>>>>> >>>>gettext much at all. The root of what I am wondering is if php >>>> >>>> >evaluates > > >>a >> >> >>>>variable in a "num = $TheNum" style string before gettext translates it >>>> >>>> >>or >> >> >>>>not. If not, it would probably make things a lot easier on potential >>>>translators to work with: >>>> >>>> >>>> >>>> >>>>>>> _("A long string full of $NumberOfCharacters characters"); >>>>>>>instead of: >>>>>>> _('A long string full of') . ' ' . $NumberOfCharacters . ' ' . >>>>>>> >>>>>>> >>>>>>> >>>>>>> >>>>_('characters'); >>>> >>>> >>>> >>>> >>>>>>>Luckily our code keeper is committed to readable code, so the >>>>>>> >>>>>>> >variable > > >>>>>>> >>>>>>> >>>>name should generally describe what it is. That would give a translator >>>> >>>> >2 > > >>>>things - more full context to what they are translating and one less >>>>translation to do. I also know languages just enough to know that >>>> >>>> >piecing > > >>>>together english translations in the manner underway does not >>>> >>>> >necessarily > > >>>>produce coherent output. The more a message can be presented with >>>> >>>> >>context, >> >> >>>>the better the translation will be. >>>> >>>> >>>> >>>> >>>>>>>Just a thought - not sure how feasible it is... >>>>>>> >>>>>>> >>>>>>>jesse >>>>>>> >>>>>>> >>>>>>> >>>>>>>------------------------------------------------------- >>>>>>>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 >>> >>> >> >>------------------------------------------------------- >>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 > > |