diff options
author | Phillip Wood <phillip.wood@dunelm.org.uk> | 2012-06-29 10:07:28 +0100 |
---|---|---|
committer | Christophe Fergeau <cfergeau@redhat.com> | 2013-04-10 15:23:34 +0200 |
commit | 7acd76f7a5981cacc434c7541612b27733734b85 (patch) | |
tree | 19f8c794eff8d7677cfb8515cf89e4b6ef1f61d7 | |
parent | 9a0561595ea27d6e3caf184c90452c5c1bf33e92 (diff) |
Format release details.
To display the recording label, year and country on one line we need a
function to combine them into a string.
https://bugzilla.gnome.org/show_bug.cgi?id=674926
-rw-r--r-- | src/sj-main.c | 70 |
1 files changed, 70 insertions, 0 deletions
diff --git a/src/sj-main.c b/src/sj-main.c index 4305b5c..ad6577d 100644 --- a/src/sj-main.c +++ b/src/sj-main.c @@ -813,6 +813,76 @@ static GString* format_label_text (GList* labels) } /** + * Utility function for multiple_album_dialog to format the + * release label, date and country. + */ +static char *format_release_details (AlbumDetails *album) +{ + GString *release_details = g_string_new (NULL); + gchar *details; + GString *label_text; + + if (album->labels) + label_text = format_label_text (album->labels); + + if (!sj_str_is_empty (album->country)) { + if (album->labels) { + if (album->release_date) { + /* Translators: this string appears when multiple CDs were + * found in musicbrainz online database, it corresponds to + * "Released: <country> in <year> on <label>" */ + details = g_strdup_printf (_("Released: %s in %d on %s"), + album->country, + g_date_get_year(album->release_date), + label_text->str); + } else { + /* Translators: this string appears when multiple CDs were + * found in musicbrainz online database, it corresponds to + * "Released: <country> on <label>" */ + details = g_strdup_printf (_("Released: %s on %s"), album->country, label_text->str); + } + } else if (album->release_date) { + /* Translators: this string appears when multiple CDs were + * found in musicbrainz online database, it corresponds to + * "Released: <country> in <year>" */ + details = g_strdup_printf (_("Released: %s in %d"), album->country, + g_date_get_year (album->release_date)); + } else { + /* Translators: this string appears when multiple CDs were + * found in musicbrainz online database, it corresponds to + * "Released: <country>" */ + details = g_strdup_printf (_("Released: %s"), album->country); + } + } else if (album->release_date) { + if (album->labels) { + /* Translators: this string appears when multiple CDs were + * found in musicbrainz online database, it corresponds to + * "Released in <year> on <label>" */ + details = g_strdup_printf (_("Released in %d on %s"), + g_date_get_year(album->release_date), + label_text->str); + } else { + /* Translators: this string appears when multiple CDs were + * found in musicbrainz online database, it corresponds to + * "Released in <year>" */ + details = g_strdup_printf(_("Released in %d"), + g_date_get_year(album->release_date)); + } + } else if (album->labels) { + /* Translators: this string appears when multiple CDs were + * found in musicbrainz online database, it corresponds to + * "Released on <label>" */ + details = g_strdup_printf (_("Released on %s"), label_text->str); + + } else { + details = _("Release label, year & country unknown"); + } + g_string_free (label_text, TRUE); + + return details; +} + +/** * Utility function for when there are more than one albums available */ AlbumDetails* multiple_album_dialog(GList *albums) |