From: Jens A. T. <je...@pe...> - 2005-05-20 08:58:55
|
This is even more better then my suggestion. Regards, Jens Quoting Beckett Madden-Woods <be...@be...>: > On Fri, May 20, 2005 at 01:48:52AM +0200, Georg Rehfeld wrote: > >> the gettext mechanism is going to be changed slightly in some days: >> [...] >> Rationale: not sorting to some extent preserves the context of messages, >> whereas sorting disturbes all context. Consider a real case of strings >> to localize in the installer: >> >> <?php print _('This installer session will') >> . ($templateData['configType'] == 'newsite' >> ? _(' configure a new site at ') >> : _(' reconfigure ')) >> . $templateData['galleryId'] ?> > > The de-sorting is definitely a step in the right direction. :) > > Your example also illustrates an issue I've seen with a small handful > of strings so far. I'd be interested in hearing other peoples' > opinions. A far more flexible implementation of that example might be: > >> print ($configType == 'newsite') >> ? translate(array('text' => 'This installer will configure a >> new site at %s', >> 'arg1' => $galleryId)) >> : translate(array('text' => 'This installer will reconfigure %s', >> 'arg1' => $galleryId)); > > Sure, this form is 'less efficient' and requires more typing, but the > strings for translation become significantly less ambiguous. > > I'm not saying we'd need to rush into changes, but I think going > forward it would be well worth restructuring some of these '%s' string > constructions in this manner. It reduces cases where, for example, the > word 'reconfigure' might have different translations depending on > context. Building up sentences in the manner above just doesn't work > well when it needs to be translated. > > Another real-world example of issues I've seen in the Irish > translation would be: > >> "Download this %s" --> "Ioslodail an %s seo" >> "photo" --> "griangraf" >> "movie" --> "scannan" > > Here, we assume that the word "photo" has the same construction > whether it's on its own, or part of "Download this photo". But this > just isn't the case, at least in Irish (where simply splicing in > "griangraf" in the %s location would be grammatically incorrect), but > I imagine there are occasional similar problems in other languages. > >> {g->text text="Download this %s" arg1=`$layout.sourceImage.itemTypeName.1`} > > might become > >> {if $layout.sourceImage.itemTypeName.1 == 'photo'} >> {g->text text="Download this photo"} >> {elseif $layout.sourceImage.itemTypeName.1 == 'movie'} >> {g->text text="Download this movie"} >> {else} {* default fallback just in case *} >> {g->text text="Download this %s" >> arg1=`$layout.sourceImage.itemTypeName.1`} >> {/if} > > Yes we now have three strings to translate where we previously had > one, but there's much less risk for ambiguity or compromise. Plus, the > percentage of '%s'-like strings is really pretty tiny in the grand > scheme of things, so I think identifying these "problem" strings and > reworking them could be worthwhile. > > Thoughts? Flames? > > > -Beckett > > > ------------------------------------------------------- > This SF.Net email is sponsored by Oracle Space Sweepstakes > Want to be the first software developer in space? > Enter now for the Oracle Space Sweepstakes! > http://ads.osdn.com/?ad_id=7412&alloc_id=16344&op=click > __[ g a l l e r y - d e v e l ]_________________________ > > [ list info/archive --> http://gallery.sf.net/lists.php ] > [ gallery info/FAQ/download --> http://gallery.sf.net ] > -- _________________________ Ich sag mal .... Charisma |