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




commit 63b8843f7fedb0c559774d319b4ca8ba6e5cedfe
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 f455ac811..3c37a945e 100644
--- a/lib/gs-appstream.c
+++ b/lib/gs-appstream.c
@@ -2061,6 +2061,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]