Translating some more

This commit is contained in:
Pierre Pronchery 2010-04-05 14:31:00 +00:00
parent ad6332eb1c
commit 27455d3902
9 changed files with 650 additions and 98 deletions

View File

@ -1,6 +1,11 @@
../src/browser.c ../src/browser.c
../src/callbacks.c ../src/callbacks.c
../src/common.c ../src/common.c
../src/copy.c
../src/delete.c
../src/desktop.c ../src/desktop.c
../src/main.c ../src/main.c
../src/move.c
../src/open.c
../src/properties.c ../src/properties.c
../src/view.c

166
po/de.po
View File

@ -163,27 +163,27 @@ msgstr "List _Ordner zuerst"
msgid "Show _hidden files" msgid "Show _hidden files"
msgstr "" msgstr ""
#: ../src/callbacks.c:462 #: ../src/callbacks.c:462 ../src/view.c:496
msgid "About Browser" msgid "About Browser"
msgstr "Info zu Browser" msgstr "Info zu Browser"
#: ../src/callbacks.c:473 #: ../src/callbacks.c:473 ../src/view.c:507
msgid "C_redits" msgid "C_redits"
msgstr "_Mitwirkende" msgstr "_Mitwirkende"
#: ../src/callbacks.c:477 #: ../src/callbacks.c:477 ../src/view.c:511
msgid "_License" msgid "_License"
msgstr "_Lizenz" msgstr "_Lizenz"
#: ../src/callbacks.c:526 #: ../src/callbacks.c:526 ../src/view.c:560
msgid "Credits" msgid "Credits"
msgstr "Mitwirkende" msgstr "Mitwirkende"
#: ../src/callbacks.c:549 #: ../src/callbacks.c:549 ../src/view.c:583
msgid "Written by" msgid "Written by"
msgstr "Programm von" msgstr "Programm von"
#: ../src/callbacks.c:578 #: ../src/callbacks.c:578 ../src/view.c:612
msgid "License" msgid "License"
msgstr "Lizenz" msgstr "Lizenz"
@ -235,6 +235,103 @@ msgstr ""
msgid "Destination: " msgid "Destination: "
msgstr "" msgstr ""
#: ../src/copy.c:114
msgid "Copy file(s)"
msgstr ""
#: ../src/copy.c:123
msgid "Copying: "
msgstr ""
#: ../src/copy.c:141
msgid "Filename: "
msgstr ""
#: ../src/copy.c:155
msgid "Speed: "
msgstr ""
#: ../src/copy.c:188 ../src/delete.c:112 ../src/move.c:115
#, c-format
msgid "File %u of %u"
msgstr ""
#: ../src/copy.c:217
msgid "Information"
msgstr ""
#: ../src/copy.c:229 ../src/move.c:144
#, c-format
msgid ""
"%s will be overwritten\n"
"Proceed?"
msgstr ""
#: ../src/copy.c:339
msgid "Omitting directory"
msgstr ""
#: ../src/copy.c:595
msgid "kB"
msgstr ""
#: ../src/copy.c:604
msgid "0.0 kB/s"
msgstr ""
#: ../src/copy.c:673
msgid ""
"Usage: copy [-fip] source_file target_file\n"
" copy [-fip] source_file ... target\n"
" copy -R [-H | -L | -P][-fip] source_file ... target\n"
" copy -r [-H | -L | -P][-fip] source_file ... target\n"
" -f\tDo not prompt for confirmation if the destination path exists\n"
" -i\tPrompt for confirmation if the destination path exists\n"
" -p\tDuplicate characteristics of the source files\n"
" -R\tCopy file hierarchies\n"
" -r\tCopy file hierarchies\n"
msgstr ""
#: ../src/delete.c:84
msgid "Delete file(s)"
msgstr ""
#: ../src/delete.c:109
#, c-format
msgid "Deleting file: %s"
msgstr ""
#: ../src/delete.c:197 ../src/delete.c:200 ../src/delete.c:220
#: ../src/delete.c:224 ../src/move.c:146
msgid "Question"
msgstr ""
#: ../src/delete.c:199
#, c-format
msgid ""
"%s is a directory.\n"
"Recursively delete?"
msgstr ""
#: ../src/delete.c:201 ../src/delete.c:225
msgid "Yes to all"
msgstr ""
#: ../src/delete.c:222
msgid ""
" will be permanently deleted.\n"
"Continue?"
msgstr ""
#: ../src/delete.c:279
msgid ""
"Usage: delete [-fiRr] file...\n"
" -f\tDo not prompt for confirmation or output error messages\n"
" -i\tPrompt for confirmation\n"
" -R\tRemove file hierarchies\n"
" -r\tEquivalent to -R\n"
msgstr ""
#: ../src/desktop.c:248 #: ../src/desktop.c:248
msgid "Home" msgid "Home"
msgstr "Persönlicher Ordner" msgstr "Persönlicher Ordner"
@ -266,6 +363,33 @@ msgstr ""
msgid "Usage: browser [directory...]\n" msgid "Usage: browser [directory...]\n"
msgstr "Usage: browser [Ordner...]\n" msgstr "Usage: browser [Ordner...]\n"
#: ../src/move.c:87
msgid "Move file(s)"
msgstr ""
#: ../src/move.c:112
#, c-format
msgid "Moving file: %s"
msgstr ""
#: ../src/move.c:432
msgid ""
"Usage: move [-fi] file...\n"
" -f\tDo not prompt for confirmation if the destination path exists\n"
" -i\tPrompt for confirmation if the destination path exists\n"
msgstr ""
#: ../src/open.c:59
msgid ": Could not perform action \""
msgstr ""
#: ../src/open.c:71
msgid ""
"Usage: open [-m mime type][-a action] file...\n"
" -m\tMIME type to force (default: auto-detected)\n"
" -a\taction to call (default: \"open\")\n"
msgstr ""
#: ../src/properties.c:225 #: ../src/properties.c:225
msgid "Properties of " msgid "Properties of "
msgstr "Eigenschaften von " msgstr "Eigenschaften von "
@ -336,4 +460,32 @@ msgstr ""
#: ../src/properties.c:500 #: ../src/properties.c:500
msgid "Usage: properties file...\n" msgid "Usage: properties file...\n"
msgstr "Usage: properties [Ordner...]\n" msgstr ""
#: ../src/view.c:184
msgid "Unknown file type"
msgstr ""
#: ../src/view.c:190
msgid "View - "
msgstr ""
#: ../src/view.c:218
msgid "Unable to view file type"
msgstr ""
#: ../src/view.c:315
msgid "View file..."
msgstr ""
#: ../src/view.c:396 ../src/view.c:653
msgid "Could not edit file"
msgstr ""
#: ../src/view.c:466
msgid "View"
msgstr ""
#: ../src/view.c:667
msgid "Usage: view file...\n"
msgstr ""

164
po/es.po
View File

