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

Re: New i18n'ed program in the menu package



On Tue, Jun 12, 2007 at 04:24:35PM +0200, Christian Perrier wrote:
> > > If you have read so far, please find the POT file in attachment.
> > 
> > All strings (except the last) end with "\\n". Should this be "\n"
> > instead?
> 
> 
> Let's ask Bill. I suspect that some reason needs this double escaping
> to be needed, though.

Yes, su-to-root is a shell script, so I am using gettext(1) and not
gettext(3).
Compare:
in C:
printf(gettext("Hello World\n"));
in POSIX sh:
printf "$(gettext "Hello World\n")"

In C \n is replaced by a new line inside the string by the compile
before gettext is called (the new line is reconverted to \n in the POT
file).

In POSIX sh, \n is not expanded inside strings:
$ echo "Hello World\n"
Hello World\n
Instead it is expanded by printf. This means that gettext see the \n
(which is escaped to \\n in the POT file).

Cheers,
-- 
Bill. <ballombe@debian.org>

Imagine a large red swirl here. 



Reply to: