Also translate the font browser

This commit is contained in:
Pierre Pronchery 2015-10-18 21:57:11 +02:00
parent 692b66b90f
commit 9823bc6794
5 changed files with 67 additions and 4 deletions

View File

@ -1 +1,2 @@
../src/compare.c
../src/fontsel.c

View File

@ -7,7 +7,7 @@ msgid ""
msgstr ""
"Project-Id-Version: Accessories 0.0.3\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2015-10-18 21:40+0200\n"
"POT-Creation-Date: 2015-10-18 21:56+0200\n"
"PO-Revision-Date: 2015-10-18 21:32+0200\n"
"Last-Translator: Pierre Pronchery <khorben@defora.org>\n"
"Language-Team: Spanish\n"
@ -33,3 +33,12 @@ msgstr ""
#: ../src/compare.c:168
msgid "The strings do NOT match"
msgstr ""
#: ../src/fontsel.c:61
msgid "Font browser"
msgstr ""
#: ../src/fontsel.c:97
#, c-format
msgid "Usage: %s\n"
msgstr ""

View File

@ -7,7 +7,7 @@ msgid ""
msgstr ""
"Project-Id-Version: Accessories 0.0.3\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2015-10-18 21:40+0200\n"
"POT-Creation-Date: 2015-10-18 21:56+0200\n"
"PO-Revision-Date: 2015-10-18 21:32+0200\n"
"Last-Translator: Pierre Pronchery <khorben@defora.org>\n"
"Language-Team: French\n"
@ -33,3 +33,12 @@ msgstr "Les chaînes CORRESPONDENT"
#: ../src/compare.c:168
msgid "The strings do NOT match"
msgstr "Les chaînes ne correspondent PAS"
#: ../src/fontsel.c:61
msgid "Font browser"
msgstr "Liste des fontes"
#: ../src/fontsel.c:97
#, c-format
msgid "Usage: %s\n"
msgstr "Usage: %s\n"

View File

@ -17,10 +17,38 @@
#include <unistd.h>
#include <stdio.h>
#include <locale.h>
#include <libintl.h>
#include <gtk/gtk.h>
#include "../config.h"
#define _(string) gettext(string)
/* constants */
#ifndef PROGNAME
# define PROGNAME "fontsel"
#endif
#ifndef PREFIX
# define PREFIX "/usr/local"
#endif
#ifndef DATADIR
# define DATADIR PREFIX "/share"
#endif
#ifndef LOCALEDIR
# define LOCALEDIR DATADIR "/locale"
#endif
/* Fontsel */
/* private */
/* prototypes */
static int _fontsel(void);
static int _error(char const * message, int ret);
static int _usage(void);
/* functions */
/* fontsel */
static gboolean _fontsel_on_closex(gpointer data);
static int _fontsel(void)
@ -30,7 +58,7 @@ static int _fontsel(void)
window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
gtk_container_set_border_width(GTK_CONTAINER(window), 4);
gtk_window_set_title(GTK_WINDOW(window), "Font browser");
gtk_window_set_title(GTK_WINDOW(window), _("Font browser"));
g_signal_connect_swapped(G_OBJECT(window), "delete-event", G_CALLBACK(
_fontsel_on_closex), window);
#if GTK_CHECK_VERSION(3, 2, 0)
@ -54,10 +82,19 @@ static gboolean _fontsel_on_closex(gpointer data)
}
/* error */
static int _error(char const * message, int ret)
{
fputs(PROGNAME ": ", stderr);
perror(message);
return ret;
}
/* usage */
static int _usage(void)
{
fputs("Usage: fontsel\n", stderr);
fprintf(stderr, _("Usage: %s\n"), PROGNAME);
return 1;
}
@ -67,6 +104,10 @@ int main(int argc, char * argv[])
{
int o;
if(setlocale(LC_ALL, "") == NULL)
_error("setlocale", 1);
bindtextdomain(PACKAGE, LOCALEDIR);
textdomain(PACKAGE);
gtk_init(&argc, &argv);
while((o = getopt(argc, argv, "")) != -1)
switch(o)

View File

@ -22,6 +22,9 @@ type=binary
sources=fontsel.c
install=$(BINDIR)
[fontsel.c]
depends=../config.h
[progress]
type=binary
sources=progress.c