Poll on improved format strings.
renoX
renosky at free.fr
Tue Mar 6 13:43:04 PST 2007
Derek Parnell a écrit :
> On Tue, 06 Mar 2007 09:53:48 -0500, renoX wrote:
>
>> Hello,
>>
>> I've made a templated format string templates
> ...
>
>> I'd like some inputs to see if there is a majority in favour of one style or the other..
>
> I will not be using this style of string formatting.
>
> I like to have the format strings as something that the user supplies at
> runtime so that they can control the output of messages to their users -
> especially when considering multiple language support.
I haven't thought about localisation, I'll have to take a look how it's
done currently in D to see if it's compatible.
> msg = Expand( getMsgLayout( msgno ), vars ...);
> Output (msg );
Well your scheme is simple to implement, but this isn't very readable..
The GNU localisation package use the text in the default language
(usually but not necessarily English) as a key to find the translations
in a localisation file.
Of course the problem is that it requires a parser to do this..
> where the msgno is a key to a runtime lookup for the layout of the message
> which is suitable for the langugage of the current user.
Note that both type of formating are useful, yours is for user
interface, mine is for trace logs (which are not localised usually).
They are not necessarily incompatible, I'll have to think about it.
renoX
More information about the Digitalmars-d
mailing list