PATCH: translation of menu-commands now possible in pkclist.c

Edmund GRIMLEY EVANS edmundo@rano.org
Thu, 27 Jan 2000 17:37:05 +0000


Sorry to reply to myself like this ...


> But I suppose we really ought to be thinking about wide characters and
> charset support, too; a Russian user might be using koi8-r or utf-8.
> The same problem effects lots of programs, not just gnupg ...
I've heard that soon gettext will automatically convert message strings to the charset of the user's current locale. A single non-ASCII character will become several octets when converted into UTF-8 (which will be the most widely used charset soon). So any code that wants to look at the third character of a translated string by just doing ans[2], say, will break horribly. Perhaps it would be useful to use a function that searches for an exact match or an unambiguous prefix in a set of commands. For example: int f(char *cmd, char *cmds, int *x); f("a", "a,cw;bx,by;cz", &x) = 0, x = 1 /* exact match in group 1 */ f("b", "a,cw;bx,by;cz", &x) = 1, x = 2 /* unambiguous prefix in group 2 */ f("c", "a,cw;bx,by;cz", &x) = 2, x = ? /* ambiguous prefix (1 or 3) */ f("d", "a,cw;bx,by;cz", &x) = 3, x = ? /* no match */ The cmds string would be translated, of course, and it shouldn't matter if charset conversion changes the number of bytes. If a system like this were in general use in GNU software, translators would soon learn. The question of whether to use the English commands as a canonical alternative is left to individual translator teams. Edmund