[gnome-software] Always show the 'MyLanguage' kudo when in en_US locale
- From: Richard Hughes <rhughes src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-software] Always show the 'MyLanguage' kudo when in en_US locale
- Date: Wed, 29 Jun 2016 13:38:22 +0000 (UTC)
commit 480550e7761e8903fad76f36d63e5326ee507325
Author: Richard Hughes <richard hughsie com>
Date: Wed Jun 29 14:37:44 2016 +0100
Always show the 'MyLanguage' kudo when in en_US locale
src/plugins/gs-appstream.c | 24 +++++++++++++++++++++++-
1 files changed, 23 insertions(+), 1 deletions(-)
---
diff --git a/src/plugins/gs-appstream.c b/src/plugins/gs-appstream.c
index ffbfd7f..5b92601 100644
--- a/src/plugins/gs-appstream.c
+++ b/src/plugins/gs-appstream.c
@@ -429,6 +429,26 @@ gs_appstream_refine_app_updates (GsPlugin *plugin,
return TRUE;
}
+/**
+ * _gs_utils_locale_has_translations:
+ * @locale: A locale, e.g. "en_GB"
+ *
+ * Looks up if the locale is likely to have translations.
+ *
+ * Returns: %TRUE if the locale should have translations
+ **/
+static gboolean
+_gs_utils_locale_has_translations (const gchar *locale)
+{
+ if (g_strcmp0 (locale, "C") == 0)
+ return FALSE;
+ if (g_strcmp0 (locale, "en") == 0)
+ return FALSE;
+ if (g_strcmp0 (locale, "en_US") == 0)
+ return FALSE;
+ return TRUE;
+}
+
gboolean
gs_appstream_refine_app (GsPlugin *plugin,
GsApp *app,
@@ -602,7 +622,9 @@ gs_appstream_refine_app (GsPlugin *plugin,
gs_app_add_kudo (app, GS_APP_KUDO_RECENT_RELEASE);
/* add kudos */
- if (as_app_get_language (item, gs_plugin_get_locale (plugin)) > 50)
+ tmp = gs_plugin_get_locale (plugin);
+ if (!_gs_utils_locale_has_translations (tmp) ||
+ as_app_get_language (item, tmp) > 50)
gs_app_add_kudo (app, GS_APP_KUDO_MY_LANGUAGE);
/* add a kudo to featured and popular apps */
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]