[gnome-software: 2/18] gs-odrs-provider: Use the locale from setlocale() rather than the plugin




commit ed745e2211470b2c0c8d5c597bbc7867bedaaf64
Author: Philip Withnall <pwithnall endlessos org>
Date:   Tue May 18 13:45:01 2021 +0100

    gs-odrs-provider: Use the locale from setlocale() rather than the plugin
    
    It’s ultimately derived from the same place, but `GsPlugin` allows
    overriding it with an environment variable. That seems redundant, since
    it can be overridden with `LC_MESSAGES` or `LANG` already.
    
    Signed-off-by: Philip Withnall <pwithnall endlessos org>

 lib/gs-odrs-provider.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)
---
diff --git a/lib/gs-odrs-provider.c b/lib/gs-odrs-provider.c
index dc9d744b8..36a2cf5c7 100644
--- a/lib/gs-odrs-provider.c
+++ b/lib/gs-odrs-provider.c
@@ -37,6 +37,7 @@
 #include <gnome-software.h>
 #include <json-glib/json-glib.h>
 #include <libsoup/soup.h>
+#include <locale.h>
 #include <math.h>
 #include <string.h>
 
@@ -708,7 +709,7 @@ gs_odrs_provider_fetch_for_app (GsOdrsProvider  *self,
        json_builder_set_member_name (builder, "app_id");
        json_builder_add_string_value (builder, gs_app_get_id (app));
        json_builder_set_member_name (builder, "locale");
-       json_builder_add_string_value (builder, gs_plugin_get_locale (plugin));
+       json_builder_add_string_value (builder, setlocale (LC_MESSAGES, NULL));
        json_builder_set_member_name (builder, "distro");
        json_builder_add_string_value (builder, self->distro);
        json_builder_set_member_name (builder, "version");
@@ -1359,7 +1360,7 @@ gs_odrs_provider_submit_review (GsOdrsProvider  *self,
        json_builder_add_string_value (builder,
                                       as_review_get_metadata_item (review, "app_id"));
        json_builder_set_member_name (builder, "locale");
-       json_builder_add_string_value (builder, gs_plugin_get_locale (plugin));
+       json_builder_add_string_value (builder, setlocale (LC_MESSAGES, NULL));
        json_builder_set_member_name (builder, "distro");
        json_builder_add_string_value (builder, self->distro);
        json_builder_set_member_name (builder, "version");
@@ -1560,7 +1561,7 @@ gs_odrs_provider_add_unvoted_reviews (GsOdrsProvider  *self,
        uri = g_strdup_printf ("%s/moderate/%s/%s",
                               self->review_server,
                               self->user_hash,
-                              gs_plugin_get_locale (plugin));
+                              setlocale (LC_MESSAGES, NULL));
        msg = soup_message_new (SOUP_METHOD_GET, uri);
        status_code = soup_session_send_message (gs_plugin_get_soup_session (plugin), msg);
        if (status_code != SOUP_STATUS_OK) {


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