@ -163,27 +163,27 @@ msgstr ""
msgid "Show _hidden files" msgid "Show _hidden files"
msgstr "" msgstr ""
#: ../src/callbacks.c:462 #: ../src/callbacks.c:462 ../src/view.c:496
msgid "About Browser" msgid "About Browser"
msgstr "Acerca de Browser" msgstr "Acerca de Browser"
#: ../src/callbacks.c:473 #: ../src/callbacks.c:473 ../src/view.c:507
msgid "C_redits" msgid "C_redits"
msgstr "C_réditos" msgstr "C_réditos"
#: ../src/callbacks.c:477 #: ../src/callbacks.c:477 ../src/view.c:511
msgid "_License" msgid "_License"
msgstr "_Licencia" msgstr "_Licencia"
#: ../src/callbacks.c:526 #: ../src/callbacks.c:526 ../src/view.c:560
msgid "Credits" msgid "Credits"
msgstr "Créditos" msgstr "Créditos"
#: ../src/callbacks.c:549 #: ../src/callbacks.c:549 ../src/view.c:583
msgid "Written by" msgid "Written by"
msgstr "Escrito por" msgstr "Escrito por"
#: ../src/callbacks.c:578 #: ../src/callbacks.c:578 ../src/view.c:612
msgid "License" msgid "License"
msgstr "Licencia" msgstr "Licencia"
@ -235,6 +235,103 @@ msgstr ""
msgid "Destination: " msgid "Destination: "
msgstr "" msgstr ""
#: ../src/copy.c:114
msgid "Copy file(s)"
msgstr ""
#: ../src/copy.c:123
msgid "Copying: "
msgstr ""
#: ../src/copy.c:141
msgid "Filename: "
msgstr ""
#: ../src/copy.c:155
msgid "Speed: "
msgstr ""
#: ../src/copy.c:188 ../src/delete.c:112 ../src/move.c:115
#, c-format
msgid "File %u of %u"
msgstr ""
#: ../src/copy.c:217
msgid "Information"
msgstr ""
#: ../src/copy.c:229 ../src/move.c:144
#, c-format
msgid ""
"%s will be overwritten\n"
"Proceed?"
msgstr ""
#: ../src/copy.c:339
msgid "Omitting directory"
msgstr ""
#: ../src/copy.c:595
msgid "kB"
msgstr ""
#: ../src/copy.c:604
msgid "0.0 kB/s"
msgstr ""
#: ../src/copy.c:673
msgid ""
"Usage: copy [-fip] source_file target_file\n"
" copy [-fip] source_file ... target\n"
" copy -R [-H | -L | -P][-fip] source_file ... target\n"
" copy -r [-H | -L | -P][-fip] source_file ... target\n"
" -f\tDo not prompt for confirmation if the destination path exists\n"
" -i\tPrompt for confirmation if the destination path exists\n"
" -p\tDuplicate characteristics of the source files\n"
" -R\tCopy file hierarchies\n"
" -r\tCopy file hierarchies\n"
msgstr ""
#: ../src/delete.c:84
msgid "Delete file(s)"
msgstr ""
#: ../src/delete.c:109
#, c-format
msgid "Deleting file: %s"
msgstr ""
#: ../src/delete.c:197 ../src/delete.c:200 ../src/delete.c:220
#: ../src/delete.c:224 ../src/move.c:146
msgid "Question"
msgstr ""
#: ../src/delete.c:199
#, c-format
msgid ""
"%s is a directory.\n"
"Recursively delete?"
msgstr ""
#: ../src/delete.c:201 ../src/delete.c:225
msgid "Yes to all"
msgstr ""
#: ../src/delete.c:222
msgid ""
" will be permanently deleted.\n"
"Continue?"
msgstr ""
#: ../src/delete.c:279
msgid ""
"Usage: delete [-fiRr] file...\n"
" -f\tDo not prompt for confirmation or output error messages\n"
" -i\tPrompt for confirmation\n"
" -R\tRemove file hierarchies\n"
" -r\tEquivalent to -R\n"
msgstr ""
#: ../src/desktop.c:248 #: ../src/desktop.c:248
msgid "Home" msgid "Home"
msgstr "Inicio" msgstr "Inicio"
@ -266,6 +363,33 @@ msgstr ""
msgid "Usage: browser [directory...]\n" msgid "Usage: browser [directory...]\n"
msgstr "" msgstr ""
#: ../src/move.c:87
msgid "Move file(s)"
msgstr ""
#: ../src/move.c:112
#, c-format
msgid "Moving file: %s"
msgstr ""
#: ../src/move.c:432
msgid ""
"Usage: move [-fi] file...\n"
" -f\tDo not prompt for confirmation if the destination path exists\n"
" -i\tPrompt for confirmation if the destination path exists\n"
msgstr ""
#: ../src/open.c:59
msgid ": Could not perform action \""
msgstr ""
#: ../src/open.c:71
msgid ""
"Usage: open [-m mime type][-a action] file...\n"
" -m\tMIME type to force (default: auto-detected)\n"
" -a\taction to call (default: \"open\")\n"
msgstr ""
#: ../src/properties.c:225 #: ../src/properties.c:225
msgid "Properties of " msgid "Properties of "
msgstr "Propriedades con " msgstr "Propriedades con "
@ -337,3 +461,31 @@ msgstr ""
#: ../src/properties.c:500 #: ../src/properties.c:500
msgid "Usage: properties file...\n" msgid "Usage: properties file...\n"
msgstr "" msgstr ""
#: ../src/view.c:184
msgid "Unknown file type"
msgstr ""
#: ../src/view.c:190
msgid "View - "
msgstr ""
#: ../src/view.c:218
msgid "Unable to view file type"
msgstr ""
#: ../src/view.c:315
msgid "View file..."
msgstr ""
#: ../src/view.c:396 ../src/view.c:653
msgid "Could not edit file"
msgstr ""
#: ../src/view.c:466
msgid "View"
msgstr ""
#: ../src/view.c:667
msgid "Usage: view file...\n"
msgstr ""

168
po/fr.po
View File

