[gnome-software/gnome-3-20] Always show the 'MyLanguage' kudo when in en_US locale



commit dc43c72e81d099106e27c33bc9e8ade7f8c42f57
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 |   23 ++++++++++++++++++++++-
 1 files changed, 22 insertions(+), 1 deletions(-)
---
diff --git a/src/plugins/gs-appstream.c b/src/plugins/gs-appstream.c
index 18287c6..7672c38 100644
--- a/src/plugins/gs-appstream.c
+++ b/src/plugins/gs-appstream.c
@@ -450,6 +450,26 @@ gs_appstream_refine_app_updates (GsPlugin *plugin,
 }
 
 /**
+ * _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;
+}
+
+/**
  * gs_appstream_refine_app:
  */
 gboolean
@@ -603,7 +623,8 @@ gs_appstream_refine_app (GsPlugin *plugin,
                gs_app_add_kudo (app, GS_APP_KUDO_RECENT_RELEASE);
 
        /* add kudos */
-       if (as_app_get_language (item, plugin->locale) > 50)
+       if (!_gs_utils_locale_has_translations (plugin->locale) ||
+           as_app_get_language (item, plugin->locale) > 50)
                gs_app_add_kudo (app, GS_APP_KUDO_MY_LANGUAGE);
 
        /* add new-style kudos */


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