Re: gnome-background-properties i18n support



On Fri, 2004-12-03 at 16:48 +0100, Danilo Åegan wrote: 
> Hi Thomas,
> 
> Today at 14:24, Thomas Wood wrote:
> 
> > I recently made a patch for gnome-background-properties to allow it to
> > correctly load i18n data from XML files, and use the current locale.
> >
> > This all works fine, with the exception that when data is loaded from
> > the system XML files (which describes all the pre-installed
> > backgrounds), only the current locale is copied to the user's home
> > directory. This isn't a problem unless you change locale sometime after
> > you've loaded the system XML file. Implementing copying all the locale
> > information to the users home directory would require a lot more work to
> > gnome-background-properties. Also, as pointed out by dobey, the name
> > data could possibly be user edited, so should it really be changed by
> > the system when the user changes locale?
> 
> Nope, once installed translations should stay as they are.  This is not
> perfect, but we can't make it any better without complicating too much
> (i.e. in some cases replace those translations, in others don't).

So you think my proposed patch is acceptable?

I've attached the patch this time so people can have a look and try it
out. Comments and suggestions very much welcome.

> 
> > Otherwise, there may still be no i18n support in gnome-background-
> > properties when 2.10 is released, which would mean the i18n work on the
> > gnome-backgrounds module would be completely wasted, as it would have to
> > be removed from the final build.
> 
> I'm not sure what you're saying here?  What work would be wasted, and
> why?  Are you talking about patches (i.e. work on code), or
> translations?
> 
> If you're talking about translations, that shouldn't bother you: it's
> up to translators to choose what to translate, and if
> gnome-background-properties includes support for making use of those
> translations (even though if they aren't installed by default in
> Gnome), that's all right (we can just ask people to install
> gnome-backgrounds separately).

Well it just seemed a bit of a wasted effort on the translators part, if
the gnome-backgrounds module was translated, but then the translations
had to be disabled in the final release because gnome-background-
properties can't work with them.

-Thomas
? depcomp
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));
+            } else {
+	       for (i = 0; syslangs[i] != NULL; i++)
+	       {
+	         if (!strcmp(syslangs[i], nodelang))
+	         {
+	           wp->name = g_strdup (g_strstrip (wpa->last->content));
+	         }
+	       }
+	    }
+
+            xmlFree(nodelang);
 	  }
 	} else if (!strcmp (wpa->name, "imguri")) {
 	  if (wpa->last != NULL) {


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