[gnome-software/1649-support-appstream-merging: 6/13] gs-appstream: Add gs_appstream_add_current_locales()




commit d501c8707d638d75368c3c23ae44f7955d07f73f
Author: Milan Crha <mcrha redhat com>
Date:   Thu Mar 31 12:07:29 2022 +0200

    gs-appstream: Add gs_appstream_add_current_locales()
    
    It will be used by the other code, to avoid code duplication.

 lib/gs-appstream.c | 8 ++++++++
 lib/gs-appstream.h | 1 +
 2 files changed, 9 insertions(+)
---
diff --git a/lib/gs-appstream.c b/lib/gs-appstream.c
index 04e347d2c..94138388a 100644
--- a/lib/gs-appstream.c
+++ b/lib/gs-appstream.c
@@ -1997,6 +1997,14 @@ gs_appstream_get_appstream_data_dirs (void)
        return appstream_data_dirs;
 }
 
+void
+gs_appstream_add_current_locales (XbBuilder *builder)
+{
+       const gchar *const *locales = g_get_language_names ();
+       for (guint i = 0; locales[i] != NULL; i++)
+               xb_builder_add_locale (builder, locales[i]);
+}
+
 void
 gs_appstream_component_add_keyword (XbBuilderNode *component, const gchar *str)
 {
diff --git a/lib/gs-appstream.h b/lib/gs-appstream.h
index 87b48857c..4f46dd5c7 100644
--- a/lib/gs-appstream.h
+++ b/lib/gs-appstream.h
@@ -70,6 +70,7 @@ gboolean       gs_appstream_load_desktop_files        (XbBuilder      *builder,
                                                         GCancellable   *cancellable,
                                                         GError         **error);
 GPtrArray      *gs_appstream_get_appstream_data_dirs   (void);
+void            gs_appstream_add_current_locales       (XbBuilder      *builder);
 void            gs_appstream_component_add_extra_info  (XbBuilderNode  *component);
 void            gs_appstream_component_add_keyword     (XbBuilderNode  *component,
                                                         const gchar    *str);


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