@ -161,29 +161,29 @@ msgstr "Lister les _dossiers en premier"
#: ../src/callbacks.c:289 #: ../src/callbacks.c:289
msgid "Show _hidden files" msgid "Show _hidden files"
msgstr "Afficher les fichiers cachés" msgstr "Afficher les fichiers cac_hés"
#: ../src/callbacks.c:462 #: ../src/callbacks.c:462 ../src/view.c:496
msgid "About Browser" msgid "About Browser"
msgstr "À propos de Browser" msgstr "À propos de Browser"
#: ../src/callbacks.c:473 #: ../src/callbacks.c:473 ../src/view.c:507
msgid "C_redits" msgid "C_redits"
msgstr "C_rédits" msgstr "C_rédits"
#: ../src/callbacks.c:477 #: ../src/callbacks.c:477 ../src/view.c:511
msgid "_License" msgid "_License"
msgstr "_Licence" msgstr "_Licence"
#: ../src/callbacks.c:526 #: ../src/callbacks.c:526 ../src/view.c:560
msgid "Credits" msgid "Credits"
msgstr "Crédits" msgstr "Crédits"
#: ../src/callbacks.c:549 #: ../src/callbacks.c:549 ../src/view.c:583
msgid "Written by" msgid "Written by"
msgstr "Écrit par" msgstr "Écrit par"
#: ../src/callbacks.c:578 #: ../src/callbacks.c:578 ../src/view.c:612
msgid "License" msgid "License"
msgstr "Licence" msgstr "Licence"
@ -235,13 +235,110 @@ msgstr "Nouveau lien symbolique"
msgid "Destination: " msgid "Destination: "
msgstr "Destination: " msgstr "Destination: "
#: ../src/copy.c:114
msgid "Copy file(s)"
msgstr "Copie de fichier(s)"
#: ../src/copy.c:123
msgid "Copying: "
msgstr "Copie: "
#: ../src/copy.c:141
msgid "Filename: "
msgstr "Nom de fichier: "
#: ../src/copy.c:155
msgid "Speed: "
msgstr "Débit: "
#: ../src/copy.c:188 ../src/delete.c:112 ../src/move.c:115
#, c-format
msgid "File %u of %u"
msgstr "Fichier %u de %u"
#: ../src/copy.c:217
msgid "Information"
msgstr "Information"
#: ../src/copy.c:229 ../src/move.c:144
#, c-format
msgid ""
"%s will be overwritten\n"
"Proceed?"
msgstr ""
#: ../src/copy.c:339
msgid "Omitting directory"
msgstr "Dossier non traité"
#: ../src/copy.c:595
msgid "kB"
msgstr "Ko"
#: ../src/copy.c:604
msgid "0.0 kB/s"
msgstr "0.0 Ko/s"
#: ../src/copy.c:673
msgid ""
"Usage: copy [-fip] source_file target_file\n"
" copy [-fip] source_file ... target\n"
" copy -R [-H | -L | -P][-fip] source_file ... target\n"
" copy -r [-H | -L | -P][-fip] source_file ... target\n"
" -f\tDo not prompt for confirmation if the destination path exists\n"
" -i\tPrompt for confirmation if the destination path exists\n"
" -p\tDuplicate characteristics of the source files\n"
" -R\tCopy file hierarchies\n"
" -r\tCopy file hierarchies\n"
msgstr ""
#: ../src/delete.c:84
msgid "Delete file(s)"
msgstr "Effacement du fichier(s)"
#: ../src/delete.c:109
#, c-format
msgid "Deleting file: %s"
msgstr "Effacement du fichier: %s"
#: ../src/delete.c:197 ../src/delete.c:200 ../src/delete.c:220
#: ../src/delete.c:224 ../src/move.c:146
msgid "Question"
msgstr "Question"
#: ../src/delete.c:199
#, c-format
msgid ""
"%s is a directory.\n"
"Recursively delete?"
msgstr ""
#: ../src/delete.c:201 ../src/delete.c:225
msgid "Yes to all"
msgstr "Toujours"
#: ../src/delete.c:222
msgid ""
" will be permanently deleted.\n"
"Continue?"
msgstr ""
#: ../src/delete.c:279
msgid ""
"Usage: delete [-fiRr] file...\n"
" -f\tDo not prompt for confirmation or output error messages\n"
" -i\tPrompt for confirmation\n"
" -R\tRemove file hierarchies\n"
" -r\tEquivalent to -R\n"
msgstr ""
#: ../src/desktop.c:248 #: ../src/desktop.c:248
msgid "Home" msgid "Home"
msgstr "Dossier personnel" msgstr "Dossier personnel"
#: ../src/desktop.c:494 #: ../src/desktop.c:494
msgid "Desktop preferences" msgid "Desktop preferences"
msgstr "" msgstr "Préférences du bureau"
#: ../src/desktop.c:506 #: ../src/desktop.c:506
msgid "Background: " msgid "Background: "
@ -266,6 +363,33 @@ msgstr ""
msgid "Usage: browser [directory...]\n" msgid "Usage: browser [directory...]\n"
msgstr "Usage: browser [dossier...]\n" msgstr "Usage: browser [dossier...]\n"
#: ../src/move.c:87
msgid "Move file(s)"
msgstr "Déplacer des fichier(s)"
#: ../src/move.c:112
#, c-format
msgid "Moving file: %s"
msgstr "Déplacement du fichier: %s"
#: ../src/move.c:432
msgid ""
"Usage: move [-fi] file...\n"
" -f\tDo not prompt for confirmation if the destination path exists\n"
" -i\tPrompt for confirmation if the destination path exists\n"
msgstr ""
#: ../src/open.c:59
msgid ": Could not perform action \""
msgstr ""
#: ../src/open.c:71
msgid ""
"Usage: open [-m mime type][-a action] file...\n"
" -m\tMIME type to force (default: auto-detected)\n"
" -a\taction to call (default: \"open\")\n"
msgstr ""
#: ../src/properties.c:225 #: ../src/properties.c:225
msgid "Properties of " msgid "Properties of "
msgstr "Propriétés de " msgstr "Propriétés de "
@ -337,3 +461,31 @@ msgstr "exécution"
#: ../src/properties.c:500 #: ../src/properties.c:500
msgid "Usage: properties file...\n" msgid "Usage: properties file...\n"
msgstr "Usage: properties fichier...\n" msgstr "Usage: properties fichier...\n"
#: ../src/view.c:184
msgid "Unknown file type"
msgstr ""
#: ../src/view.c:190
msgid "View - "
msgstr ""
#: ../src/view.c:218
msgid "Unable to view file type"
msgstr ""
#: ../src/view.c:315
msgid "View file..."
msgstr "Ouvrir..."
#: ../src/view.c:396 ../src/view.c:653
msgid "Could not edit file"
msgstr ""
#: ../src/view.c:466
msgid "View"
msgstr ""
#: ../src/view.c:667
msgid "Usage: view file...\n"
msgstr "Usage: view fichier...\n"

View File

