RPM Community Forums

Mailing List Message of <rpm-devel>

Another translation problem

From: Göran Uddeborg <goeran@uddeborg.se>
Date: Fri 18 Apr 2008 - 23:00:40 CEST
Message-ID: <18441.3064.308457.240234@freddi.uddeborg.se>
If you think about it, I'm sure you will realise this code from
rpmio/rpmgrep.c would be pretty hard to translate too in the general
case.  Even if the strings WERE marked for translation, which they
aren't:

/*************************************************
 * Construct printed ordinal.
 *
 * This turns a number into "1st", "3rd", etc display string.
 * @param n		the number
 * @return		the number's ordinal display string
 */
/*@observer@*/
static const char *
ordin(unsigned n)
	/*@*/
{
    static char buffer[16];
    buffer[0] = '\0';
    if (n > 0) {
	char *p = buffer;
	sprintf(p, " %u", n);
	while (*p != '\0') p++;
	switch (n%10) {
	case 1:		strcpy(p, "st"); break;
	case 2:		strcpy(p, "nd"); break;
	case 3:		strcpy(p, "rd"); break;
	default:	strcpy(p, "th"); break;
	}
    }
    return buffer;
}

It will actually fail for English too, in the case of 11st, 12nd and
13rd. :-)  Repeating once every 100.

I don't know of any clean way to do this translatable.  But the
function is only used in one place it seems:

   fprintf(stderr, _("%s command-line"), ordin(count))

Wouldn't it be ok to write

   fprintf(stderr, _("command-line %d"), count)

instead?
Received on Fri Apr 18 23:00:42 2008
Driven by Jeff Johnson and the RPM project team.
Hosted by OpenPKG and Ralf S. Engelschall.
Powered by FreeBSD and OpenPKG.