Re: Introducing separate strings for quick bar items



Egmont Koblinger wrote:
On Tue, Jul 12, 2005 at 08:18:20PM +0200, Roland Illig wrote:
What about "ButtonBar:Quit" or "ButtonBar|Quit"? This scheme would also be extensible to other special cases, like menu strings, dialog boxes, etc.

Nice idea. If it gets widely used in mc, we could even introduce wrapper
functions around _() that return a pointer skipping up to (including) the
first separator character so that we don't have to type "strchr(s, '|') + 1"
over and over again.

This would result in a function like this:

const char *translate_ui (const char *s)
{
    const char *result = _(s);
    if (result == s) {
        result = strchr(s, '|');
        return (result != NULL) ? result + 1 : s;
    }
    return result;
}

I'm not sure at this moment (it's too late in the evening) whether such
things can be done around N_(). Doesn't seem to be trivial.

It is not needed. N_ is just an indicator for gettext(1) for considering which strings should be translated. Finally, each string declared using N_ must be passed through gettext() anyway.

Roland



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