@ -1,5 +1,5 @@
/* $Id$ */ /* $Id$ */
/* Copyright (c) 2009 Pierre Pronchery <khorben@defora.org> */ /* Copyright (c) 2010 Pierre Pronchery <khorben@defora.org> */
/* This file is part of DeforaOS Desktop Browser */ /* This file is part of DeforaOS Desktop Browser */
/* This program is free software: you can redistribute it and/or modify /* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@ -27,9 +27,26 @@
#include <string.h> #include <string.h>
#include <libgen.h> #include <libgen.h>
#include <errno.h> #include <errno.h>
#include <locale.h>
#include <libintl.h>
#include <gtk/gtk.h> #include <gtk/gtk.h>
#include "../config.h"
#define _(string) gettext(string)
/* constants */
#ifndef PREFIX
# define PREFIX "/usr/local"
#endif
#ifndef DATADIR
# define DATADIR PREFIX "/share"
#endif
#ifndef LOCALEDIR
# define LOCALEDIR DATADIR "/locale"
#endif
/* Copy */
/* types */ /* types */
typedef int Prefs; typedef int Prefs;
#define PREFS_f 0x01 #define PREFS_f 0x01
@ -40,9 +57,6 @@ typedef int Prefs;
#define PREFS_L 0x20 #define PREFS_L 0x20
#define PREFS_P 0x40 #define PREFS_P 0x40
/* Copy */
/* types */
typedef struct _Copy typedef struct _Copy
{ {
Prefs * prefs; Prefs * prefs;
@ -97,16 +111,16 @@ static int _copy(Prefs * prefs, unsigned int filec, char * filev[])
copy.cur = 0; copy.cur = 0;
/* graphical interface */ /* graphical interface */
copy.window = gtk_window_new(GTK_WINDOW_TOPLEVEL); copy.window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
gtk_window_set_title(GTK_WINDOW(copy.window), "Copy file(s)"); gtk_window_set_title(GTK_WINDOW(copy.window), _("Copy file(s)"));
gtk_window_set_resizable(GTK_WINDOW(copy.window), FALSE); gtk_window_set_resizable(GTK_WINDOW(copy.window), FALSE);
g_signal_connect(G_OBJECT(copy.window), "delete_event", G_CALLBACK( g_signal_connect(G_OBJECT(copy.window), "delete-event", G_CALLBACK(
_copy_on_closex), NULL); _copy_on_closex), NULL);
vbox = gtk_vbox_new(FALSE, 4); vbox = gtk_vbox_new(FALSE, 4);
left = gtk_size_group_new(GTK_SIZE_GROUP_HORIZONTAL); left = gtk_size_group_new(GTK_SIZE_GROUP_HORIZONTAL);
right = gtk_size_group_new(GTK_SIZE_GROUP_HORIZONTAL); right = gtk_size_group_new(GTK_SIZE_GROUP_HORIZONTAL);
/* current argument */ /* current argument */
hbox = gtk_hbox_new(FALSE, 0); hbox = gtk_hbox_new(FALSE, 0);
widget = gtk_label_new("Copying: "); widget = gtk_label_new(_("Copying: "));
bold = pango_font_description_new(); bold = pango_font_description_new();
pango_font_description_set_weight(bold, PANGO_WEIGHT_BOLD); pango_font_description_set_weight(bold, PANGO_WEIGHT_BOLD);
gtk_widget_modify_font(widget, bold); gtk_widget_modify_font(widget, bold);
@ -124,7 +138,7 @@ static int _copy(Prefs * prefs, unsigned int filec, char * filev[])
gtk_box_pack_start(GTK_BOX(vbox), copy.progress, TRUE, TRUE, 4); gtk_box_pack_start(GTK_BOX(vbox), copy.progress, TRUE, TRUE, 4);
/* file copy */ /* file copy */
hbox = gtk_hbox_new(FALSE, 0); hbox = gtk_hbox_new(FALSE, 0);
widget = gtk_label_new("Filename: "); widget = gtk_label_new(_("Filename: "));
gtk_widget_modify_font(widget, bold); gtk_widget_modify_font(widget, bold);
gtk_misc_set_alignment(GTK_MISC(widget), 0, 0); gtk_misc_set_alignment(GTK_MISC(widget), 0, 0);
gtk_size_group_add_widget(left, widget); gtk_size_group_add_widget(left, widget);
@ -138,7 +152,7 @@ static int _copy(Prefs * prefs, unsigned int filec, char * filev[])
gtk_box_pack_start(GTK_BOX(vbox), hbox, TRUE, TRUE, 0); gtk_box_pack_start(GTK_BOX(vbox), hbox, TRUE, TRUE, 0);
/* file copy speed */ /* file copy speed */
hbox = gtk_hbox_new(FALSE, 0); hbox = gtk_hbox_new(FALSE, 0);
widget = gtk_label_new("Speed: "); widget = gtk_label_new(_("Speed: "));
gtk_widget_modify_font(widget, bold); gtk_widget_modify_font(widget, bold);
gtk_misc_set_alignment(GTK_MISC(widget), 0, 0); gtk_misc_set_alignment(GTK_MISC(widget), 0, 0);
gtk_size_group_add_widget(left, widget); gtk_size_group_add_widget(left, widget);
@ -171,7 +185,7 @@ static void _copy_refresh(Copy * copy)
/* FIXME convert to UTF-8 */ /* FIXME convert to UTF-8 */
gtk_label_set_text(GTK_LABEL(copy->label), copy->filev[copy->cur]); gtk_label_set_text(GTK_LABEL(copy->label), copy->filev[copy->cur]);
snprintf(buf, sizeof(buf), "File %u of %u", copy->cur + 1, snprintf(buf, sizeof(buf), _("File %u of %u"), copy->cur + 1,
copy->filec - 1); copy->filec - 1);
fraction = copy->cur; fraction = copy->cur;
fraction /= copy->filec - 1; fraction /= copy->filec - 1;
@ -187,7 +201,7 @@ static int _copy_error(Copy * copy, char const * message, int ret)
dialog = gtk_message_dialog_new(GTK_WINDOW(copy->window), dialog = gtk_message_dialog_new(GTK_WINDOW(copy->window),
GTK_DIALOG_MODAL, GTK_MESSAGE_ERROR, GTK_DIALOG_MODAL, GTK_MESSAGE_ERROR,
GTK_BUTTONS_OK, "%s: %s", message, strerror(errno)); GTK_BUTTONS_OK, "%s: %s", message, strerror(errno));
gtk_window_set_title(GTK_WINDOW(dialog), "Error"); gtk_window_set_title(GTK_WINDOW(dialog), _("Error"));
gtk_dialog_run(GTK_DIALOG(dialog)); gtk_dialog_run(GTK_DIALOG(dialog));
gtk_widget_destroy(dialog); gtk_widget_destroy(dialog);
return ret; return ret;
@ -200,7 +214,7 @@ static void _copy_info(Copy * copy, char const * message, char const * info)
dialog = gtk_message_dialog_new(GTK_WINDOW(copy->window), dialog = gtk_message_dialog_new(GTK_WINDOW(copy->window),
GTK_DIALOG_MODAL, GTK_MESSAGE_INFO, GTK_DIALOG_MODAL, GTK_MESSAGE_INFO,
GTK_BUTTONS_OK, "%s: %s", message, info); GTK_BUTTONS_OK, "%s: %s", message, info);
gtk_window_set_title(GTK_WINDOW(dialog), "Information"); gtk_window_set_title(GTK_WINDOW(dialog), _("Information"));
gtk_dialog_run(GTK_DIALOG(dialog)); gtk_dialog_run(GTK_DIALOG(dialog));
gtk_widget_destroy(dialog); gtk_widget_destroy(dialog);
} }
@ -212,8 +226,8 @@ static int _copy_confirm(Copy * copy, char const * dst)
dialog = gtk_message_dialog_new(GTK_WINDOW(copy->window), dialog = gtk_message_dialog_new(GTK_WINDOW(copy->window),
GTK_DIALOG_MODAL, GTK_MESSAGE_QUESTION, GTK_DIALOG_MODAL, GTK_MESSAGE_QUESTION,
GTK_BUTTONS_YES_NO, "%s will be overwritten\n" GTK_BUTTONS_YES_NO, _("%s will be overwritten\n"
"Proceed?", dst); "Proceed?"), dst);
gtk_window_set_title(GTK_WINDOW(dialog), "Question"); gtk_window_set_title(GTK_WINDOW(dialog), "Question");
ret = gtk_dialog_run(GTK_DIALOG(dialog)); ret = gtk_dialog_run(GTK_DIALOG(dialog));
gtk_widget_destroy(dialog); gtk_widget_destroy(dialog);
@ -322,7 +336,7 @@ static int _single_dir(Copy * copy, char const * src, char const * dst)
{ {
if(*(copy->prefs) & PREFS_R) if(*(copy->prefs) & PREFS_R)
return _single_recurse(copy, src, dst); return _single_recurse(copy, src, dst);
_copy_info(copy, src, "Omitting directory"); _copy_info(copy, src, _("Omitting directory"));
return 0; return 0;
} }
@ -578,7 +592,7 @@ static gboolean _single_timeout(gpointer data)
struct timeval tv; struct timeval tv;
double rate; double rate;
char buf[16]; char buf[16];
char const * unit = "kB"; char const * unit = _("kB");
if(copy->fpulse == 1) if(copy->fpulse == 1)
{ {
@ -587,7 +601,7 @@ static gboolean _single_timeout(gpointer data)
} }
if(copy->cnt == 0) if(copy->cnt == 0)
{ {
gtk_label_set_text(GTK_LABEL(copy->fspeed), "0.0 kB/s"); gtk_label_set_text(GTK_LABEL(copy->fspeed), _("0.0 kB/s"));
return TRUE; return TRUE;
} }
if(gettimeofday(&tv, NULL) != 0) if(gettimeofday(&tv, NULL) != 0)
@ -656,7 +670,7 @@ static int _copy_multiple(Copy * copy, char const * src, char const * dst)
/* usage */ /* usage */
static int _usage(void) static int _usage(void)
{ {
fputs("Usage: copy [-fip] source_file target_file\n\ fputs(_("Usage: copy [-fip] source_file target_file\n\
copy [-fip] source_file ... target\n\ copy [-fip] source_file ... target\n\
copy -R [-H | -L | -P][-fip] source_file ... target\n\ copy -R [-H | -L | -P][-fip] source_file ... target\n\
copy -r [-H | -L | -P][-fip] source_file ... target\n\ copy -r [-H | -L | -P][-fip] source_file ... target\n\
@ -664,7 +678,7 @@ static int _usage(void)
-i Prompt for confirmation if the destination path exists\n\ -i Prompt for confirmation if the destination path exists\n\
-p Duplicate characteristics of the source files\n\ -p Duplicate characteristics of the source files\n\
-R Copy file hierarchies\n\ -R Copy file hierarchies\n\
-r Copy file hierarchies\n", stderr); -r Copy file hierarchies\n"), stderr);
return 1; return 1;
} }
@ -675,6 +689,9 @@ int main(int argc, char * argv[])
Prefs prefs; Prefs prefs;
int o; int o;
setlocale(LC_ALL, "");
bindtextdomain(PACKAGE, LOCALEDIR);
textdomain(PACKAGE);
memset(&prefs, 0, sizeof(prefs)); memset(&prefs, 0, sizeof(prefs));
prefs |= PREFS_i | PREFS_H; prefs |= PREFS_i | PREFS_H;
gtk_init(&argc, &argv); gtk_init(&argc, &argv);

View File

