[Top][All Lists]

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

Re: [Gnumed-devel] i18n and icons

From: Karsten Hilbert
Subject: Re: [Gnumed-devel] i18n and icons
Date: Tue, 17 Sep 2002 06:40:57 +0200
User-agent: Mutt/

Maybe a bit more explanation is in order:

Consider The default icon is a capital letter
"A". While this is fine with many languages it may not be so
for, say, French where the customary label for allergies might
be "reaction allergique" (just a wild guess). Hence a capital
"R" would be in order.

Now, let's look at the icon data infrastructure that we have
in place. The "new style" is to have a dictionary __icons in
the plugin subclass. The keys are supposed to be strings which
can be applied to GetIconData() on plugin load according to
settings in a config repository or whatever. If an invalid key
is handed to GetIconData() it will fallback to a known good
key. The Right Way(TM) to handle l10n()ing of icons would be
to have nice unique strings as icon data keys (such as
"icon_capital_letter_A"). When falling back to the default
this key would need to be wrapped in _() to get automatic
l10n()ing. Same for hardcoded icon data keys elsewhere in the

Code example:

class gmGP_Allergies (gmPlugin.wxPatientPlugin):
    """Plugin to encapsulate the allergies window"""
        __icons = {
\x14&\xa8\x07\x05h\x82\x11\x11 \xfd\x11H\x821\x84[\x11\x82Hn\x85i\x8f\x80\

    def GetIconData(self, anIconID=None):
        if anIconID == None:
            return self.__icons[0]
            if self.__icons.has_key(anIconID):
                return self.__icons[anIconID]
            return self.__icons[_("""icon_letter_A""")]

Note how the default return in GetIconData is wrapped in _().
Translators then need to provide the key of a locally
appropriate icon. If they don't translate the key gettext will
automatically fall back to the hardcoded key.

Pretty nice, actually.

GPG key ID E4071346 @
E167 67FD A291 2BEA 73BD  4537 78B9 A9F9 E407 1346

reply via email to

[Prev in Thread] Current Thread [Next in Thread]