]> git.street.me.uk Git - andy/viking.git/commitdiff
I18N improvement
authorGuilhem Bonnefille <guilhem.bonnefille@gmail.com>
Sat, 16 Feb 2008 14:15:40 +0000 (14:15 +0000)
committerGuilhem Bonnefille <guilhem.bonnefille@gmail.com>
Sat, 16 Feb 2008 14:15:40 +0000 (14:15 +0000)
src/datasource_gps.c
src/expedia.c
src/google.c
src/vikgpslayer.c
src/vikmapslayer.c

index 66eb689ce37d8e41d6ee418247af72b46405a5f1..e9cefca244eb3af4b10b2879012ef8636b86c9c6 100644 (file)
@@ -145,7 +145,12 @@ static void set_total_count(gint cnt, acq_dialog_widgets_t *w)
   gdk_threads_enter();
   if (w->ok) {
     gps_user_data_t *gps_data = (gps_user_data_t *)w->user_data;
-    s = g_strdup_printf(_("Downloading %d %s..."), cnt, (gps_data->progress_label == gps_data->wp_label) ? _("waypoints") : _("trackpoints"));
+    const gchar *tmp_str;
+    if (gps_data->progress_label == gps_data->wp_label)
+      tmp_str = ngettext("Downloading %d waypoint...", "Downloading %d waypoints...", cnt);
+    else
+      tmp_str = ngettext("Downloading %d trackpoint...", "Downloading %d trackpoints...", cnt);
+    s = g_strdup_printf(tmp_str, cnt);
     gtk_label_set_text ( GTK_LABEL(gps_data->progress_label), s );
     gtk_widget_show ( gps_data->progress_label );
     gps_data->total_count = cnt;
index e7a4169994c309f97f21dd40e868802cb9281f48..9ae16dce820286d9732c994fe20fc4216c3cec99 100644 (file)
@@ -184,6 +184,7 @@ static int expedia_download ( MapCoord *src, const gchar *dest_fn )
 
   if ((res = a_http_download_get_url ( EXPEDIA_SITE, uri, dest_fn, &expedia_options )) == 0)   /* All OK */
        expedia_snip ( dest_fn );
+  g_free(uri);
   return(res);
 }
 
index e938520e7021be1967b5c5ee920574eaf1144d3a..203e67d2844870374094594547c76933f88cdc4e 100644 (file)
@@ -194,6 +194,7 @@ failed:
 
   fclose(tmp_file);
   g_free(tmpname);
+  g_free (uri);
   return (vers[google_type]);
 }
 
