Re: Construction of sentences with embedded widgets



Op zaterdag 04-09-2010 om 22:54 uur [tijdzone +0100], schreef Matthew
Paul Thomas:
> An alternative method, which would be easier for translators but require
> a little more coding, would be to use a single string
> 
>     _("Forget this password when idle for %s minutes")
> 
> and then to insert the widget in the right place by splitting the
> translated string on the "%s".

...which is what I suggested before, but this isn't as easy as it seems
in more complex cases with more than a single embedded widget, because
of possible reordering of the placeholders (with the %2$s syntax for
sprintf()).

Fwiw, I have used this approach successfully with HTML forms. Since
widgets in HTML are encoded as strings, sprintf() can be used in all its
glory (though special care must be taken to properly escape all values).

    — Wouter

Attachment: signature.asc
Description: This is a digitally signed message part



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]