Re: gnome-background-properties i18n support
- From: Thomas Wood <thos gnome org>
- To: Danilo Šegan <danilo gnome org>
- Cc: gnome-i18n gnome org
- Subject: Re: gnome-background-properties i18n support
- Date: Sat, 04 Dec 2004 01:12:14 +0000
On Fri, 2004-12-03 at 23:32 +0100, Danilo Åegan wrote:
> Hi Thomas,
>
> Today at 19:27, Thomas Wood wrote:
>
> > Index: capplets/background/gnome-wp-xml.c
> > ===================================================================
> > RCS file: /cvs/gnome/gnome-control-center/capplets/background/gnome-wp-xml.c,v
> > retrieving revision 1.8
> > diff -u -p -r1.8 gnome-wp-xml.c
> > --- capplets/background/gnome-wp-xml.c 22 Sep 2004 15:07:01 -0000 1.8
> > +++ capplets/background/gnome-wp-xml.c 3 Dec 2004 18:23:59 -0000
> > @@ -94,8 +94,13 @@ static void gnome_wp_xml_load_xml (Gnome
> > const gchar * filename) {
> > xmlDoc * wplist;
> > xmlNode * root, * list, * wpa;
> > + xmlChar * nodelang;
> > + G_CONST_RETURN gchar* G_CONST_RETURN * syslangs;
> > GdkColor color1, color2;
> > GnomeWPItem * item;
> > + gint i;
> > +
> > + syslangs = g_get_language_names();
> >
> > wplist = xmlParseFile (filename);
> >
> > @@ -120,7 +125,22 @@ static void gnome_wp_xml_load_xml (Gnome
> > }
> > } else if (!strcmp (wpa->name, "name")) {
> > if (wpa->last != NULL) {
> > - wp->name = g_strdup (g_strstrip (wpa->last->content));
> > + nodelang = xmlNodeGetLang(wpa->last);
> > +
> > +
> > + if (wp->name == NULL && nodelang == NULL) {
> > + wp->name = g_strdup (g_strstrip (wpa->last->content));
>
> (lets say this value is "originalname")
>
> > + } else {
> > + for (i = 0; syslangs[i] != NULL; i++)
> > + {
> > + if (!strcmp(syslangs[i], nodelang))
> > + {
> > + wp->name = g_strdup (g_strstrip (wpa->last->content));
> > + }
> > + }
> > + }
>
> I'd expect here to default to "originalname" if wp->name is still not
> set (i.e. NULL).
>
> > +
> > + xmlFree(nodelang);
> > }
> > } else if (!strcmp (wpa->name, "imguri")) {
> > if (wpa->last != NULL) {
>
> I don't have the entire context, so I may have missed something, but
> if translation is not available, this code should return original,
> untranslated string instead.
The default is set when the untranslated string is parsed (nodeland ==
NULL) and the name (wp->name) is still NULL:
+ if (wp->name == NULL && nodelang == NULL) {
If the wp->name is not NULL, then obviously a auitable translation has
been found and wp->name shouldn't be set to anything else.
The only case not handled here is when there is no suitable translation
found, and no untranslated name. Not sure what to do here though!
I know of one bug with this code, and that is that if the user has a
list of languages in order of preference, the code will use the language
in their list that appears last in the translations. This would be fixed
by adding a flag to wp to remember the preference of the language
assigned so far. However, dobey said that since GDM will only ever set
one language this wasn't so much of an issue. I have yet to verify this
however.
-Thomas
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]