DConf i18n (was: Re: A draft for a standard for desktop configuration)
Christian Neumair
chris at gnome-de.org
Thu Sep 15 02:52:17 EEST 2005
Am Montag, den 12.09.2005, 21:41 +0200 schrieb Philip Van Hoof:
> On Mon, 2005-09-12 at 21:06 +0200, Christian Neumair wrote:
> > I would like to suggest to learn of GConf's memory consumption issues:
> > Do not translate the key desciptings inline, i.e. inside the XML files
> > with simple lang attributes. It will be a memory hog for translations
> > into a few dozen languages, and will significantly slow down parsing.
>
> > Either add org_foo_bar.langcode.schemas files, or optionally add support
> > for <gettextdomain> and a <gettextdirectory> nodes specifying a gettext
> > catalog to look up translations.
>
> I like the idea and I understand the problem. If you can provide me with
> samples and/or adjust the proposal that would be great.
>
> > The former approach has the disadvantage that you may potentially have
> > node mismatches, so I'd prefer the latter.
>
> ok
I'm not covering setlocale in detail here, which is a basic i18n
prerequisite. In short, in main (), you need
setlocale(LC_ALL, "" );
In the memory representation of the schema, which would be:
typedef struct {
...
char *gettext_domain;
char *gettext_directory;
} DConfSchema;
you should - upon parsing <gettext-domain/> and <gettext-directory/> set
the fields to its corresponding values. I'm not sure whether a DTD can
enforce to have a particular node ID only present once for a paticular
parent node - for these two tags this would be appropriate. After
parsing,
bindtextdomain (schema->gettext_domain, schema->gettext_directory);
bind_textdomain_codeset (schema->gettext_domain, "UTF-8");
would be called.
When parsing a DConf key,
typedef struct {
...
char *description;
} DConfKey;
gets filled.
then, in the
const char *dconf_get_description (const char *key,
const char *locale);
getter you would then lookup the schema associated with key, and
return dgettext (key->scheme->gettext_domain, key->description);
That's it :).
--
Christian Neumair <chris at gnome-de.org>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part
Url : http://lists.freedesktop.org/archives/xdg/attachments/20050915/abbc4a95/attachment.pgp
More information about the xdg
mailing list