phobos / tango / ares

Bill Baxter dnewsgroup at billbaxter.com
Sat Feb 10 10:30:04 PST 2007


Frits van Bommel wrote:
> Bill Baxter wrote:
>> Is there any reason not to make the format item's index also optional? 
>> So that
>>    Formatter("{} {} {}", a, b, c);
>> can be used?  I mean making it more like %s?
>>
>> The meaning would just be "use the index (1+ the last one that 
>> appeared)" or 0 if it's the first to appear.
>>
>> And then if you go there, it might be nice to have a way to say "same 
>> as the last item" or "last item +/- some index".  Maybe use +/- 
>> numbers.  So
>>    Formatter("{1} {+0} {-1}",a,b);
>> would be equal to
>>    Formatter("{1} {1} {0}",a,b);
>> I can't really think of when I'd use that though.  The {} I'd use for 
>> sure though.
>>
>> Anyway, the positional references are great, and really a must have 
>> for any serious I18N usage, but in the original language the app is 
>> written in, things tend to appear in the order of the arguments.
> 
> An argument against that would be: Don't you think it'd be easier on the 
> translators if they could just pick the argument number out of the 
> untranslated string without having to keep a running count of which 
> argument they're at?

Good point.  But strings for translation are usually extracted by a text 
processing tool of some sort (like poedit).  So it would be easy for 
that tool to also fill in the numbers while extracting.

--bb


More information about the Digitalmars-d-learn mailing list