[gnome-software/localized-available] Fixes #683. No package show available as localized in language
- From: Jordi Mas <jmas src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-software/localized-available] Fixes #683. No package show available as localized in language
- Date: Sun, 26 May 2019 07:49:20 +0000 (UTC)
commit ff5956a0f3bad09f7b325a1e0bfc17bd618773ee
Author: Jordi Mas <jmas softcatala org>
Date: Sun May 26 09:49:09 2019 +0200
Fixes #683. No package show available as localized in language
plugins/core/gs-appstream.c | 23 +++++++++++++++++++++++
1 file changed, 23 insertions(+)
---
diff --git a/plugins/core/gs-appstream.c b/plugins/core/gs-appstream.c
index de54a20d..b80ef0ea 100644
--- a/plugins/core/gs-appstream.c
+++ b/plugins/core/gs-appstream.c
@@ -556,6 +556,20 @@ _gs_utils_locale_has_translations (const gchar *locale)
return TRUE;
}
+static gchar *
+_gs_utils_get_language_from_locale (const gchar *locale)
+{
+ gchar *separator;
+
+ separator = strpbrk (locale, "._");
+
+ if (separator == NULL)
+ return NULL;
+
+ return g_strndup(locale, separator - locale);
+}
+
+
static gboolean
gs_appstream_origin_valid (const gchar *origin)
{
@@ -891,6 +905,15 @@ gs_appstream_refine_app (GsPlugin *plugin,
xpath = g_strdup_printf ("languages/lang[text()='%s'][@percentage>50]", tmp);
if (xb_node_query_text (component, xpath, NULL) != NULL)
gs_app_add_kudo (app, GS_APP_KUDO_MY_LANGUAGE);
+ else {
+ g_autofree gchar *language;
+ language = _gs_utils_get_language_from_locale (tmp);
+ if (language != NULL) {
+ xpath = g_strdup_printf
("languages/lang[text()='%s'][@percentage>50]", language);
+ if (xb_node_query_text (component, xpath, NULL) != NULL)
+ gs_app_add_kudo (app, GS_APP_KUDO_MY_LANGUAGE);
+ }
+ }
}
/* any keywords */
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]