[tracker/collation-gconf-locale] tracker-miner-applications: Warn if MLocale and tracker-locale are using different locale values



commit ff39f5cf5d320c1e9553bbece7814147cb378d58
Author: Aleksander Morgado <aleksander lanedo com>
Date:   Tue Nov 16 17:48:07 2010 +0100

    tracker-miner-applications: Warn if MLocale and tracker-locale are using different locale values

 src/miners/fs/tracker-miner-applications-meego.cpp |   10 ++++++++--
 src/miners/fs/tracker-miner-applications-meego.h   |    5 +++--
 src/miners/fs/tracker-miner-applications.c         |   12 +++++++++++-
 3 files changed, 22 insertions(+), 5 deletions(-)
---
diff --git a/src/miners/fs/tracker-miner-applications-meego.cpp b/src/miners/fs/tracker-miner-applications-meego.cpp
index 20961ce..c1924a4 100644
--- a/src/miners/fs/tracker-miner-applications-meego.cpp
+++ b/src/miners/fs/tracker-miner-applications-meego.cpp
@@ -36,8 +36,9 @@
  * layers here.
  */
 gchar *
-tracker_miner_applications_meego_translate (const gchar *catalogue,
-					    const gchar *id)
+tracker_miner_applications_meego_translate (const gchar  *catalogue,
+                                            const gchar  *id,
+                                            gchar       **locale_used)
 {
 	char *argv[] = { "dummy", NULL };
 	int argc = 1;
@@ -52,6 +53,11 @@ tracker_miner_applications_meego_translate (const gchar *catalogue,
 	locale.installTrCatalog (catalogue);
 	MLocale::setDefault (locale);
 
+	/* If locale used requested, set it */
+	if (locale_used) {
+		*locale_used = g_strdup (locale.name ().data ());
+	}
+
 	GStrv split;
 	split = g_strsplit (qtTrId (id). toAscii ().data (), "\x9C", 2);
 
diff --git a/src/miners/fs/tracker-miner-applications-meego.h b/src/miners/fs/tracker-miner-applications-meego.h
index 8f36523..f4428de 100644
--- a/src/miners/fs/tracker-miner-applications-meego.h
+++ b/src/miners/fs/tracker-miner-applications-meego.h
@@ -22,8 +22,9 @@
 
 G_BEGIN_DECLS
 
-gchar* tracker_miner_applications_meego_translate (const gchar *catalogue,
-                                                   const gchar *id);
+gchar* tracker_miner_applications_meego_translate (const gchar  *catalogue,
+                                                   const gchar  *id,
+                                                   gchar       **locale_used);
 
 G_END_DECLS
 
diff --git a/src/miners/fs/tracker-miner-applications.c b/src/miners/fs/tracker-miner-applications.c
index 6371554..73c675b 100644
--- a/src/miners/fs/tracker-miner-applications.c
+++ b/src/miners/fs/tracker-miner-applications.c
@@ -328,7 +328,17 @@ process_desktop_file (ProcessApplicationData  *data,
 	translation_catalog = g_key_file_get_string (key_file, GROUP_DESKTOP_ENTRY, "X-MeeGo-Translation-Catalog", NULL);
 
 	if (logical_id && translation_catalog) {
-		name = tracker_miner_applications_meego_translate (translation_catalog, logical_id);
+		gchar *locale_used = NULL;
+
+		name = tracker_miner_applications_meego_translate (translation_catalog, logical_id, &locale_used);
+
+		/* Sanity check to see if MLocale and Tracker-Locale are using the same setup */
+		if (locale_used && strcmp (lang, locale_used) != 0) {
+			g_warning ("Tracker-Locale reports we're using '%s' LANG locale, but MLocale is using '%s'",
+			           lang,
+			           locale_used);
+		}
+		g_free (locale_used);
 	}
 
 	g_free (logical_id);



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