Re: [REGRESSION] gvfs mount names not translated in UI



Il giorno gio, 24/01/2008 alle 15.07 +0100, Alexander Larsson ha
scritto:
> On Thu, 2008-01-24 at 14:38 +0100, Luca Ferretti wrote:
> > Il giorno gio, 24/01/2008 alle 12.16 +0100, Alexander Larsson ha
> > scritto: 
> > > On Wed, 2008-01-23 at 11:40 +0100, Luca Ferretti wrote:
> > > > Names/Labels for gvfs non local uris (trash:, computer:, burn:, smb:)
> > > > are not displayed using the translations available in gvfs package.
> > > > 
> > > > So, for example, for LANG=it the window title and the bottom left button
> > > > label for trash:// is "Trashcan", while it should be "Cestino" (the
> > > > Italian translation available in gvfs.po).
> > > > 
> > > > Maybe there are some missing _() somewhere...
> > > 
> > > Hmm, i think we might be missing a setlocale() in daemon-main.c...
> > > Can you try adding that in daemon_init and restart the trash daemon?
> > 
> > The attached patch make window titles translated. Commit?
> 
> No, that is called multiple times in some cases. Instead put it in
> daemon_init() in daemon/daemon-main.c. Oh, and also in main() in
> daemon/main.c.

Whoops, sorry. Attached new version, plus some l10n fixes/enhancements.

> > > > PS it seems instead that desktop icon caption for trash is translated:
> > > > this is strage, 'cause captions for smb:// mounts aren't (while, as
> > > > above, available in Italian translation). It seems that nautilus is
> > > > still providing translations for it[1]. Shouldn't instead always use the
> > > > label from gvfs?
> > > 
> > > Well, thats kinda different, the trash desktop icon is sort of a links
> > > to the target rather than the target itself. Whereas the mounts are
> > > taken from gvfs. I don't think its a huge issue.
> > > 
> > OK for me, but if so, gvfs and nautilus should both the same label:
> > Trash or Trashcan
> 
> Yep! Care to fix?
> 
> > Similar for burn:// -> "CD Burner" in gvfs vs "CD/DVD Creator" in
> > nautilus(-cd-burner)
> 
> Yeah. Just sloppiness from my side.

I'll do it. The best approach IMHO is use "Trash" and "CD/DVD Creator"
in gvfs too, 'cause other modules are yet translated from a long time...
Index: daemon/daemon-main.c
===================================================================
--- daemon/daemon-main.c	(revisione 1179)
+++ daemon/daemon-main.c	(copia locale)
@@ -44,6 +44,12 @@
 {
   DBusConnection *connection;
   DBusError derror;
+
+  setlocale (LC_ALL, "");
+
+  bindtextdomain (GETTEXT_PACKAGE, GVFS_LOCALEDIR);
+  bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
+  textdomain (GETTEXT_PACKAGE);
   
   dbus_threads_init_default ();
   g_thread_init (NULL);
@@ -53,7 +59,8 @@
   connection = dbus_bus_get (DBUS_BUS_SESSION, &derror);
   if (connection == NULL)
     {
-      g_printerr (_("Error connecting to D-Bus: %s\n"), derror.message);
+      g_printerr (_("Error connecting to D-Bus: %s"), derror.message);
+      g_printerr ("\n");
       dbus_error_free (&derror);
       exit (1);
     }
@@ -71,7 +78,8 @@
   if (spawner_id == NULL || spawner_path == NULL)
     {
       if (!succeeded)
-	g_print ("Error: %s\n", error_message);
+      g_printerr (_("Error: %s"), error_message);
+      g_printerr ("_\n");
       return;
     }
   
@@ -103,7 +111,8 @@
     {
       if (argc < 4)
 	{
-	  g_printerr ("Usage: %s --spawner dbus-id object_path\n", argv[0]);
+	  g_printerr (_("Usage: %s --spawner dbus-id object_path"), argv[0]);
+          g_printerr ("\n");
 	  exit (1);
 	}
 
@@ -126,7 +135,8 @@
 	  p = strchr (argv[i], '=');
 	  if (p == NULL || p[1] == 0 || p == argv[i])
 	    {
-	      g_printerr ("Usage: %s key=value key=value ...\n", argv[0]);
+ 	      g_printerr (_("Usage: %s key=value key=value ..."), argv[0]);
+              g_printerr ("\n");
 	      exit (1);
 	    }
 	  
@@ -141,8 +151,10 @@
 
       if (!found_type)
 	{
-	  g_printerr ("No mount type specified\n");
-	  g_printerr ("Usage: %s key=value key=value ...\n", argv[0]);
+	  g_printerr (_("No mount type specified"));
+          g_printerr ("\n");
+	  g_printerr (_("Usage: %s key=value key=value ..."), argv[0]);
+          g_printerr ("\n");
 	  exit (1);
 	}
     }
@@ -174,7 +186,8 @@
   connection = dbus_bus_get (DBUS_BUS_SESSION, &derror);
   if (connection == NULL)
     {
-      g_printerr (_("Error connecting dbus: %s\n"), derror.message);
+      g_printerr (_("Error connecting to D-Bus: %s"), derror.message);
+      g_printerr ("\n");
       dbus_error_free (&derror);
       exit (1);
     }
Index: daemon/main.c
===================================================================
--- daemon/main.c	(revisione 1179)
+++ daemon/main.c	(copia locale)
@@ -1,3 +1,5 @@
+/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */
+
 /* GIO - GLib Input, Output and Streaming Library
  * 
  * Copyright (C) 2006-2007 Red Hat, Inc.
@@ -46,12 +48,18 @@
     { NULL }
   };
 
+  setlocale (LC_ALL, "");
+
+  bindtextdomain (GETTEXT_PACKAGE, GVFS_LOCALEDIR);
+  bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
+  textdomain (GETTEXT_PACKAGE);
+  
   g_thread_init (NULL);
   
   g_set_application_name (_("GVFS Daemon"));
   context = g_option_context_new ("");
 
-  g_option_context_set_summary (context, "Main daemon for GVFS");
+  g_option_context_set_summary (context, _("Main daemon for GVFS"));
   
   g_option_context_add_main_entries (context, options, GETTEXT_PACKAGE);
 
@@ -60,7 +68,13 @@
   error = NULL;
   if (!g_option_context_parse (context, &argc, &argv, &error))
     {
-      g_print ("%s, use --help for usage\n", error->message);
+      /* Translators: the first %s is the application name, */
+      /* the second %s is the error message                 */
+      g_printerr (_("%s: %s"), g_get_application_name(), error->message);
+      g_printerr ("\n");
+      g_printerr (_("Try \"%s --help\" for more information."),
+                  g_get_prgname ());
+      g_printerr ("\n");
       g_error_free (error);
       return 1;
     }
Index: daemon/Makefile.am
===================================================================
--- daemon/Makefile.am	(revisione 1179)
+++ daemon/Makefile.am	(copia locale)
@@ -11,6 +11,7 @@
 	-DDBUS_API_SUBJECT_TO_CHANGE		\
 	-DLIBEXEC_DIR=\"$(libexecdir)/\" 	\
 	-DMOUNTABLE_DIR=\"$(mountdir)/\" 	\
+	-DGVFS_LOCALEDIR=\""$(localedir)"\"     \
 	-DG_DISABLE_DEPRECATED
 
 noinst_LTLIBRARIES=libdaemon.la


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