Re: gnome-background-properties i18n support



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.

Cheers,
Danilo


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