[gnome-software] Correctly parse the XML language for pre-processed AppStream descriptions



commit 023c63d0e9f4838d55484fa35d75d1fc0c39faff
Author: Richard Hughes <richard hughsie com>
Date:   Thu Nov 14 18:42:47 2013 +0000

    Correctly parse the XML language for pre-processed AppStream descriptions

 src/plugins/appstream-cache.c |   11 +++++++++++
 1 files changed, 11 insertions(+), 0 deletions(-)
---
diff --git a/src/plugins/appstream-cache.c b/src/plugins/appstream-cache.c
index b078dde..67b550f 100644
--- a/src/plugins/appstream-cache.c
+++ b/src/plugins/appstream-cache.c
@@ -159,6 +159,7 @@ appstream_cache_start_element_cb (GMarkupParseContext *context,
        AppstreamCacheHelper *helper = (AppstreamCacheHelper *) user_data;
        AppstreamTag section_new;
        const gchar *tmp = NULL;
+       gboolean set_lang = FALSE;
        guint height = 0;
        guint i;
        guint width = 0;
@@ -415,6 +416,16 @@ appstream_cache_start_element_cb (GMarkupParseContext *context,
                        helper->lang_temp = g_strdup ("C");
                break;
        case APPSTREAM_TAG_DESCRIPTION:
+               for (i = 0; attribute_names[i] != NULL; i++) {
+                       if (g_strcmp0 (attribute_names[i], "xml:lang") == 0) {
+                               appstream_markup_set_lang (helper->markup,
+                                                          attribute_values[i]);
+                               set_lang = TRUE;
+                               break;
+                       }
+               }
+               if (!set_lang)
+                       appstream_markup_set_lang (helper->markup, "C");
                appstream_markup_set_enabled (helper->markup, TRUE);
                appstream_markup_set_mode (helper->markup,
                                           APPSTREAM_MARKUP_MODE_START);


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