[Solar-talk] locale strings + replacements
Travis Swicegood
development at domain51.com
Thu Nov 16 18:07:58 PST 2006
Rodrigo Moraes wrote:
> I only think it should use the (ugly) syntax that allows unordered
> placeholders inside the string., e.g. 'This value should be %1$d-%2$d
> characters long'. For some languages this is good and, although this
> is a bad example to defend this, it allows you to re-create the phrase
> using placeholders in any order - they will be correctly replaced.
Just from a speed perspective, sprintf() is horribly slow in PHP. I'm
not sure how they implemented it in the core, but for some reason you
can do most of the replacing yourself with parsed code faster (assuming
you know what's going where).
I would think it would be worth some benchmarking before making
Solar::locale() do everything through sprintf().
As a side note, I hate that PHP did that to sprintf - it makes the code
so much more readable and makes PHP feel all grown up :-)
-T
More information about the solar-talk
mailing list