summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard Hughes <richard@hughsie.com>2021-12-02 12:29:18 +0000
committerRichard Hughes <richard@hughsie.com>2021-12-02 12:29:18 +0000
commit767cb686326549596a98bff518e5a4c3d6d57ca0 (patch)
tree515e1abb39778cf6e1dc4ce87658a7cc9febcdb4
parent3fa624026f608ef8465fb339f86725aaf648e09f (diff)
downloadappstream-glib-wip/hughsie/LANG_C.tar.gz
Fix validation of translated captions when LANG is not Cwip/hughsie/LANG_C
-rw-r--r--libappstream-glib/as-app-validate.c4
-rw-r--r--libappstream-glib/as-utils.c4
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++) {