index 55ab911ad83d024f26acf4b31135ff6bc3dc577d..9d78b3728f405f8a626f95a5a5e4b3c06762cc26 100644 (file)
@@ -667,9 +667,23 @@ static void set_total_count(gint cnt, GpsSession *sess)
   gdk_threads_enter();
   g_mutex_lock(sess->mutex);
   if (sess->ok) {
-    g_sprintf(s, "%s %d %s...",
-        (sess->direction == GPS_DOWN) ? _("Downloading") : _("Uploading"), cnt,
-        (sess->progress_label == sess->wp_label) ? _("waypoints") : _("trackpoints"));
+    const gchar *tmp_str;
+    if (sess->direction == GPS_DOWN)
+    {
+      if (sess->progress_label == sess->wp_label)
+        tmp_str = ngettext("Downloading %d waypoint", "Downloading %d waypoints", cnt);
+      else
+        tmp_str = ngettext("Downloading %d trackpoint", "Downloading %d trackpoints", cnt);
+    }
+    else 
+    {
+      if (sess->progress_label == sess->wp_label)
+        tmp_str = ngettext("Uploading %d waypoint", "Uploading %d waypoints", cnt);
+      else
+        tmp_str = ngettext("Uploading %d trackpoint", "Uploading %d trackpoints", cnt);
+    }
+
+    g_snprintf(s, 128, tmp_str, cnt);
     gtk_label_set_text ( GTK_LABEL(sess->progress_label), s );
     gtk_widget_show ( sess->progress_label );
     sess->total_count = cnt;
@@ -681,15 +695,41 @@ static void set_total_count(gint cnt, GpsSession *sess)
 static void set_current_count(gint cnt, GpsSession *sess)
 {
   gchar s[128];
-  const gchar *dir_str = (sess->direction == GPS_DOWN) ? _("Downloaded") : _("Uploaded");
+  const gchar *tmp_str;
 
   gdk_threads_enter();
   g_mutex_lock(sess->mutex);
   if (sess->ok) {
     if (cnt < sess->total_count) {
-      g_sprintf(s, _("%s %d out of %d %s..."), dir_str, cnt, sess->total_count, (sess->progress_label == sess->wp_label) ? _("waypoints") : _("trackpoints"));
+      if (sess->direction == GPS_DOWN)
+      {
+        if (sess->progress_label == sess->wp_label)
+          tmp_str = ngettext("Downloaded %d out of %d waypoint...", "Downloaded %d out of %d waypoints...", sess->total_count);
+        else
+          tmp_str = ngettext("Downloaded %d out of %d trackpoint...", "Downloaded %d out of %d trackpoints...", sess->total_count);
+      }
+      else {
+        if (sess->progress_label == sess->wp_label)
+          tmp_str = ngettext("Uploaded %d out of %d waypoint...", "Uploaded %d out of %d waypoints...", sess->total_count);
+        else
+          tmp_str = ngettext("Uploaded %d out of %d trackpoint...", "Uploaded %d out of %d trackpoints...", sess->total_count);
+      }
+      g_snprintf(s, 128, tmp_str, cnt, sess->total_count);
     } else {
-      g_sprintf(s, "%s %d %s.", dir_str, cnt, (sess->progress_label == sess->wp_label) ? _("waypoints") : _("trackpoints"));
+      if (sess->direction == GPS_DOWN)
+      {
+        if (sess->progress_label == sess->wp_label)
+          tmp_str = ngettext("Downloaded %d waypoint.", "Downloaded %d waypoints...", cnt);
+        else
+          tmp_str = ngettext("Downloaded %d trackpoint.", "Downloaded %d trackpoints...", cnt);
+      }
+      else {
+        if (sess->progress_label == sess->wp_label)
+          tmp_str = ngettext("Uploaded %d waypoint.", "Uploaded %d waypoints...", cnt);
+        else
+          tmp_str = ngettext("Uploaded %d trackpoint.", "Uploaded %d trackpoints...", cnt);
+      }
+      g_snprintf(s, 128, tmp_str, cnt);
     }    
     gtk_label_set_text ( GTK_LABEL(sess->progress_label), s );
   }
@@ -703,7 +743,7 @@ static void set_gps_info(const gchar *info, GpsSession *sess)
   gdk_threads_enter();
   g_mutex_lock(sess->mutex);
   if (sess->ok) {
-    g_sprintf(s, _("GPS Device: %s"), info);
+    g_snprintf(s, 256, _("GPS Device: %s"), info);
     gtk_label_set_text ( GTK_LABEL(sess->gps_label), s );
   }
   g_mutex_unlock(sess->mutex);
index 11effdce682051ba5e7ad785ed5d95b920e656a6..c5e06915478f74300f2d6eb8b9c64dbe081eece8 100644 (file)
@@ -913,8 +913,22 @@ static void start_download_thread ( VikMapsLayer *vml, VikViewport *vvp, const V
 
     if ( mdi->mapstoget )
     {
-      gchar *tmp = g_strdup_printf ( "%s %s%d %s %s...", redownload ? _("Redownloading") : _("Downloading"), redownload == REDOWNLOAD_BAD ? _("up to ") : "", mdi->mapstoget, MAPS_LAYER_NTH_LABEL(vml->maptype), ngettext("map", "maps", mdi->mapstoget) );
+      const gchar *tmp_str;
+      gchar *tmp;
 
+      if (redownload) 
+      {
+        if (redownload == REDOWNLOAD_BAD)
+          tmp_str = ngettext("Redownloading up to %d %s map...", "Redownloading up to %d %s maps...", mdi->mapstoget);
+        else
+          tmp_str = ngettext("Redownloading %d %s map...", "Redownloading %d %s maps...", mdi->mapstoget);
+      } 
+      else 
+      {
+        tmp_str = ngettext("Downloading %d %s map...", "Downloading %d %s maps...", mdi->mapstoget);
+      }
+      tmp = g_strdup_printf ( tmp_str, mdi->mapstoget, MAPS_LAYER_NTH_LABEL(vml->maptype));
       g_object_weak_ref(G_OBJECT(mdi->vml), weak_ref_cb, mdi);
       /* launch the thread */
       a_background_thread ( VIK_GTK_WINDOW_FROM_LAYER(vml), /* parent window */