summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFernando Farfan <fernando@endlessm.com>2015-05-11 17:03:55 -0600
committerFernando Farfan <fernando@endlessm.com>2015-05-11 17:03:55 -0600
commit4f65022c488db67049bf9e9b95ca43995472e913 (patch)
tree37c3cb1ef75d8870566f6eb3b02b0ae9edc34e87
parentdd01b8cb433f684a215bcf438431b1337c9712f0 (diff)
parente93732b8e67683966caaf7b821391aced41c317e (diff)
Merge pull request #3145 from endlessm/sdk/3052
New licenses and markup escaping
-rw-r--r--endless/eosattribution.c71
1 files changed, 46 insertions, 25 deletions
diff --git a/endless/eosattribution.c b/endless/eosattribution.c
index 474f4e9..068c492 100644
--- a/endless/eosattribution.c
+++ b/endless/eosattribution.c
@@ -53,7 +53,12 @@ static gchar * const recognized_licenses[] = {
"CC BY 2.0",
"CC BY 3.0",
"CC BY-SA 2.0",
+ "CC BY-SA 2.5",
"CC BY-SA 3.0",
+ "CC BY-SA 4.0",
+ "CC BY-NC 2.0",
+ "CC BY-NC 3.0",
+ "CC BY-NC-SA 2.0",
"CC BY-ND 2.0",
"CC BY-ND 3.0",
NULL
@@ -61,13 +66,19 @@ static gchar * const recognized_licenses[] = {
static gchar * const license_display_names[] = {
/* TRANSLATORS: These names should be translated as the official names of the
- licenses in your language. */
+ licenses in your language. Note: these names are markup, and so should not
+ contain any ampersands (&), less-than signs (<) or greater-than signs (>). */
N_("Public domain"),
N_("CC0 1.0 (Public domain)"),
N_("Creative Commons Attribution 2.0"),
N_("Creative Commons Attribution 3.0"),
N_("Creative Commons Attribution-ShareAlike 2.0"),
+ N_("Creative Commons Attribution-ShareAlike 2.5 Generic"),
N_("Creative Commons Attribution-ShareAlike 3.0"),
+ N_("Creative Commons Attribution-ShareAlike 4.0 International"),
+ N_("Creative Commons Attribution-NonCommercial 2.0"),
+ N_("Creative Commons Attribution-NonCommercial 3.0"),
+ N_("Creative Commons Attribution-NonCommercial-ShareAlike 2.0 Generic"),
N_("Creative Commons Attribution-NoDerivs 2.0"),
N_("Creative Commons Attribution-NoDerivs 3.0"),
NULL
@@ -84,7 +95,12 @@ static gchar * const license_uris[] = {
N_("http://creativecommons.org/licenses/by/2.0/"),
N_("http://creativecommons.org/licenses/by/3.0/"),
N_("http://creativecommons.org/licenses/by-sa/2.0/"),
+ N_("http://creativecommons.org/licenses/by-sa/2.5/"),
N_("http://creativecommons.org/licenses/by-sa/3.0/"),
+ N_("http://creativecommons.org/licenses/by-sa/4.0/"),
+ N_("http://creativecommons.org/licenses/by-nc/2.0/"),
+ N_("http://creativecommons.org/licenses/by-nc/3.0/"),
+ N_("http://creativecommons.org/licenses/by-nc-sa/2.0/"),
N_("http://creativecommons.org/licenses/by-nd/2.0/"),
N_("http://creativecommons.org/licenses/by-nd/3.0/"),
NULL
@@ -92,19 +108,6 @@ static gchar * const license_uris[] = {
enum
{
- LICENSE_PUBLIC_DOMAIN,
- LICENSE_CC0,
- LICENSE_CC_BY_2_0,
- LICENSE_CC_BY_3_0,
- LICENSE_CC_BY_SA_2_0,
- LICENSE_CC_BY_SA_3_0,
- LICENSE_GFDL_1_2,
- LICENSE_GFDL_1_3,
- NUM_RECOGNIZED_LICENSES
-};
-
-enum
-{
COLUMN_PIXBUF,
COLUMN_ORIGINAL_URI,
COLUMN_LICENSE,
@@ -282,7 +285,8 @@ render_license_link (GtkTreeViewColumn *column,
/* TRANSLATORS: %s will be replaced with the name of an image license,
such as "Public domain" or "Creative Commons Attribution". These names are
translated elsewhere in this file. Make sure %s is still in the translated
- string. */
+ string. Note: this string is markup, and so should not contain any
+ ampersands (&), less-than signs (<), or greater-than signs (>). */
gchar *license_string = g_strdup_printf (_("%s."),
gettext (license_display_names[license_index]));
gboolean behave_like_link = (license_uri != NULL);
@@ -296,6 +300,9 @@ render_license_link (GtkTreeViewColumn *column,
else if (license_uri != NULL)
{
g_object_set (renderer,
+ /* TRANSLATORS: This string is markup, and so should not
+ contain any ampersands (&), less-than signs (<), or
+ greater-than signs (>). */
"markup", _("Click for image license."),
"visible", TRUE,
NULL);
@@ -321,10 +328,14 @@ render_contact_link (GtkTreeViewColumn *column,
-1);
if (credit != NULL)
{
+ gchar *credit_escaped = g_markup_escape_text (credit, -1);
/* TRANSLATORS: %s will be replaced with the name or account name of the
person that the image should be credited to. Make sure %s is still in the
- translated string. */
- gchar *credit_string = g_strdup_printf (_("Image credit: %s."), credit);
+ translated string. Note: this string is markup and so should not contain
+ any ampersands (&), less-than signs (<), or greater-than signs (>). */
+ gchar *credit_string = g_strdup_printf (_("Image credit: %s."),
+ credit_escaped);
+ g_free (credit_escaped);
g_object_set (renderer,
"markup", credit_string,
"visible", TRUE,
@@ -360,35 +371,45 @@ render_usage_notes (GtkTreeViewColumn *column,
-1);
if (copyright_holder != NULL)
{
+ gchar *copy_holder_escaped = g_markup_escape_text (copyright_holder, -1);
if (copyright_year != -1)
{
/* TRANSLATORS: %d will be replaced with the copyright year, %s with
the copyright holder. Make sure these tokens are in the translated
- string. */
+ string. Note: this string is markup and so should not contain
+ any ampersands (&), less-than signs (<), or greater-than signs (>). */
g_string_append_printf (builder, _("Copyright %d %s."),
- copyright_year, copyright_holder);
+ copyright_year, copy_holder_escaped);
}
else
{
/* TRANSLATORS: %s will be replaced with the name of the copyright
- holder. Make sure %s is still in the translated string. */
+ holder. Make sure %s is still in the translated string. Note: this
+ string is markup and so should not contain any ampersands (&),
+ less-than signs (<), or greater-than signs (>). */
g_string_append_printf (builder, _("Copyright %s."),
- copyright_holder);
+ copy_holder_escaped);
}
if (permission || comment != NULL)
g_string_append_c (builder, ' ');
+ g_free (copyright_holder);
+ g_free (copy_holder_escaped);
}
if (permission)
{
+ /* TRANSLATORS: This string is markup and so should not contain any
+ ampersands (&), less-than signs (<), or greater-than signs (>). */
g_string_append (builder, _("Used with permission."));
if (comment != NULL)
g_string_append_c (builder, ' ');
}
if (comment != NULL)
- g_string_append (builder, comment);
-
- g_free (copyright_holder);
- g_free (comment);
+ {
+ gchar *comment_escaped = g_markup_escape_text (comment, -1);
+ g_free (comment);
+ g_string_append (builder, comment_escaped);
+ g_free (comment_escaped);
+ }
gchar *resulting_text = g_string_free (builder, FALSE);
g_object_set (renderer, "markup", resulting_text, NULL);