Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 31 Mar 2009 02:31:59 -0400
From:      David Schultz <das@FreeBSD.ORG>
To:        Poul-Henning Kamp <phk@phk.freebsd.dk>
Cc:        Daniel Eischen <deischen@FreeBSD.ORG>, FreeBSD Arch <arch@FreeBSD.ORG>, Tim Kientzle <kientzle@FreeBSD.ORG>, Marcel Moolenaar <xcllnt@mac.com>
Subject:   Re: On errno
Message-ID:  <20090331063159.GA9265@zim.MIT.EDU>
In-Reply-To: <95823.1238476941@critter.freebsd.dk>
References:  <49D1492C.5050101@freebsd.org> <95823.1238476941@critter.freebsd.dk>

next in thread | previous in thread | raw e-mail | index | archive | help
On Tue, Mar 31, 2009, Poul-Henning Kamp wrote:
> In message <49D1492C.5050101@freebsd.org>, Tim Kientzle writes:
> 
> >> The probelm with an integer is that you cannot give details
> >> like:
> >> 	"partition 3 overlaps bootcode"
> >> without precreating the N^2 possible messages of that kind.
> >
> >The standard solution if you need variable parameters,
> >of course, is to pass the parameters back:
> >    int code: EPARTITIONOVERLAPSBOOTCODE
> >    char *default_text: "partition %1d overlaps bootcode"
> >    arg1: 3
> 
> And the "standard" solution is stupid and useless, because more
> often than not, some language, typically french, will want the
> arguments in the opposite order...

You could get the extensibility you're looking for without
annoying the i18n folks by making the strings conform to a simple
machine-parsable grammar. For instance, the above might be:
    "geom:part:overlaps bootcode(3)"
A user-level library function could parse this, look up a natural
language translation in a locale-specific database, and fall back
on a generic format if no translation is available.



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20090331063159.GA9265>