[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: CHanging the order of parameters, is that possible?
- From: Marc Balmer <marc@...>
- Date: Sat, 5 Jan 2013 18:37:23 +0100
Am 05.01.2013 um 18:26 schrieb steve donovan <steve.j.donovan@gmail.com>:
> On Sat, Jan 5, 2013 at 6:33 PM, Alexander Gladysh <agladysh@gmail.com> wrote:
>> But IMO in i18n it is often better to use named placeholders, not
>> positional ones.
>
> Yes, much more readable. I tend to get mixed up with more than two %s
> formats in a string
>
> Microlight's expand function does this - it's genuinely a three-liner
It was an experiment only. When I do
print(_('%s - %d', 'foo', 42))
I wanted this to use a different format string, with optional different ordering. Having a table entry like
['%s - %d'] = { '%d - %s', 2, 1}
So I am indicating a replacement format string and a new order of parameters.
And that works. Whether it is a good solution is a different question (it's not used anywhere right now)
Thanks for all hints and comments, btw.