Multi-line text output via printf() et al.

Steve O'Hara-Smith steve at sohara.org
Thu May 14 21:13:25 UTC 2020


On Thu, 14 May 2020 15:44:18 -0500
Tim Daneliuk <tundra at tundraware.com> wrote:

> However you decide to do it, can we _please_ stop embedding literal
> strings in printf(), python print(), and so forth?  Strings should be
> pulled out as variables into one centrally maintained location in the
> code.  Why?

	That's a good start.

> Because, someday, you may actually want to have your code run
> with output in something other than your native language.  Because
> strings are often reused in several places in the code.  Because you may
> someday actually want to use unicode characters.

	Right, but then you'll probably want to compose strings with
embedded variable content and discover that the order is not fixed across
languages and so you need a more sophisticated interpolation markup than
printf. Then you'll bump into the nightmare that is plural and singular
forms, sometimes with multiple variants of plural. If you display lists you
will find all the fun of sorting (just look at the French rules on sorting
by accent).

	Do not get me started on truncation!

-- 
Steve O'Hara-Smith <steve at sohara.org>


More information about the freebsd-questions mailing list