@ -1,5 +1,5 @@
/* $Id$ */ /* $Id$ */
/* Copyright (c) 2008 Pierre Pronchery <khorben@defora.org> */ /* Copyright (c) 2010 Pierre Pronchery <khorben@defora.org> */
/* This file is part of DeforaOS Desktop Browser */ /* This file is part of DeforaOS Desktop Browser */
/* This program is free software: you can redistribute it and/or modify /* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@ -22,18 +22,32 @@
#include <stdio.h> #include <stdio.h>
#include <string.h> #include <string.h>
#include <errno.h> #include <errno.h>
#include <locale.h>
#include <libintl.h>
#include <gtk/gtk.h> #include <gtk/gtk.h>
#include "../config.h"
#define _(string) gettext(string)
/* constants */
#ifndef PREFIX
# define PREFIX "/usr/local"
#endif
#ifndef DATADIR
# define DATADIR PREFIX "/share"
#endif
#ifndef LOCALEDIR
# define LOCALEDIR DATADIR "/locale"
#endif
/* Delete */
/* types */ /* types */
typedef int Prefs; typedef int Prefs;
#define PREFS_f 0x1 #define PREFS_f 0x1
#define PREFS_i 0x2 #define PREFS_i 0x2
#define PREFS_R 0x4 #define PREFS_R 0x4
/* Delete */
/* types */
typedef struct _Delete typedef struct _Delete
{ {
Prefs * prefs; Prefs * prefs;
@ -67,8 +81,8 @@ static int _delete(Prefs * prefs, unsigned int filec, char * filev[])
delete.filev = filev; delete.filev = filev;
delete.cur = 0; delete.cur = 0;
delete.window = gtk_window_new(GTK_WINDOW_TOPLEVEL); delete.window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
gtk_window_set_title(GTK_WINDOW(delete.window), "Delete file(s)"); gtk_window_set_title(GTK_WINDOW(delete.window), _("Delete file(s)"));
g_signal_connect(G_OBJECT(delete.window), "delete_event", G_CALLBACK( g_signal_connect(G_OBJECT(delete.window), "delete-event", G_CALLBACK(
_delete_on_closex), NULL); _delete_on_closex), NULL);
vbox = gtk_vbox_new(FALSE, 4); vbox = gtk_vbox_new(FALSE, 4);
delete.label = gtk_label_new(""); delete.label = gtk_label_new("");
@ -92,10 +106,11 @@ static void _delete_refresh(Delete * delete)
char buf[256]; char buf[256];
double fraction; double fraction;
snprintf(buf, sizeof(buf), "Deleting file: %s", snprintf(buf, sizeof(buf), _("Deleting file: %s"),
delete->filev[delete->cur]); delete->filev[delete->cur]);
gtk_label_set_text(GTK_LABEL(delete->label), buf); gtk_label_set_text(GTK_LABEL(delete->label), buf);
snprintf(buf, sizeof(buf), "File %u of %u", delete->cur, delete->filec); snprintf(buf, sizeof(buf), _("File %u of %u"), delete->cur,
delete->filec);
fraction = delete->cur; fraction = delete->cur;
fraction /= delete->filec; fraction /= delete->filec;
gtk_progress_bar_set_text(GTK_PROGRESS_BAR(delete->progress), buf); gtk_progress_bar_set_text(GTK_PROGRESS_BAR(delete->progress), buf);
@ -109,10 +124,10 @@ static int _delete_error(Delete * delete, char const * message, int ret)
dialog = gtk_message_dialog_new(GTK_WINDOW(delete->window), dialog = gtk_message_dialog_new(GTK_WINDOW(delete->window),
GTK_DIALOG_MODAL, GTK_MESSAGE_ERROR, GTK_DIALOG_MODAL, GTK_MESSAGE_ERROR,
GTK_BUTTONS_OK, "%s", "Error"); GTK_BUTTONS_OK, "%s", _("Error"));
gtk_message_dialog_format_secondary_text(GTK_MESSAGE_DIALOG(dialog), gtk_message_dialog_format_secondary_text(GTK_MESSAGE_DIALOG(dialog),
"%s: %s", message, strerror(errno)); "%s: %s", message, strerror(errno));
gtk_window_set_title(GTK_WINDOW(dialog), "Error"); gtk_window_set_title(GTK_WINDOW(dialog), _("Error"));
gtk_dialog_run(GTK_DIALOG(dialog)); gtk_dialog_run(GTK_DIALOG(dialog));
gtk_widget_destroy(dialog); gtk_widget_destroy(dialog);
return ret; return ret;
@ -179,11 +194,11 @@ static int _idle_ask_recursive(Delete * delete, char const * filename)
dialog = gtk_message_dialog_new(GTK_WINDOW(delete->window), dialog = gtk_message_dialog_new(GTK_WINDOW(delete->window),
GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT, GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT,
GTK_MESSAGE_QUESTION, GTK_BUTTONS_YES_NO, "%s", GTK_MESSAGE_QUESTION, GTK_BUTTONS_YES_NO, "%s",
"Question"); _("Question"));
gtk_message_dialog_format_secondary_text(GTK_MESSAGE_DIALOG(dialog), gtk_message_dialog_format_secondary_text(GTK_MESSAGE_DIALOG(dialog),
"%s is a directory.\nRecursively delete?", filename); _("%s is a directory.\nRecursively delete?"), filename);
gtk_window_set_title(GTK_WINDOW(dialog), "Question"); gtk_window_set_title(GTK_WINDOW(dialog), _("Question"));
gtk_dialog_add_button(GTK_DIALOG(dialog), "Yes to all", 1); gtk_dialog_add_button(GTK_DIALOG(dialog), _("Yes to all"), 1);
ret = gtk_dialog_run(GTK_DIALOG(dialog)); ret = gtk_dialog_run(GTK_DIALOG(dialog));
gtk_widget_destroy(dialog); gtk_widget_destroy(dialog);
if(ret == 1) if(ret == 1)
@ -202,12 +217,12 @@ static int _idle_ask(Delete * delete, char const * filename)
dialog = gtk_message_dialog_new(GTK_WINDOW(delete->window), dialog = gtk_message_dialog_new(GTK_WINDOW(delete->window),
GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT, GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT,
GTK_MESSAGE_QUESTION, GTK_BUTTONS_YES_NO, "%s", GTK_MESSAGE_QUESTION, GTK_BUTTONS_YES_NO, "%s",
"Question"); _("Question"));
gtk_message_dialog_format_secondary_text(GTK_MESSAGE_DIALOG(dialog), gtk_message_dialog_format_secondary_text(GTK_MESSAGE_DIALOG(dialog),
"%s%s", filename, " will be permanently deleted.\n" "%s%s", filename, _(" will be permanently deleted.\n"
"Continue?"); "Continue?"));
gtk_window_set_title(GTK_WINDOW(dialog), "Question"); gtk_window_set_title(GTK_WINDOW(dialog), _("Question"));
gtk_dialog_add_button(GTK_DIALOG(dialog), "Yes to all", 1); gtk_dialog_add_button(GTK_DIALOG(dialog), _("Yes to all"), 1);
ret = gtk_dialog_run(GTK_DIALOG(dialog)); ret = gtk_dialog_run(GTK_DIALOG(dialog));
gtk_widget_destroy(dialog); gtk_widget_destroy(dialog);
if(ret == 1) if(ret == 1)
@ -261,11 +276,11 @@ static int _idle_do_recursive(Delete * delete, char const * filename)
/* usage */ /* usage */
static int _usage(void) static int _usage(void)
{ {
fputs("Usage: delete [-fiRr] file...\n\ fputs(_("Usage: delete [-fiRr] file...\n\
-f Do not prompt for confirmation or output error messages\n\ -f Do not prompt for confirmation or output error messages\n\
-i Prompt for confirmation\n\ -i Prompt for confirmation\n\
-R Remove file hierarchies\n\ -R Remove file hierarchies\n\
-r Equivalent to -R\n", stderr); -r Equivalent to -R\n"), stderr);
return 1; return 1;
} }
@ -276,6 +291,9 @@ int main(int argc, char * argv[])
Prefs prefs; Prefs prefs;
int o; int o;
setlocale(LC_ALL, "");
bindtextdomain(PACKAGE, LOCALEDIR);
textdomain(PACKAGE);
memset(&prefs, 0, sizeof(prefs)); memset(&prefs, 0, sizeof(prefs));
gtk_init(&argc, &argv); gtk_init(&argc, &argv);
while((o = getopt(argc, argv, "fiRr")) != -1) while((o = getopt(argc, argv, "fiRr")) != -1)

View File

@ -1,5 +1,5 @@
/* $Id$ */ /* $Id$ */
/* Copyright (c) 2008 Pierre Pronchery <khorben@defora.org> */ /* Copyright (c) 2010 Pierre Pronchery <khorben@defora.org> */
/* This file is part of DeforaOS Desktop Browser */ /* This file is part of DeforaOS Desktop Browser */
/* This program is free software: you can redistribute it and/or modify /* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@ -26,17 +26,31 @@
#include <libgen.h> #include <libgen.h>
#include <limits.h> #include <limits.h>
#include <errno.h> #include <errno.h>
#include <locale.h>
#include <libintl.h>
#include <gtk/gtk.h> #include <gtk/gtk.h>
#include "../config.h"
#define _(string) gettext(string)
/* constants */
#ifndef PREFIX
# define PREFIX "/usr/local"
#endif
#ifndef DATADIR
# define DATADIR PREFIX "/share"
#endif
#ifndef LOCALEDIR
# define LOCALEDIR DATADIR "/locale"
#endif
/* Move */
/* types */ /* types */
typedef int Prefs; typedef int Prefs;
#define PREFS_f 0x1 #define PREFS_f 0x1
#define PREFS_i 0x2 #define PREFS_i 0x2
/* Move */
/* types */
typedef struct _Move typedef struct _Move
{ {
Prefs * prefs; Prefs * prefs;
@ -70,8 +84,8 @@ static int _move(Prefs * prefs, unsigned int filec, char * filev[])
move.filev = filev; move.filev = filev;
move.cur = 0; move.cur = 0;
move.window = gtk_window_new(GTK_WINDOW_TOPLEVEL); move.window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
gtk_window_set_title(GTK_WINDOW(move.window), "Move file(s)"); gtk_window_set_title(GTK_WINDOW(move.window), _("Move file(s)"));
g_signal_connect(G_OBJECT(move.window), "delete_event", G_CALLBACK( g_signal_connect(G_OBJECT(move.window), "delete-event", G_CALLBACK(
_move_on_closex), NULL); _move_on_closex), NULL);
vbox = gtk_vbox_new(FALSE, 4); vbox = gtk_vbox_new(FALSE, 4);
move.label = gtk_label_new(""); move.label = gtk_label_new("");
@ -95,9 +109,11 @@ static void _move_refresh(Move * move)
char buf[256]; /* FIXME convert to UTF-8 */ char buf[256]; /* FIXME convert to UTF-8 */
double fraction; double fraction;
snprintf(buf, sizeof(buf), "Moving file: %s", move->filev[move->cur]); snprintf(buf, sizeof(buf), _("Moving file: %s"),
move->filev[move->cur]);
gtk_label_set_text(GTK_LABEL(move->label), buf); gtk_label_set_text(GTK_LABEL(move->label), buf);
snprintf(buf, sizeof(buf), "File %u of %u", move->cur, move->filec - 1); snprintf(buf, sizeof(buf), _("File %u of %u"), move->cur,
move->filec - 1);
fraction = move->cur; fraction = move->cur;
fraction /= move->filec - 1; fraction /= move->filec - 1;
gtk_progress_bar_set_text(GTK_PROGRESS_BAR(move->progress), buf); gtk_progress_bar_set_text(GTK_PROGRESS_BAR(move->progress), buf);
@ -112,7 +128,7 @@ static int _move_error(Move * move, char const * message, int ret)
dialog = gtk_message_dialog_new(GTK_WINDOW(move->window), dialog = gtk_message_dialog_new(GTK_WINDOW(move->window),
GTK_DIALOG_MODAL, GTK_MESSAGE_ERROR, GTK_DIALOG_MODAL, GTK_MESSAGE_ERROR,
GTK_BUTTONS_OK, "%s: %s", message, strerror(errno)); GTK_BUTTONS_OK, "%s: %s", message, strerror(errno));
gtk_window_set_title(GTK_WINDOW(dialog), "Error"); gtk_window_set_title(GTK_WINDOW(dialog), _("Error"));
gtk_dialog_run(GTK_DIALOG(dialog)); gtk_dialog_run(GTK_DIALOG(dialog));
gtk_widget_destroy(dialog); gtk_widget_destroy(dialog);
return ret; return ret;
@ -125,9 +141,9 @@ static int _move_confirm(Move * move, char const * dst)
dialog = gtk_message_dialog_new(GTK_WINDOW(move->window), dialog = gtk_message_dialog_new(GTK_WINDOW(move->window),
GTK_DIALOG_MODAL, GTK_MESSAGE_QUESTION, GTK_DIALOG_MODAL, GTK_MESSAGE_QUESTION,
GTK_BUTTONS_YES_NO, "%s will be overwritten\n" GTK_BUTTONS_YES_NO, _("%s will be overwritten\n"
"Proceed?", dst); "Proceed?"), dst);
gtk_window_set_title(GTK_WINDOW(dialog), "Question"); gtk_window_set_title(GTK_WINDOW(dialog), _("Question"));
ret = gtk_dialog_run(GTK_DIALOG(dialog)); ret = gtk_dialog_run(GTK_DIALOG(dialog));
gtk_widget_destroy(dialog); gtk_widget_destroy(dialog);
return ret == GTK_RESPONSE_YES ? 1 : 0; return ret == GTK_RESPONSE_YES ? 1 : 0;
@ -413,9 +429,9 @@ static int _move_multiple(Move * move, char const * src, char const * dst)
/* usage */ /* usage */
static int _usage(void) static int _usage(void)
{ {
fputs("Usage: move [-fi] file...\n\ fputs(_("Usage: move [-fi] file...\n\
-f Do not prompt for confirmation if the destination path exists\n\ -f Do not prompt for confirmation if the destination path exists\n\
-i Prompt for confirmation if the destination path exists\n", stderr); -i Prompt for confirmation if the destination path exists\n"), stderr);
return 1; return 1;
} }
@ -426,6 +442,9 @@ int main(int argc, char * argv[])
Prefs prefs; Prefs prefs;
int o; int o;
setlocale(LC_ALL, "");
bindtextdomain(PACKAGE, LOCALEDIR);
textdomain(PACKAGE);
memset(&prefs, 0, sizeof(prefs)); memset(&prefs, 0, sizeof(prefs));
gtk_init(&argc, &argv); gtk_init(&argc, &argv);
while((o = getopt(argc, argv, "fi")) != -1) while((o = getopt(argc, argv, "fi")) != -1)

View File

@ -1,5 +1,5 @@
/* $Id$ */ /* $Id$ */
/* Copyright (c) 2008 Pierre Pronchery <khorben@defora.org> */ /* Copyright (c) 2010 Pierre Pronchery <khorben@defora.org> */
/* This file is part of DeforaOS Desktop Browser */ /* This file is part of DeforaOS Desktop Browser */
/* This program is free software: you can redistribute it and/or modify /* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@ -17,7 +17,23 @@
#include <unistd.h> #include <unistd.h>
#include <stdio.h> #include <stdio.h>
#include <locale.h>
#include <libintl.h>
#include "mime.h" #include "mime.h"
#include "../config.h"
#define _(string) gettext(string)
/* constants */
#ifndef PREFIX
# define PREFIX "/usr/local"
#endif
#ifndef DATADIR
# define DATADIR PREFIX "/share"
#endif
#ifndef LOCALEDIR
# define LOCALEDIR DATADIR "/locale"
#endif
/* open */ /* open */
@ -39,8 +55,9 @@ static int _open(char const * type, char const * action, int filec,
} }
else if(mime_action_type(mime, action, filev[i], type) == 0) else if(mime_action_type(mime, action, filev[i], type) == 0)
continue; continue;
fprintf(stderr, "%s%s%s%s%s", "open: ", filev[i], ": Could not" fprintf(stderr, "%s%s%s%s%s", "open: ", filev[i],
" perform action \"", action, "\"\n"); _(": Could not perform action \""), action,
"\"\n");
ret = 1; ret = 1;
} }
mime_delete(mime); mime_delete(mime);
@ -51,9 +68,9 @@ static int _open(char const * type, char const * action, int filec,
/* usage */ /* usage */
static int _usage(void) static int _usage(void)
{ {
fprintf(stderr, "%s", "Usage: open [-m mime type][-a action] file...\n" fputs(_("Usage: open [-m mime type][-a action] file...\n"
" -m MIME type to force (default: auto-detected)\n" " -m MIME type to force (default: auto-detected)\n"
" -a action to call (default: \"open\")\n"); " -a action to call (default: \"open\")\n"), stderr);
return 1; return 1;
} }
@ -65,6 +82,9 @@ int main(int argc, char * argv[])
char const * action = "open"; char const * action = "open";
char const * type = NULL; char const * type = NULL;
setlocale(LC_ALL, "");
bindtextdomain(PACKAGE, LOCALEDIR);
textdomain(PACKAGE);
while((o = getopt(argc, argv, "a:m:")) != -1) while((o = getopt(argc, argv, "a:m:")) != -1)
switch(o) switch(o)
{ {

View File

@ -1,6 +1,6 @@
/* $Id$ */ /* $Id$ */
static char const _copyright[] = static char const _copyright[] =
"Copyright (c) 2009 Pierre Pronchery <khorben@defora.org>"; "Copyright (c) 2010 Pierre Pronchery <khorben@defora.org>";
/* This file is part of DeforaOS Desktop Browser */ /* This file is part of DeforaOS Desktop Browser */
static char const _license[] = static char const _license[] =
"view is free software; you can redistribute it and/or modify it under the\n" "view is free software; you can redistribute it and/or modify it under the\n"
@ -23,6 +23,8 @@ static char const _license[] =
#include <stdio.h> #include <stdio.h>
#include <string.h> #include <string.h>
#include <errno.h> #include <errno.h>
#include <locale.h>
#include <libintl.h>
#include <gtk/gtk.h> #include <gtk/gtk.h>
#include <gdk/gdkkeysyms.h> #include <gdk/gdkkeysyms.h>
#include <Desktop.h> #include <Desktop.h>
@ -32,6 +34,18 @@ static char const _license[] =
#include "common.c" #include "common.c"
/* constants */
#ifndef PREFIX
# define PREFIX "/usr/local"
#endif
#ifndef DATADIR
# define DATADIR PREFIX "/share"
#endif
#ifndef LOCALEDIR
# define LOCALEDIR DATADIR "/locale"
#endif
/* View */ /* View */
/* private */ /* private */
/* types */ /* types */
@ -167,13 +181,13 @@ static View * _view_new(char const * pathname)
_mime = mime_new(); _mime = mime_new();
if((type = mime_type(_mime, pathname)) == NULL) if((type = mime_type(_mime, pathname)) == NULL)
{ {
_view_error(view, "Unknown file type", 2); _view_error(view, _("Unknown file type"), 2);
return NULL; return NULL;
} }
group = gtk_accel_group_new(); group = gtk_accel_group_new();
view->window = gtk_window_new(GTK_WINDOW_TOPLEVEL); view->window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
gtk_window_add_accel_group(GTK_WINDOW(view->window), group); gtk_window_add_accel_group(GTK_WINDOW(view->window), group);
snprintf(buf, sizeof(buf), "%s%s", "View - ", pathname); snprintf(buf, sizeof(buf), "%s%s", _("View - "), pathname);
gtk_window_set_title(GTK_WINDOW(view->window), buf); gtk_window_set_title(GTK_WINDOW(view->window), buf);
g_signal_connect_swapped(view->window, "delete-event", G_CALLBACK( g_signal_connect_swapped(view->window, "delete-event", G_CALLBACK(
_on_closex), view); _on_closex), view);
@ -201,7 +215,7 @@ static View * _view_new(char const * pathname)
} }
else else
{ {
_view_error(view, "Unable to view file type", 2); _view_error(view, _("Unable to view file type"), 2);
return NULL; return NULL;
} }
gtk_box_pack_start(GTK_BOX(vbox), widget, TRUE, TRUE, 0); gtk_box_pack_start(GTK_BOX(vbox), widget, TRUE, TRUE, 0);
@ -298,7 +312,7 @@ static View * _view_new_open(void)
GtkWidget * dialog; GtkWidget * dialog;
char * pathname = NULL; char * pathname = NULL;
dialog = gtk_file_chooser_dialog_new("View file...", NULL, dialog = gtk_file_chooser_dialog_new(_("View file..."), NULL,
GTK_FILE_CHOOSER_ACTION_OPEN, GTK_STOCK_CANCEL, GTK_FILE_CHOOSER_ACTION_OPEN, GTK_STOCK_CANCEL,
GTK_RESPONSE_CANCEL, GTK_STOCK_OPEN, GTK_RESPONSE_CANCEL, GTK_STOCK_OPEN,
GTK_RESPONSE_ACCEPT, NULL); GTK_RESPONSE_ACCEPT, NULL);
@ -340,10 +354,10 @@ static int _view_error(View * view, char const * message, int ret)
dialog = gtk_message_dialog_new(view != NULL && view->window != NULL dialog = gtk_message_dialog_new(view != NULL && view->window != NULL
? GTK_WINDOW(view->window) : NULL, ? GTK_WINDOW(view->window) : NULL,
GTK_DIALOG_DESTROY_WITH_PARENT, GTK_MESSAGE_ERROR, GTK_DIALOG_DESTROY_WITH_PARENT, GTK_MESSAGE_ERROR,
GTK_BUTTONS_CLOSE, "%s", "Error"); GTK_BUTTONS_CLOSE, "%s", _("Error"));
gtk_message_dialog_format_secondary_text(GTK_MESSAGE_DIALOG(dialog), gtk_message_dialog_format_secondary_text(GTK_MESSAGE_DIALOG(dialog),
"%s", message); "%s", message);
gtk_window_set_title(GTK_WINDOW(dialog), "Error"); gtk_window_set_title(GTK_WINDOW(dialog), _("Error"));
g_signal_connect(G_OBJECT(dialog), "response", G_CALLBACK( g_signal_connect(G_OBJECT(dialog), "response", G_CALLBACK(
_error_response), ret != 0 ? view : NULL); _error_response), ret != 0 ? view : NULL);
gtk_widget_show(dialog); gtk_widget_show(dialog);
@ -379,7 +393,7 @@ static void _on_file_edit(gpointer data)
View * view = data; View * view = data;
if(mime_action(_mime, "edit", view->pathname) != 0) if(mime_action(_mime, "edit", view->pathname) != 0)
_view_error(view, "Could not edit file", 0); _view_error(view, _("Could not edit file"), 0);
} }
@ -391,7 +405,7 @@ static void _on_file_open_with(gpointer data)
char * filename = NULL; char * filename = NULL;
pid_t pid; pid_t pid;
dialog = gtk_file_chooser_dialog_new("Open with...", dialog = gtk_file_chooser_dialog_new(_("Open with..."),
GTK_WINDOW(view->window), GTK_WINDOW(view->window),
GTK_FILE_CHOOSER_ACTION_OPEN, GTK_STOCK_CANCEL, GTK_FILE_CHOOSER_ACTION_OPEN, GTK_STOCK_CANCEL,
GTK_RESPONSE_CANCEL, GTK_STOCK_OPEN, GTK_RESPONSE_CANCEL, GTK_STOCK_OPEN,
@ -449,7 +463,7 @@ static void _on_help_about(gpointer data)
window = view->ab_window; window = view->ab_window;
gtk_window_set_transient_for(GTK_WINDOW(window), GTK_WINDOW( gtk_window_set_transient_for(GTK_WINDOW(window), GTK_WINDOW(
view->window)); view->window));
gtk_about_dialog_set_name(GTK_ABOUT_DIALOG(window), "View"); gtk_about_dialog_set_name(GTK_ABOUT_DIALOG(window), _("View"));
gtk_about_dialog_set_version(GTK_ABOUT_DIALOG(window), VERSION); gtk_about_dialog_set_version(GTK_ABOUT_DIALOG(window), VERSION);
gtk_about_dialog_set_copyright(GTK_ABOUT_DIALOG(window), _copyright); gtk_about_dialog_set_copyright(GTK_ABOUT_DIALOG(window), _copyright);
gtk_about_dialog_set_authors(GTK_ABOUT_DIALOG(window), _view_authors); gtk_about_dialog_set_authors(GTK_ABOUT_DIALOG(window), _view_authors);
@ -479,7 +493,7 @@ static void _on_help_about(gpointer data)
browser->ab_window = gtk_window_new(GTK_WINDOW_TOPLEVEL); browser->ab_window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
window = browser->ab_window; window = browser->ab_window;
gtk_container_set_border_width(GTK_CONTAINER(window), 4); gtk_container_set_border_width(GTK_CONTAINER(window), 4);
gtk_window_set_title(GTK_WINDOW(window), "About Browser"); gtk_window_set_title(GTK_WINDOW(window), _("About Browser"));
gtk_window_set_transient_for(GTK_WINDOW(window), GTK_WINDOW( gtk_window_set_transient_for(GTK_WINDOW(window), GTK_WINDOW(
browser->window)); browser->window));
g_signal_connect(G_OBJECT(window), "delete-event", G_CALLBACK( g_signal_connect(G_OBJECT(window), "delete-event", G_CALLBACK(
@ -490,11 +504,11 @@ static void _on_help_about(gpointer data)
gtk_box_pack_start(GTK_BOX(vbox), gtk_label_new(_copyright), FALSE, gtk_box_pack_start(GTK_BOX(vbox), gtk_label_new(_copyright), FALSE,
FALSE, 2); FALSE, 2);
hbox = gtk_hbox_new(TRUE, 4); hbox = gtk_hbox_new(TRUE, 4);
button = gtk_button_new_with_mnemonic("C_redits"); button = gtk_button_new_with_mnemonic(_("C_redits"));
g_signal_connect(G_OBJECT(button), "clicked", G_CALLBACK( g_signal_connect(G_OBJECT(button), "clicked", G_CALLBACK(
_about_on_credits), window); _about_on_credits), window);
gtk_box_pack_start(GTK_BOX(hbox), button, FALSE, TRUE, 4); gtk_box_pack_start(GTK_BOX(hbox), button, FALSE, TRUE, 4);
button = gtk_button_new_with_mnemonic("_License"); button = gtk_button_new_with_mnemonic(_("_License"));
g_signal_connect(G_OBJECT(button), "clicked", G_CALLBACK( g_signal_connect(G_OBJECT(button), "clicked", G_CALLBACK(
_about_on_license), window); _about_on_license), window);
gtk_box_pack_start(GTK_BOX(hbox), button, FALSE, TRUE, 4); gtk_box_pack_start(GTK_BOX(hbox), button, FALSE, TRUE, 4);
@ -543,7 +557,7 @@ static void _about_on_credits(GtkWidget * widget, gpointer data)
window = gtk_window_new(GTK_WINDOW_TOPLEVEL); window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
gtk_window_set_default_size(GTK_WINDOW(window), 200, 200); gtk_window_set_default_size(GTK_WINDOW(window), 200, 200);
gtk_container_set_border_width(GTK_CONTAINER(window), 4); gtk_container_set_border_width(GTK_CONTAINER(window), 4);
gtk_window_set_title(GTK_WINDOW(window), "Credits"); gtk_window_set_title(GTK_WINDOW(window), _("Credits"));
gtk_window_set_transient_for(GTK_WINDOW(window), GTK_WINDOW(about)); gtk_window_set_transient_for(GTK_WINDOW(window), GTK_WINDOW(about));
g_signal_connect(G_OBJECT(window), "delete-event", G_CALLBACK( g_signal_connect(G_OBJECT(window), "delete-event", G_CALLBACK(
_about_on_closex), NULL); _about_on_closex), NULL);
@ -566,7 +580,7 @@ static void _about_on_credits(GtkWidget * widget, gpointer data)
gtk_container_add(GTK_CONTAINER(widget), textview); gtk_container_add(GTK_CONTAINER(widget), textview);
notebook = gtk_notebook_new(); notebook = gtk_notebook_new();
gtk_notebook_append_page(GTK_NOTEBOOK(notebook), widget, gtk_notebook_append_page(GTK_NOTEBOOK(notebook), widget,
gtk_label_new("Written by")); gtk_label_new(_("Written by")));
gtk_box_pack_start(GTK_BOX(vbox), notebook, TRUE, TRUE, 4); gtk_box_pack_start(GTK_BOX(vbox), notebook, TRUE, TRUE, 4);
hbox = gtk_hbox_new(FALSE, 0); hbox = gtk_hbox_new(FALSE, 0);
widget = gtk_button_new_from_stock(GTK_STOCK_CLOSE); widget = gtk_button_new_from_stock(GTK_STOCK_CLOSE);
@ -595,7 +609,7 @@ static void _about_on_license(GtkWidget * widget, gpointer data)
window = gtk_window_new(GTK_WINDOW_TOPLEVEL); window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
gtk_window_set_default_size(GTK_WINDOW(window), 200, 200); gtk_window_set_default_size(GTK_WINDOW(window), 200, 200);
gtk_container_set_border_width(GTK_CONTAINER(window), 4); gtk_container_set_border_width(GTK_CONTAINER(window), 4);
gtk_window_set_title(GTK_WINDOW(window), "License"); gtk_window_set_title(GTK_WINDOW(window), _("License"));
gtk_window_set_transient_for(GTK_WINDOW(window), GTK_WINDOW(about)); gtk_window_set_transient_for(GTK_WINDOW(window), GTK_WINDOW(about));
g_signal_connect(G_OBJECT(window), "delete-event", G_CALLBACK( g_signal_connect(G_OBJECT(window), "delete-event", G_CALLBACK(
_about_on_closex), NULL); _about_on_closex), NULL);
@ -636,7 +650,7 @@ static void _on_edit(gpointer data)
View * view = data; View * view = data;
if(mime_action(_mime, "edit", view->pathname) != 0) if(mime_action(_mime, "edit", view->pathname) != 0)
_view_error(view, "Could not edit file", 0); _view_error(view, _("Could not edit file"), 0);
} }
@ -650,7 +664,7 @@ static void _on_open_with(gpointer data)
/* usage */ /* usage */
static int _usage(void) static int _usage(void)
{ {
fputs("Usage: view file...\n", stderr); fputs(_("Usage: view file...\n"), stderr);
return 1; return 1;
} }
@ -661,6 +675,9 @@ int main(int argc, char * argv[])
int o; int o;
int i; int i;
setlocale(LC_ALL, "");
bindtextdomain(PACKAGE, LOCALEDIR);
textdomain(PACKAGE);
gtk_init(&argc, &argv); gtk_init(&argc, &argv);
while((o = getopt(argc, argv, "")) != -1) while((o = getopt(argc, argv, "")) != -1)
switch(o) switch(o)