From 27455d3902a3dda4d94480845dfaedaecc6a7ccb Mon Sep 17 00:00:00 2001 From: Pierre Pronchery Date: Mon, 5 Apr 2010 14:31:00 +0000 Subject: [PATCH] Translating some more --- po/POTFILES | 5 ++ po/de.po | 166 +++++++++++++++++++++++++++++++++++++++++++++++--- po/es.po | 164 +++++++++++++++++++++++++++++++++++++++++++++++-- po/fr.po | 168 ++++++++++++++++++++++++++++++++++++++++++++++++--- src/copy.c | 55 +++++++++++------ src/delete.c | 60 +++++++++++------- src/move.c | 47 +++++++++----- src/open.c | 30 +++++++-- src/view.c | 53 ++++++++++------ 9 files changed, 650 insertions(+), 98 deletions(-) diff --git a/po/POTFILES b/po/POTFILES index 0fd09dd..2cc1c1d 100644 --- a/po/POTFILES +++ b/po/POTFILES @@ -1,6 +1,11 @@ ../src/browser.c ../src/callbacks.c ../src/common.c +../src/copy.c +../src/delete.c ../src/desktop.c ../src/main.c +../src/move.c +../src/open.c ../src/properties.c +../src/view.c diff --git a/po/de.po b/po/de.po index 77ad9cd..e85cdd7 100644 --- a/po/de.po +++ b/po/de.po @@ -163,27 +163,27 @@ msgstr "List _Ordner zuerst" msgid "Show _hidden files" msgstr "" -#: ../src/callbacks.c:462 +#: ../src/callbacks.c:462 ../src/view.c:496 msgid "About Browser" msgstr "Info zu Browser" -#: ../src/callbacks.c:473 +#: ../src/callbacks.c:473 ../src/view.c:507 msgid "C_redits" msgstr "_Mitwirkende" -#: ../src/callbacks.c:477 +#: ../src/callbacks.c:477 ../src/view.c:511 msgid "_License" msgstr "_Lizenz" -#: ../src/callbacks.c:526 +#: ../src/callbacks.c:526 ../src/view.c:560 msgid "Credits" msgstr "Mitwirkende" -#: ../src/callbacks.c:549 +#: ../src/callbacks.c:549 ../src/view.c:583 msgid "Written by" msgstr "Programm von" -#: ../src/callbacks.c:578 +#: ../src/callbacks.c:578 ../src/view.c:612 msgid "License" msgstr "Lizenz" @@ -235,6 +235,103 @@ msgstr "" msgid "Destination: " 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 msgid "Home" msgstr "Persönlicher Ordner" @@ -266,6 +363,33 @@ msgstr "" msgid "Usage: browser [directory...]\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 msgid "Properties of " msgstr "Eigenschaften von " @@ -336,4 +460,32 @@ msgstr "" #: ../src/properties.c:500 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 "" diff --git a/po/es.po b/po/es.po index d73be8e..8c29222 100644 --- a/po/es.po +++ b/po/es.po @@ -163,27 +163,27 @@ msgstr "" msgid "Show _hidden files" msgstr "" -#: ../src/callbacks.c:462 +#: ../src/callbacks.c:462 ../src/view.c:496 msgid "About Browser" msgstr "Acerca de Browser" -#: ../src/callbacks.c:473 +#: ../src/callbacks.c:473 ../src/view.c:507 msgid "C_redits" msgstr "C_réditos" -#: ../src/callbacks.c:477 +#: ../src/callbacks.c:477 ../src/view.c:511 msgid "_License" msgstr "_Licencia" -#: ../src/callbacks.c:526 +#: ../src/callbacks.c:526 ../src/view.c:560 msgid "Credits" msgstr "Créditos" -#: ../src/callbacks.c:549 +#: ../src/callbacks.c:549 ../src/view.c:583 msgid "Written by" msgstr "Escrito por" -#: ../src/callbacks.c:578 +#: ../src/callbacks.c:578 ../src/view.c:612 msgid "License" msgstr "Licencia" @@ -235,6 +235,103 @@ msgstr "" msgid "Destination: " 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 msgid "Home" msgstr "Inicio" @@ -266,6 +363,33 @@ msgstr "" msgid "Usage: browser [directory...]\n" 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 msgid "Properties of " msgstr "Propriedades con " @@ -337,3 +461,31 @@ msgstr "" #: ../src/properties.c:500 msgid "Usage: properties file...\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 "" diff --git a/po/fr.po b/po/fr.po index 717ca8f..09c1a93 100644 --- a/po/fr.po +++ b/po/fr.po @@ -161,29 +161,29 @@ msgstr "Lister les _dossiers en premier" #: ../src/callbacks.c:289 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" msgstr "À propos de Browser" -#: ../src/callbacks.c:473 +#: ../src/callbacks.c:473 ../src/view.c:507 msgid "C_redits" msgstr "C_rédits" -#: ../src/callbacks.c:477 +#: ../src/callbacks.c:477 ../src/view.c:511 msgid "_License" msgstr "_Licence" -#: ../src/callbacks.c:526 +#: ../src/callbacks.c:526 ../src/view.c:560 msgid "Credits" msgstr "Crédits" -#: ../src/callbacks.c:549 +#: ../src/callbacks.c:549 ../src/view.c:583 msgid "Written by" msgstr "Écrit par" -#: ../src/callbacks.c:578 +#: ../src/callbacks.c:578 ../src/view.c:612 msgid "License" msgstr "Licence" @@ -235,13 +235,110 @@ msgstr "Nouveau lien symbolique" msgid "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 msgid "Home" msgstr "Dossier personnel" #: ../src/desktop.c:494 msgid "Desktop preferences" -msgstr "" +msgstr "Préférences du bureau" #: ../src/desktop.c:506 msgid "Background: " @@ -266,6 +363,33 @@ msgstr "" msgid "Usage: browser [directory...]\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 msgid "Properties of " msgstr "Propriétés de " @@ -337,3 +461,31 @@ msgstr "exécution" #: ../src/properties.c:500 msgid "Usage: properties file...\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" diff --git a/src/copy.c b/src/copy.c index e57f285..0dd25a5 100644 --- a/src/copy.c +++ b/src/copy.c @@ -1,5 +1,5 @@ /* $Id$ */ -/* Copyright (c) 2009 Pierre Pronchery */ +/* Copyright (c) 2010 Pierre Pronchery */ /* This file is part of DeforaOS Desktop Browser */ /* 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 @@ -27,9 +27,26 @@ #include #include #include +#include +#include #include +#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 */ typedef int Prefs; #define PREFS_f 0x01 @@ -40,9 +57,6 @@ typedef int Prefs; #define PREFS_L 0x20 #define PREFS_P 0x40 - -/* Copy */ -/* types */ typedef struct _Copy { Prefs * prefs; @@ -97,16 +111,16 @@ static int _copy(Prefs * prefs, unsigned int filec, char * filev[]) copy.cur = 0; /* graphical interface */ 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); - 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); vbox = gtk_vbox_new(FALSE, 4); left = gtk_size_group_new(GTK_SIZE_GROUP_HORIZONTAL); right = gtk_size_group_new(GTK_SIZE_GROUP_HORIZONTAL); /* current argument */ hbox = gtk_hbox_new(FALSE, 0); - widget = gtk_label_new("Copying: "); + widget = gtk_label_new(_("Copying: ")); bold = pango_font_description_new(); pango_font_description_set_weight(bold, PANGO_WEIGHT_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); /* file copy */ hbox = gtk_hbox_new(FALSE, 0); - widget = gtk_label_new("Filename: "); + widget = gtk_label_new(_("Filename: ")); gtk_widget_modify_font(widget, bold); gtk_misc_set_alignment(GTK_MISC(widget), 0, 0); 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); /* file copy speed */ hbox = gtk_hbox_new(FALSE, 0); - widget = gtk_label_new("Speed: "); + widget = gtk_label_new(_("Speed: ")); gtk_widget_modify_font(widget, bold); gtk_misc_set_alignment(GTK_MISC(widget), 0, 0); gtk_size_group_add_widget(left, widget); @@ -171,7 +185,7 @@ static void _copy_refresh(Copy * copy) /* FIXME convert to UTF-8 */ 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); fraction = copy->cur; 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), GTK_DIALOG_MODAL, GTK_MESSAGE_ERROR, 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_widget_destroy(dialog); 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), GTK_DIALOG_MODAL, GTK_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_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), GTK_DIALOG_MODAL, GTK_MESSAGE_QUESTION, - GTK_BUTTONS_YES_NO, "%s will be overwritten\n" - "Proceed?", dst); + GTK_BUTTONS_YES_NO, _("%s will be overwritten\n" + "Proceed?"), dst); gtk_window_set_title(GTK_WINDOW(dialog), "Question"); ret = gtk_dialog_run(GTK_DIALOG(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) return _single_recurse(copy, src, dst); - _copy_info(copy, src, "Omitting directory"); + _copy_info(copy, src, _("Omitting directory")); return 0; } @@ -578,7 +592,7 @@ static gboolean _single_timeout(gpointer data) struct timeval tv; double rate; char buf[16]; - char const * unit = "kB"; + char const * unit = _("kB"); if(copy->fpulse == 1) { @@ -587,7 +601,7 @@ static gboolean _single_timeout(gpointer data) } 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; } if(gettimeofday(&tv, NULL) != 0) @@ -656,7 +670,7 @@ static int _copy_multiple(Copy * copy, char const * src, char const * dst) /* usage */ 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 -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\ -p Duplicate characteristics of the source files\n\ -R Copy file hierarchies\n\ - -r Copy file hierarchies\n", stderr); + -r Copy file hierarchies\n"), stderr); return 1; } @@ -675,6 +689,9 @@ int main(int argc, char * argv[]) Prefs prefs; int o; + setlocale(LC_ALL, ""); + bindtextdomain(PACKAGE, LOCALEDIR); + textdomain(PACKAGE); memset(&prefs, 0, sizeof(prefs)); prefs |= PREFS_i | PREFS_H; gtk_init(&argc, &argv); diff --git a/src/delete.c b/src/delete.c index ea5f636..ae7d808 100644 --- a/src/delete.c +++ b/src/delete.c @@ -1,5 +1,5 @@ /* $Id$ */ -/* Copyright (c) 2008 Pierre Pronchery */ +/* Copyright (c) 2010 Pierre Pronchery */ /* This file is part of DeforaOS Desktop Browser */ /* 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 @@ -22,18 +22,32 @@ #include #include #include +#include +#include #include +#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 */ typedef int Prefs; #define PREFS_f 0x1 #define PREFS_i 0x2 #define PREFS_R 0x4 - -/* Delete */ -/* types */ typedef struct _Delete { Prefs * prefs; @@ -67,8 +81,8 @@ static int _delete(Prefs * prefs, unsigned int filec, char * filev[]) delete.filev = filev; delete.cur = 0; delete.window = gtk_window_new(GTK_WINDOW_TOPLEVEL); - gtk_window_set_title(GTK_WINDOW(delete.window), "Delete file(s)"); - g_signal_connect(G_OBJECT(delete.window), "delete_event", G_CALLBACK( + gtk_window_set_title(GTK_WINDOW(delete.window), _("Delete file(s)")); + g_signal_connect(G_OBJECT(delete.window), "delete-event", G_CALLBACK( _delete_on_closex), NULL); vbox = gtk_vbox_new(FALSE, 4); delete.label = gtk_label_new(""); @@ -92,10 +106,11 @@ static void _delete_refresh(Delete * delete) char buf[256]; double fraction; - snprintf(buf, sizeof(buf), "Deleting file: %s", + snprintf(buf, sizeof(buf), _("Deleting file: %s"), delete->filev[delete->cur]); 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->filec; 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), 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), "%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_widget_destroy(dialog); 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), GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT, GTK_MESSAGE_QUESTION, GTK_BUTTONS_YES_NO, "%s", - "Question"); + _("Question")); gtk_message_dialog_format_secondary_text(GTK_MESSAGE_DIALOG(dialog), - "%s is a directory.\nRecursively delete?", filename); - gtk_window_set_title(GTK_WINDOW(dialog), "Question"); - gtk_dialog_add_button(GTK_DIALOG(dialog), "Yes to all", 1); + _("%s is a directory.\nRecursively delete?"), filename); + gtk_window_set_title(GTK_WINDOW(dialog), _("Question")); + gtk_dialog_add_button(GTK_DIALOG(dialog), _("Yes to all"), 1); ret = gtk_dialog_run(GTK_DIALOG(dialog)); gtk_widget_destroy(dialog); 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), GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT, GTK_MESSAGE_QUESTION, GTK_BUTTONS_YES_NO, "%s", - "Question"); + _("Question")); gtk_message_dialog_format_secondary_text(GTK_MESSAGE_DIALOG(dialog), - "%s%s", filename, " will be permanently deleted.\n" - "Continue?"); - gtk_window_set_title(GTK_WINDOW(dialog), "Question"); - gtk_dialog_add_button(GTK_DIALOG(dialog), "Yes to all", 1); + "%s%s", filename, _(" will be permanently deleted.\n" + "Continue?")); + gtk_window_set_title(GTK_WINDOW(dialog), _("Question")); + gtk_dialog_add_button(GTK_DIALOG(dialog), _("Yes to all"), 1); ret = gtk_dialog_run(GTK_DIALOG(dialog)); gtk_widget_destroy(dialog); if(ret == 1) @@ -261,11 +276,11 @@ static int _idle_do_recursive(Delete * delete, char const * filename) /* usage */ 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\ -i Prompt for confirmation\n\ -R Remove file hierarchies\n\ - -r Equivalent to -R\n", stderr); + -r Equivalent to -R\n"), stderr); return 1; } @@ -276,6 +291,9 @@ int main(int argc, char * argv[]) Prefs prefs; int o; + setlocale(LC_ALL, ""); + bindtextdomain(PACKAGE, LOCALEDIR); + textdomain(PACKAGE); memset(&prefs, 0, sizeof(prefs)); gtk_init(&argc, &argv); while((o = getopt(argc, argv, "fiRr")) != -1) diff --git a/src/move.c b/src/move.c index 8589bd5..8c50c53 100644 --- a/src/move.c +++ b/src/move.c @@ -1,5 +1,5 @@ /* $Id$ */ -/* Copyright (c) 2008 Pierre Pronchery */ +/* Copyright (c) 2010 Pierre Pronchery */ /* This file is part of DeforaOS Desktop Browser */ /* 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 @@ -26,17 +26,31 @@ #include #include #include +#include +#include #include +#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 */ typedef int Prefs; #define PREFS_f 0x1 #define PREFS_i 0x2 - -/* Move */ -/* types */ typedef struct _Move { Prefs * prefs; @@ -70,8 +84,8 @@ static int _move(Prefs * prefs, unsigned int filec, char * filev[]) move.filev = filev; move.cur = 0; move.window = gtk_window_new(GTK_WINDOW_TOPLEVEL); - gtk_window_set_title(GTK_WINDOW(move.window), "Move file(s)"); - g_signal_connect(G_OBJECT(move.window), "delete_event", G_CALLBACK( + gtk_window_set_title(GTK_WINDOW(move.window), _("Move file(s)")); + g_signal_connect(G_OBJECT(move.window), "delete-event", G_CALLBACK( _move_on_closex), NULL); vbox = gtk_vbox_new(FALSE, 4); move.label = gtk_label_new(""); @@ -95,9 +109,11 @@ static void _move_refresh(Move * move) char buf[256]; /* FIXME convert to UTF-8 */ 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); - 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->filec - 1; 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), GTK_DIALOG_MODAL, GTK_MESSAGE_ERROR, 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_widget_destroy(dialog); return ret; @@ -125,9 +141,9 @@ static int _move_confirm(Move * move, char const * dst) dialog = gtk_message_dialog_new(GTK_WINDOW(move->window), GTK_DIALOG_MODAL, GTK_MESSAGE_QUESTION, - GTK_BUTTONS_YES_NO, "%s will be overwritten\n" - "Proceed?", dst); - gtk_window_set_title(GTK_WINDOW(dialog), "Question"); + GTK_BUTTONS_YES_NO, _("%s will be overwritten\n" + "Proceed?"), dst); + gtk_window_set_title(GTK_WINDOW(dialog), _("Question")); ret = gtk_dialog_run(GTK_DIALOG(dialog)); gtk_widget_destroy(dialog); return ret == GTK_RESPONSE_YES ? 1 : 0; @@ -413,9 +429,9 @@ static int _move_multiple(Move * move, char const * src, char const * dst) /* usage */ 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\ - -i Prompt for confirmation if the destination path exists\n", stderr); + -i Prompt for confirmation if the destination path exists\n"), stderr); return 1; } @@ -426,6 +442,9 @@ int main(int argc, char * argv[]) Prefs prefs; int o; + setlocale(LC_ALL, ""); + bindtextdomain(PACKAGE, LOCALEDIR); + textdomain(PACKAGE); memset(&prefs, 0, sizeof(prefs)); gtk_init(&argc, &argv); while((o = getopt(argc, argv, "fi")) != -1) diff --git a/src/open.c b/src/open.c index 724daf6..6a5e402 100644 --- a/src/open.c +++ b/src/open.c @@ -1,5 +1,5 @@ /* $Id$ */ -/* Copyright (c) 2008 Pierre Pronchery */ +/* Copyright (c) 2010 Pierre Pronchery */ /* This file is part of DeforaOS Desktop Browser */ /* 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 @@ -17,7 +17,23 @@ #include #include +#include +#include #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 */ @@ -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) continue; - fprintf(stderr, "%s%s%s%s%s", "open: ", filev[i], ": Could not" - " perform action \"", action, "\"\n"); + fprintf(stderr, "%s%s%s%s%s", "open: ", filev[i], + _(": Could not perform action \""), action, + "\"\n"); ret = 1; } mime_delete(mime); @@ -51,9 +68,9 @@ static int _open(char const * type, char const * action, int filec, /* usage */ 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" -" -a action to call (default: \"open\")\n"); +" -a action to call (default: \"open\")\n"), stderr); return 1; } @@ -65,6 +82,9 @@ int main(int argc, char * argv[]) char const * action = "open"; char const * type = NULL; + setlocale(LC_ALL, ""); + bindtextdomain(PACKAGE, LOCALEDIR); + textdomain(PACKAGE); while((o = getopt(argc, argv, "a:m:")) != -1) switch(o) { diff --git a/src/view.c b/src/view.c index c02595f..061e428 100644 --- a/src/view.c +++ b/src/view.c @@ -1,6 +1,6 @@ /* $Id$ */ static char const _copyright[] = -"Copyright (c) 2009 Pierre Pronchery "; +"Copyright (c) 2010 Pierre Pronchery "; /* This file is part of DeforaOS Desktop Browser */ static char const _license[] = "view is free software; you can redistribute it and/or modify it under the\n" @@ -23,6 +23,8 @@ static char const _license[] = #include #include #include +#include +#include #include #include #include @@ -32,6 +34,18 @@ static char const _license[] = #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 */ /* private */ /* types */ @@ -167,13 +181,13 @@ static View * _view_new(char const * pathname) _mime = mime_new(); if((type = mime_type(_mime, pathname)) == NULL) { - _view_error(view, "Unknown file type", 2); + _view_error(view, _("Unknown file type"), 2); return NULL; } group = gtk_accel_group_new(); view->window = gtk_window_new(GTK_WINDOW_TOPLEVEL); 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); g_signal_connect_swapped(view->window, "delete-event", G_CALLBACK( _on_closex), view); @@ -201,7 +215,7 @@ static View * _view_new(char const * pathname) } else { - _view_error(view, "Unable to view file type", 2); + _view_error(view, _("Unable to view file type"), 2); return NULL; } gtk_box_pack_start(GTK_BOX(vbox), widget, TRUE, TRUE, 0); @@ -298,7 +312,7 @@ static View * _view_new_open(void) GtkWidget * dialog; 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_RESPONSE_CANCEL, GTK_STOCK_OPEN, 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 ? GTK_WINDOW(view->window) : NULL, 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), "%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( _error_response), ret != 0 ? view : NULL); gtk_widget_show(dialog); @@ -379,7 +393,7 @@ static void _on_file_edit(gpointer data) View * view = data; 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; pid_t pid; - dialog = gtk_file_chooser_dialog_new("Open with...", + dialog = gtk_file_chooser_dialog_new(_("Open with..."), GTK_WINDOW(view->window), GTK_FILE_CHOOSER_ACTION_OPEN, GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, GTK_STOCK_OPEN, @@ -449,7 +463,7 @@ static void _on_help_about(gpointer data) window = view->ab_window; gtk_window_set_transient_for(GTK_WINDOW(window), GTK_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_copyright(GTK_ABOUT_DIALOG(window), _copyright); 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); window = browser->ab_window; 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( browser->window)); 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, FALSE, 2); 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( _about_on_credits), window); 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( _about_on_license), window); 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); gtk_window_set_default_size(GTK_WINDOW(window), 200, 200); 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)); g_signal_connect(G_OBJECT(window), "delete-event", G_CALLBACK( _about_on_closex), NULL); @@ -566,7 +580,7 @@ static void _about_on_credits(GtkWidget * widget, gpointer data) gtk_container_add(GTK_CONTAINER(widget), textview); notebook = gtk_notebook_new(); 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); hbox = gtk_hbox_new(FALSE, 0); 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); gtk_window_set_default_size(GTK_WINDOW(window), 200, 200); 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)); g_signal_connect(G_OBJECT(window), "delete-event", G_CALLBACK( _about_on_closex), NULL); @@ -636,7 +650,7 @@ static void _on_edit(gpointer data) View * view = data; 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 */ static int _usage(void) { - fputs("Usage: view file...\n", stderr); + fputs(_("Usage: view file...\n"), stderr); return 1; } @@ -661,6 +675,9 @@ int main(int argc, char * argv[]) int o; int i; + setlocale(LC_ALL, ""); + bindtextdomain(PACKAGE, LOCALEDIR); + textdomain(PACKAGE); gtk_init(&argc, &argv); while((o = getopt(argc, argv, "")) != -1) switch(o)