gladish: credit translators in the about dialog

_(translator-credits) is not used because i think it will lead
to need to translate names multiple times, because some of them
appear as part of author credits, for example.
This commit is contained in:
Nedko Arnaudov 2010-12-22 16:58:16 +02:00
parent 3b87aaf97d
commit 67ba277fa5
3 changed files with 71 additions and 2 deletions

View File

@ -153,3 +153,42 @@ char * catdupv(const char * s1, const char * s2, ...)
return buffer;
}
char * catdup_array(const char ** array, const char * delimiter)
{
size_t len;
size_t i;
size_t delimiter_length;
char * buffer;
char * p;
delimiter_length = delimiter != NULL ? strlen(delimiter) : 0;
len = 0;
for (i = 0; array[i] != NULL; i++)
{
len += strlen(array[i]);
len += delimiter_length;
}
buffer = malloc(len);
if (buffer == NULL)
{
log_error("malloc(%zu) failed.", len);
return NULL;
}
p = buffer;
for (i = 0; array[i] != NULL; i++)
{
len = strlen(array[i]);
memcpy(p, array[i], len);
p += len;
memcpy(p, delimiter, delimiter_length);
p += delimiter_length;
}
*p = 0;
return buffer;
}

View File

@ -31,5 +31,6 @@ char * catdup(const char * s1, const char * s2);
char * catdup3(const char * s1, const char * s2, const char * s3);
char * catdup4(const char * s1, const char * s2, const char * s3, const char * s4);
char * catdupv(const char * s1, const char * s2, ...);
char * catdup_array(const char ** array, const char * delimiter);
#endif /* #ifndef CATDUP_H__D42302F1_4D96_4EE4_AC09_E97ED5748277__INCLUDED */

View File

@ -35,6 +35,7 @@
#include "version.h"
#include "../common/file.h"
#include "../common/catdup.h"
#define ABOUT_DIALOG_LOGO "ladish-logo-128x128.png"
@ -42,8 +43,30 @@ void show_about(void)
{
GtkWidget * dialog;
GdkPixbuf * pixbuf;
const char * authors[] = {_("Nedko Arnaudov"), _("Nikita Zlobin"), _("Filipe Alexandre Lopes Coelho"), NULL};
const char * artists[] = {_("Lapo Calamandrei"), _("Nadejda Pancheva-Arnaudova"), NULL};
const char * authors[] =
{
_("Nedko Arnaudov"),
_("Nikita Zlobin"),
_("Filipe Alexandre Lopes Coelho"),
NULL
};
const char * artists[] =
{
_("Lapo Calamandrei"),
_("Nadejda Pancheva-Arnaudova"),
NULL
};
const char * translators_array[] =
{
_("Nikita Zlobin"),
_("Alexandre Prokoudine"),
_("Olivier Humbert"),
_("Frank Kober"),
_("Maxim Kachur"),
_("Jof Thibaut"),
NULL,
};
char * translators;
char * license;
struct stat st;
char timestamp_str[26];
@ -79,6 +102,12 @@ void show_about(void)
gtk_about_dialog_set_authors(GTK_ABOUT_DIALOG(dialog), authors);
gtk_about_dialog_set_artists(GTK_ABOUT_DIALOG(dialog), artists);
translators = catdup_array(translators_array, "\n");
if (translators != NULL)
{
gtk_about_dialog_set_translator_credits(GTK_ABOUT_DIALOG(dialog), translators);
}
gtk_widget_show(dialog);
gtk_dialog_run(GTK_DIALOG(dialog));
gtk_widget_hide(dialog);