From 767cb686326549596a98bff518e5a4c3d6d57ca0 Mon Sep 17 00:00:00 2001 From: Richard Hughes Date: Thu, 2 Dec 2021 12:29:18 +0000 Subject: Fix validation of translated captions when LANG is not C --- libappstream-glib/as-app-validate.c | 4 ++-- libappstream-glib/as-utils.c | 4 ++++ 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/libappstream-glib/as-app-validate.c b/libappstream-glib/as-app-validate.c index 7de7814..4fe2a58 100644 --- a/libappstream-glib/as-app-validate.c +++ b/libappstream-glib/as-app-validate.c @@ -651,7 +651,7 @@ as_app_validate_screenshot (AsScreenshot *ss, AsAppValidateHelper *helper) im = g_ptr_array_index (images, i); as_app_validate_image (im, helper); } - tmp = as_screenshot_get_caption (ss, NULL); + tmp = as_screenshot_get_caption (ss, ""); if (tmp != NULL) { str_len = (guint) strlen (tmp); if (str_len < length_caption_min) { @@ -1775,7 +1775,7 @@ as_app_validate (AsApp *app, guint32 flags, GError **error) } /* developer_name */ - name = as_app_get_developer_name (app, NULL); + name = as_app_get_developer_name (app, ""); if (name != NULL) { str_len = (guint) strlen (name); if (str_len < length_name_min) { diff --git a/libappstream-glib/as-utils.c b/libappstream-glib/as-utils.c index 007a86b..b7954da 100644 --- a/libappstream-glib/as-utils.c +++ b/libappstream-glib/as-utils.c @@ -80,6 +80,10 @@ as_hash_lookup_by_locale (GHashTable *hash, const gchar *locale) if (locale != NULL) return g_hash_table_lookup (hash, locale); + /* the user explicitly wants LANG=C */ + if (g_strcmp0 (locale, "") == 0) + return g_hash_table_lookup (hash, NULL); + /* use LANGUAGE, LC_ALL, LC_MESSAGES and LANG */ locales = g_get_language_names (); for (i = 0; locales[i] != NULL; i++) { -- cgit v1.2.1