libmalcontent-ui: Choose rating system by territory rather than language
This incorporates commit ed981f1d26f9a2c086eeccdee2909959de64f908 from gnome-software, which ensures that content rating systems are chosen by territory rather than language. Signed-off-by: Philip Withnall <withnall@endlessm.com>
This commit is contained in:
parent
396dd3c039
commit
a27f96517f
|
@ -634,125 +634,119 @@ GsContentRatingSystem
|
|||
gs_utils_content_rating_system_from_locale (const gchar *locale)
|
||||
{
|
||||
g_autofree gchar *locale_copy = g_strdup (locale);
|
||||
const gchar *language, *territory;
|
||||
const gchar *territory;
|
||||
|
||||
/* Default to IARC for locales which can’t be parsed. */
|
||||
if (!parse_locale (locale_copy, &language, &territory, NULL, NULL))
|
||||
if (!parse_locale (locale_copy, NULL, &territory, NULL, NULL))
|
||||
return GS_CONTENT_RATING_SYSTEM_IARC;
|
||||
|
||||
/* Argentina */
|
||||
if (g_strcmp0 (language, "ar") == 0)
|
||||
if (g_strcmp0 (territory, "AR") == 0)
|
||||
return GS_CONTENT_RATING_SYSTEM_INCAA;
|
||||
|
||||
/* Australia */
|
||||
if (g_strcmp0 (language, "au") == 0)
|
||||
if (g_strcmp0 (territory, "AU") == 0)
|
||||
return GS_CONTENT_RATING_SYSTEM_ACB;
|
||||
|
||||
/* Brazil */
|
||||
if (g_strcmp0 (language, "pt") == 0 &&
|
||||
g_strcmp0 (territory, "BR") == 0)
|
||||
if (g_strcmp0 (territory, "BR") == 0)
|
||||
return GS_CONTENT_RATING_SYSTEM_DJCTQ;
|
||||
|
||||
/* Taiwan */
|
||||
if (g_strcmp0 (language, "zh") == 0 &&
|
||||
g_strcmp0 (territory, "TW") == 0)
|
||||
if (g_strcmp0 (territory, "TW") == 0)
|
||||
return GS_CONTENT_RATING_SYSTEM_GSRR;
|
||||
|
||||
/* Europe (but not Finland or Germany), India, Israel,
|
||||
* Pakistan, Quebec, South Africa */
|
||||
if ((g_strcmp0 (language, "en") == 0 &&
|
||||
g_strcmp0 (territory, "GB") == 0) ||
|
||||
g_strcmp0 (language, "gb") == 0 ||
|
||||
g_strcmp0 (language, "al") == 0 ||
|
||||
g_strcmp0 (language, "ad") == 0 ||
|
||||
g_strcmp0 (language, "am") == 0 ||
|
||||
g_strcmp0 (language, "at") == 0 ||
|
||||
g_strcmp0 (language, "az") == 0 ||
|
||||
g_strcmp0 (language, "by") == 0 ||
|
||||
g_strcmp0 (language, "be") == 0 ||
|
||||
g_strcmp0 (language, "ba") == 0 ||
|
||||
g_strcmp0 (language, "bg") == 0 ||
|
||||
g_strcmp0 (language, "hr") == 0 ||
|
||||
g_strcmp0 (language, "cy") == 0 ||
|
||||
g_strcmp0 (language, "cz") == 0 ||
|
||||
g_strcmp0 (language, "dk") == 0 ||
|
||||
g_strcmp0 (language, "ee") == 0 ||
|
||||
g_strcmp0 (language, "fr") == 0 ||
|
||||
g_strcmp0 (language, "ge") == 0 ||
|
||||
g_strcmp0 (language, "gr") == 0 ||
|
||||
g_strcmp0 (language, "hu") == 0 ||
|
||||
g_strcmp0 (language, "is") == 0 ||
|
||||
g_strcmp0 (language, "it") == 0 ||
|
||||
g_strcmp0 (language, "kz") == 0 ||
|
||||
g_strcmp0 (language, "xk") == 0 ||
|
||||
g_strcmp0 (language, "lv") == 0 ||
|
||||
g_strcmp0 (language, "fl") == 0 ||
|
||||
g_strcmp0 (language, "lu") == 0 ||
|
||||
g_strcmp0 (language, "lt") == 0 ||
|
||||
g_strcmp0 (language, "mk") == 0 ||
|
||||
g_strcmp0 (language, "mt") == 0 ||
|
||||
g_strcmp0 (language, "md") == 0 ||
|
||||
g_strcmp0 (language, "mc") == 0 ||
|
||||
g_strcmp0 (language, "me") == 0 ||
|
||||
g_strcmp0 (language, "nl") == 0 ||
|
||||
g_strcmp0 (language, "no") == 0 ||
|
||||
g_strcmp0 (language, "pl") == 0 ||
|
||||
g_strcmp0 (language, "pt") == 0 ||
|
||||
g_strcmp0 (language, "ro") == 0 ||
|
||||
g_strcmp0 (language, "sm") == 0 ||
|
||||
g_strcmp0 (language, "rs") == 0 ||
|
||||
g_strcmp0 (language, "sk") == 0 ||
|
||||
g_strcmp0 (language, "si") == 0 ||
|
||||
g_strcmp0 (language, "es") == 0 ||
|
||||
g_strcmp0 (language, "se") == 0 ||
|
||||
g_strcmp0 (language, "ch") == 0 ||
|
||||
g_strcmp0 (language, "tr") == 0 ||
|
||||
g_strcmp0 (language, "ua") == 0 ||
|
||||
g_strcmp0 (language, "va") == 0 ||
|
||||
g_strcmp0 (language, "in") == 0 ||
|
||||
g_strcmp0 (language, "il") == 0 ||
|
||||
g_strcmp0 (language, "pk") == 0 ||
|
||||
g_strcmp0 (language, "za") == 0)
|
||||
if ((g_strcmp0 (territory, "GB") == 0) ||
|
||||
g_strcmp0 (territory, "AL") == 0 ||
|
||||
g_strcmp0 (territory, "AD") == 0 ||
|
||||
g_strcmp0 (territory, "AM") == 0 ||
|
||||
g_strcmp0 (territory, "AT") == 0 ||
|
||||
g_strcmp0 (territory, "AZ") == 0 ||
|
||||
g_strcmp0 (territory, "BY") == 0 ||
|
||||
g_strcmp0 (territory, "BE") == 0 ||
|
||||
g_strcmp0 (territory, "BA") == 0 ||
|
||||
g_strcmp0 (territory, "BG") == 0 ||
|
||||
g_strcmp0 (territory, "HR") == 0 ||
|
||||
g_strcmp0 (territory, "CY") == 0 ||
|
||||
g_strcmp0 (territory, "CZ") == 0 ||
|
||||
g_strcmp0 (territory, "DK") == 0 ||
|
||||
g_strcmp0 (territory, "EE") == 0 ||
|
||||
g_strcmp0 (territory, "FR") == 0 ||
|
||||
g_strcmp0 (territory, "GE") == 0 ||
|
||||
g_strcmp0 (territory, "GR") == 0 ||
|
||||
g_strcmp0 (territory, "HU") == 0 ||
|
||||
g_strcmp0 (territory, "IS") == 0 ||
|
||||
g_strcmp0 (territory, "IT") == 0 ||
|
||||
g_strcmp0 (territory, "LZ") == 0 ||
|
||||
g_strcmp0 (territory, "XK") == 0 ||
|
||||
g_strcmp0 (territory, "LV") == 0 ||
|
||||
g_strcmp0 (territory, "FL") == 0 ||
|
||||
g_strcmp0 (territory, "LU") == 0 ||
|
||||
g_strcmp0 (territory, "LT") == 0 ||
|
||||
g_strcmp0 (territory, "MK") == 0 ||
|
||||
g_strcmp0 (territory, "MT") == 0 ||
|
||||
g_strcmp0 (territory, "MD") == 0 ||
|
||||
g_strcmp0 (territory, "MC") == 0 ||
|
||||
g_strcmp0 (territory, "ME") == 0 ||
|
||||
g_strcmp0 (territory, "NL") == 0 ||
|
||||
g_strcmp0 (territory, "NO") == 0 ||
|
||||
g_strcmp0 (territory, "PL") == 0 ||
|
||||
g_strcmp0 (territory, "PT") == 0 ||
|
||||
g_strcmp0 (territory, "RO") == 0 ||
|
||||
g_strcmp0 (territory, "SM") == 0 ||
|
||||
g_strcmp0 (territory, "RS") == 0 ||
|
||||
g_strcmp0 (territory, "SK") == 0 ||
|
||||
g_strcmp0 (territory, "SI") == 0 ||
|
||||
g_strcmp0 (territory, "ES") == 0 ||
|
||||
g_strcmp0 (territory, "SE") == 0 ||
|
||||
g_strcmp0 (territory, "CH") == 0 ||
|
||||
g_strcmp0 (territory, "TR") == 0 ||
|
||||
g_strcmp0 (territory, "UA") == 0 ||
|
||||
g_strcmp0 (territory, "VA") == 0 ||
|
||||
g_strcmp0 (territory, "IN") == 0 ||
|
||||
g_strcmp0 (territory, "IL") == 0 ||
|
||||
g_strcmp0 (territory, "PK") == 0 ||
|
||||
g_strcmp0 (territory, "ZA") == 0)
|
||||
return GS_CONTENT_RATING_SYSTEM_PEGI;
|
||||
|
||||
/* Finland */
|
||||
if (g_strcmp0 (language, "fi") == 0)
|
||||
if (g_strcmp0 (territory, "FI") == 0)
|
||||
return GS_CONTENT_RATING_SYSTEM_KAVI;
|
||||
|
||||
/* Germany */
|
||||
if (g_strcmp0 (language, "de") == 0)
|
||||
if (g_strcmp0 (territory, "DE") == 0)
|
||||
return GS_CONTENT_RATING_SYSTEM_USK;
|
||||
|
||||
/* Iran */
|
||||
if (g_strcmp0 (language, "ir") == 0)
|
||||
if (g_strcmp0 (territory, "IR") == 0)
|
||||
return GS_CONTENT_RATING_SYSTEM_ESRA;
|
||||
|
||||
/* Japan */
|
||||
if (g_strcmp0 (language, "jp") == 0)
|
||||
if (g_strcmp0 (territory, "JP") == 0)
|
||||
return GS_CONTENT_RATING_SYSTEM_CERO;
|
||||
|
||||
/* New Zealand */
|
||||
if (g_strcmp0 (language, "nz") == 0)
|
||||
if (g_strcmp0 (territory, "NZ") == 0)
|
||||
return GS_CONTENT_RATING_SYSTEM_OFLCNZ;
|
||||
|
||||
/* Russia: Content rating law */
|
||||
if (g_strcmp0 (language, "ru") == 0)
|
||||
if (g_strcmp0 (territory, "RU") == 0)
|
||||
return GS_CONTENT_RATING_SYSTEM_RUSSIA;
|
||||
|
||||
/* Singapore */
|
||||
if (g_strcmp0 (language, "sg") == 0)
|
||||
if (g_strcmp0 (territory, "SQ") == 0)
|
||||
return GS_CONTENT_RATING_SYSTEM_MDA;
|
||||
|
||||
/* South Korea */
|
||||
if (g_strcmp0 (language, "kr") == 0)
|
||||
if (g_strcmp0 (territory, "KR") == 0)
|
||||
return GS_CONTENT_RATING_SYSTEM_GRAC;
|
||||
|
||||
/* USA, Canada, Mexico */
|
||||
if ((g_strcmp0 (language, "en") == 0 &&
|
||||
g_strcmp0 (territory, "US") == 0) ||
|
||||
g_strcmp0 (language, "us") == 0 ||
|
||||
g_strcmp0 (language, "ca") == 0 ||
|
||||
g_strcmp0 (language, "mx") == 0)
|
||||
if ((g_strcmp0 (territory, "US") == 0) ||
|
||||
g_strcmp0 (territory, "CA") == 0 ||
|
||||
g_strcmp0 (territory, "MX") == 0)
|
||||
return GS_CONTENT_RATING_SYSTEM_ESRB;
|
||||
|
||||
/* everything else is IARC */
|
||||
|
|
Loading…
Reference in New Issue