From a8f96b32c158c39a71d3cfc306d08b1c00e1ae24 Mon Sep 17 00:00:00 2001 From: Andrea Zagli Date: Fri, 8 May 2015 09:12:53 +0200 Subject: [PATCH] Intltoolized. --- .gitignore | 8 +- Makefile.am | 13 +- configure.ac | 12 ++ data/audit-gui/gui/Makefile.am | 2 +- .../gui/{audit-gui.gui => audit-gui.ui} | 0 po/LINGUAS | 2 + po/POTFILES.in | 6 + po/it.po | 194 ++++++++++++++++++ src/Makefile.am | 1 + src/datasource.c | 18 +- src/datasources.c | 112 +++++----- src/main.c | 19 +- src/openauditds.c | 10 +- src/table.c | 59 +++--- 14 files changed, 363 insertions(+), 93 deletions(-) rename data/audit-gui/gui/{audit-gui.gui => audit-gui.ui} (100%) create mode 100644 po/LINGUAS create mode 100644 po/POTFILES.in create mode 100644 po/it.po diff --git a/.gitignore b/.gitignore index 679b631..b3c7e48 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,7 @@ *.o *~ -*.in +config.h.in +intltool*.in src/audit-gui COPYING INSTALL @@ -21,3 +22,8 @@ src/.deps/ stamp-h1 .anjuta* *.exe +compile +po/Makefile*.in +po/POTFILES +po/*.gmo +po/stamp-it \ No newline at end of file diff --git a/Makefile.am b/Makefile.am index a91794b..7255cc6 100644 --- a/Makefile.am +++ b/Makefile.am @@ -1,4 +1,15 @@ -SUBDIRS = src data +SUBDIRS = po src data + +INTLTOOL_FILES = intltool-extract.in \ + intltool-merge.in \ + intltool-update.in + +DISTCLEANFILES = ... intltool-extract \ + intltool-merge \ + intltool-update \ + po/.intltool-merge-cache + +EXTRA_DIST = $(INTLTOOL_FILES) distclean-local: if test "$(srcdir)" = "."; then :; else \ diff --git a/configure.ac b/configure.ac index 2e268f2..7ca71ff 100644 --- a/configure.ac +++ b/configure.ac @@ -17,6 +17,17 @@ AC_CANONICAL_SYSTEM # Checks for programs. AC_PROG_CC +IT_PROG_INTLTOOL([0.35.0]) + +dnl ****************************** +dnl Translations +dnl ****************************** +GETTEXT_PACKAGE=audit-gui +AC_SUBST(GETTEXT_PACKAGE) +AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE, "$GETTEXT_PACKAGE", + [The prefix for our gettext translation domains.]) +AM_GLIB_GNU_GETTEXT + # Checks for libraries. PKG_CHECK_MODULES(AUDITGUI, [libgda-ui-5.0 >= 5.1.0]) @@ -35,5 +46,6 @@ AC_CONFIG_FILES([ data/Makefile data/audit-gui/Makefile data/audit-gui/gui/Makefile + po/Makefile.in ]) AC_OUTPUT diff --git a/data/audit-gui/gui/Makefile.am b/data/audit-gui/gui/Makefile.am index d1d7be1..9fdc923 100644 --- a/data/audit-gui/gui/Makefile.am +++ b/data/audit-gui/gui/Makefile.am @@ -1,5 +1,5 @@ guidir = $(datadir)/$(PACKAGE)/gui -gui_DATA = audit-gui.gui +gui_DATA = audit-gui.ui EXTRA_DIST = $(gui_DATA) diff --git a/data/audit-gui/gui/audit-gui.gui b/data/audit-gui/gui/audit-gui.ui similarity index 100% rename from data/audit-gui/gui/audit-gui.gui rename to data/audit-gui/gui/audit-gui.ui diff --git a/po/LINGUAS b/po/LINGUAS new file mode 100644 index 0000000..e69ec98 --- /dev/null +++ b/po/LINGUAS @@ -0,0 +1,2 @@ +it + diff --git a/po/POTFILES.in b/po/POTFILES.in new file mode 100644 index 0000000..86da460 --- /dev/null +++ b/po/POTFILES.in @@ -0,0 +1,6 @@ +# List of source files which contain translatable strings. +src/datasource.c +src/datasources.c +src/main.c +src/openauditds.c +src/table.c diff --git a/po/it.po b/po/it.po new file mode 100644 index 0000000..6972b33 --- /dev/null +++ b/po/it.po @@ -0,0 +1,194 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER +# This file is distributed under the same license as the PACKAGE package. +# Andrea Zagli , 2015. +# +msgid "" +msgstr "" +"Project-Id-Version: 0.5.0\n" +"Report-Msgid-Bugs-To: Andrea Zagli \n" +"POT-Creation-Date: 2015-05-05 11:14+0200\n" +"PO-Revision-Date: 2015-05-05 11:14+0200\n" +"Last-Translator: Andrea Zagli \n" +"Language-Team: Italian \n" +"Language: it\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Plural-Forms: nplurals=2; plural=(n != 1);\n" + +#: ../src/datasource.c:121 ../src/openauditds.c:116 ../src/table.c:142 +#, c-format +msgid "Error: %s." +msgstr "Errore: %s." + +#: ../src/datasource.c:225 ../src/table.c:434 +#, c-format +msgid "Record %d doesn't exist." +msgstr "Il record %d non esiste." + +#: ../src/datasource.c:305 ../src/table.c:643 +msgid "Saved with success." +msgstr "Salvataggio eseguito con successo." + +#: ../src/datasource.c:320 ../src/datasources.c:1256 ../src/table.c:658 +#, c-format +msgid "" +"Error on saving.\n" +"\n" +"%s" +msgstr "Errore durante il salvataggio.\n" +"\n" +"%s" + +#: ../src/datasource.c:321 ../src/datasources.c:191 ../src/datasources.c:200 +#: ../src/datasources.c:384 ../src/datasources.c:413 ../src/datasources.c:447 +#: ../src/datasources.c:465 ../src/datasources.c:479 ../src/datasources.c:505 +#: ../src/datasources.c:523 ../src/datasources.c:550 ../src/datasources.c:589 +#: ../src/datasources.c:612 ../src/datasources.c:658 ../src/datasources.c:680 +#: ../src/datasources.c:699 ../src/datasources.c:804 ../src/datasources.c:834 +#: ../src/datasources.c:849 ../src/datasources.c:1257 ../src/table.c:237 +#: ../src/table.c:246 ../src/table.c:366 ../src/table.c:584 ../src/table.c:606 +#: ../src/table.c:632 ../src/table.c:659 ../src/table.c:773 +msgid "No details." +msgstr "Nessun dettaglio." + +#: ../src/datasources.c:190 ../src/datasources.c:199 ../src/table.c:236 +#: ../src/table.c:245 +#, c-format +msgid "" +"Unable to update metastore.\n" +"%s" +msgstr "Impossibile aggiornare il metastore.\n" +"%s" + +#: ../src/datasources.c:304 ../src/table.c:300 +#, c-format +msgid "Unable to update the metastore: %s" +msgstr "Impossibile aggiornare il metastore: %s" + +#: ../src/datasources.c:312 ../src/table.c:308 +msgid "Updating meta store" +msgstr "Aggiornamento del metastore" + +#: ../src/datasources.c:363 +#, c-format +msgid "Adding table «%s»" +msgstr "Aggiunta della tabella «%s»" + +#: ../src/datasources.c:383 ../src/datasources.c:412 ../src/datasources.c:446 +#: ../src/datasources.c:464 ../src/datasources.c:478 ../src/datasources.c:504 +#: ../src/datasources.c:522 ../src/datasources.c:588 ../src/datasources.c:611 +#: ../src/datasources.c:698 ../src/table.c:365 +#, c-format +msgid "" +"Unable to get tables list.\n" +"%s" +msgstr "Impossibile ottenere la lista delle tabelle.\n" +"%s" + +#: ../src/datasources.c:549 +#, c-format +msgid "" +"Unable to get fields list.\n" +"%s" +msgstr "Impossibile ottenere la lista dei campi.\n" +"%s" + +#: ../src/datasources.c:638 ../src/table.c:567 +#, c-format +msgid "Unable to get the primary key: %s." +msgstr "Impossibile ottenere la chiave primaria: %s." + +#: ../src/datasources.c:639 ../src/table.c:301 ../src/table.c:568 +msgid "no details" +msgstr "nessun dettaglio" + +#: ../src/datasources.c:657 ../src/table.c:583 +#, c-format +msgid "Error getting new id field: %s" +msgstr "" + +#: ../src/datasources.c:679 ../src/table.c:605 +#, c-format +msgid "Error saving new field: %s" +msgstr "Errore durante il salvataggio del nuovo campo: %s" + +#: ../src/datasources.c:752 ../src/datasources.c:763 ../src/datasources.c:1045 +msgid "Select a datasource." +msgstr "Seleziona una sorgente dati." + +#: ../src/datasources.c:803 +#, c-format +msgid "" +"Unable to parse sql string.\n" +"%s" +msgstr "Impossibile interpretare la stringa sql.\n" +"%s" + +#: ../src/datasources.c:818 +#, c-format +msgid "Datasource with id «%d» not found." +msgstr "Sorgente dati con id «%d» non trovata." + +#: ../src/datasources.c:833 +#, c-format +msgid "" +"Unable to execute sql.\n" +"%s" +msgstr "Impossibile eseguire l'sql.\n" +"%s" + +#: ../src/datasources.c:848 +#, c-format +msgid "" +"Unable to to open the connection.\n" +"%s" +msgstr "Impossibile aprire una connessione.\n" +"%s" + +#: ../src/datasources.c:1165 ../src/datasources.c:1176 +#: ../src/datasources.c:1270 +msgid "Select a datasource or a table." +msgstr "Selezionare una sorgente dati o una tabella." + +#: ../src/datasources.c:1208 +msgid "Are you sure to want to delete the selected datasource?" +msgstr "Sicuro di voler eliminare la sorgente dati selezionata?" + +#: ../src/datasources.c:1246 +msgid "You must select a datasource or a table." +msgstr "Occorre selezionare una sorgente dati o una tabella." + +#: ../src/main.c:102 +#, c-format +msgid "" +"Unable to connect to the choosen audit db.\n" +"\n" +"%s\n" +"\n" +"%s" +msgstr "Impossibile connettersi al database audit scelto.\n" +"\n" +"%s\n" +"\n" +"%s" + +#: ../src/table.c:478 +msgid "You must select a table." +msgstr "Occorre selezionare una tabella." + +#: ../src/table.c:631 +#, c-format +msgid "Error removing old fields: %s" +msgstr "Errore durante la rimozione dei vecchi campi: %s" + +#: ../src/table.c:772 +#, c-format +msgid "" +"Unable to get fields list.\n" +"\n" +"%s" +msgstr "Impossibile ottenere la lista dei campi.\n" +"\n" +"%s" diff --git a/src/Makefile.am b/src/Makefile.am index 834d082..44a6887 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -1,6 +1,7 @@ guidir = $(datadir)/$(PACKAGE)/gui AM_CPPFLAGS = $(AUDITGUI_CFLAGS) \ + -DLOCALEDIR=\""$(localedir)"\" \ -DGUIDIR=\""$(guidir)"\" LIBS = $(AUDITGUI_LIBS) \ diff --git a/src/datasource.c b/src/datasource.c index 3599d0f..efc9de2 100644 --- a/src/datasource.c +++ b/src/datasource.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2010 Andrea Zagli + * Copyright (C) 2010-2015 Andrea Zagli * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -17,6 +17,12 @@ * */ +#ifdef HAVE_CONFIG_H + #include +#endif + +#include + #include #include @@ -118,7 +124,7 @@ Datasource &error); if (error != NULL) { - g_warning ("Errore: %s.", error->message); + g_warning (_("Error: %s."), error->message); return NULL; } @@ -222,7 +228,7 @@ datasource_load (Datasource *datasource) GTK_DIALOG_DESTROY_WITH_PARENT, GTK_MESSAGE_WARNING, GTK_BUTTONS_OK, - "Record %d doesn't exist.", priv->id); + _("Record %d doesn't exist."), priv->id); gtk_dialog_run (GTK_DIALOG (dialog)); gtk_widget_destroy (dialog); } @@ -302,7 +308,7 @@ datasource_save (Datasource *datasource) GTK_DIALOG_DESTROY_WITH_PARENT, GTK_MESSAGE_INFO, GTK_BUTTONS_OK, - "Saved with success."); + _("Saved with success.")); gtk_dialog_run (GTK_DIALOG (dialog)); gtk_widget_destroy (dialog); } @@ -317,8 +323,8 @@ datasource_save (Datasource *datasource) GTK_DIALOG_DESTROY_WITH_PARENT, GTK_MESSAGE_WARNING, GTK_BUTTONS_OK, - "Error on saving.\n\n%s", - (error != NULL && error->message != NULL ? error->message : "No details.")); + _("Error on saving.\n\n%s"), + (error != NULL && error->message != NULL ? error->message : _("No details."))); gtk_dialog_run (GTK_DIALOG (dialog)); gtk_widget_destroy (dialog); } diff --git a/src/datasources.c b/src/datasources.c index 826eba4..7db6cff 100644 --- a/src/datasources.c +++ b/src/datasources.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2010-2013 Andrea Zagli + * Copyright (C) 2010-2015 Andrea Zagli * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -17,8 +17,14 @@ * */ +#ifdef HAVE_CONFIG_H + #include +#endif + #include +#include + #include #include "datasources.h" @@ -187,8 +193,8 @@ datasources_update_metastore (gpointer data) priv->gdacon = datasources_get_gdaconnection (priv->commons, priv->update_metastore_datasource_id, &error); if (priv->gdacon == NULL || error != NULL) { - priv->error_update_metastore = g_strdup_printf ("Unable to update metastore.\n%s", - (error != NULL && error->message != NULL ? error->message : "No details.")); + priv->error_update_metastore = g_strdup_printf (_("Unable to update metastore.\n%s"), + (error != NULL && error->message != NULL ? error->message : _("No details."))); priv->update_metastore_ended = TRUE; return NULL; } @@ -196,8 +202,8 @@ datasources_update_metastore (gpointer data) error = NULL; if (!gda_connection_update_meta_store (priv->gdacon, &mcontext, &error)) { - priv->error_update_metastore = g_strdup_printf ("Unable to update metastore.\n%s", - (error != NULL && error->message != NULL ? error->message : "No details.")); + priv->error_update_metastore = g_strdup_printf (_("Unable to update metastore.\n%s"), + (error != NULL && error->message != NULL ? error->message : _("No details."))); priv->update_metastore_ended = TRUE; return NULL; } @@ -301,7 +307,7 @@ datasources_add_all_tables (Datasources *datasources) GTK_DIALOG_DESTROY_WITH_PARENT, GTK_MESSAGE_WARNING, GTK_BUTTONS_OK, - "Unable to update the metastore: %s", + _("Unable to update the metastore: %s"), error != NULL && error->message != NULL ? error->message : "no details"); gtk_dialog_run (GTK_DIALOG (dialog)); gtk_widget_destroy (dialog); @@ -309,7 +315,7 @@ datasources_add_all_tables (Datasources *datasources) } gtk_label_set_text (GTK_LABEL (gtk_builder_get_object (priv->commons->gtkbuilder, "label10")), - "Updating meta store"); + _("Updating meta store")); gtk_widget_show_all (dialog); gtk_widget_show_now (dialog); @@ -360,7 +366,7 @@ datasources_add_all_tables (Datasources *datasources) { fract_tot += fract; gtk_label_set_text (GTK_LABEL (gtk_builder_get_object (priv->commons->gtkbuilder, "label10")), - g_strdup_printf ("Adding table «%s»", table_name)); + g_strdup_printf (_("Adding table «%s»"), table_name)); gtk_progress_bar_set_fraction (GTK_PROGRESS_BAR (gtk_builder_get_object (priv->commons->gtkbuilder, "progressbar1")), fract_tot); while (gtk_events_pending ()) gtk_main_iteration (); @@ -380,8 +386,8 @@ datasources_add_all_tables (Datasources *datasources) GTK_DIALOG_DESTROY_WITH_PARENT, GTK_MESSAGE_WARNING, GTK_BUTTONS_OK, - "Unable to get tables list.\n%s", - error != NULL && error->message != NULL ? error->message : "No details."); + _("Unable to get tables list.\n%s"), + error != NULL && error->message != NULL ? error->message : _("No details.")); gtk_dialog_run (GTK_DIALOG (dialog)); gtk_widget_destroy (dialog); break; @@ -409,8 +415,8 @@ datasources_add_all_tables (Datasources *datasources) GTK_DIALOG_DESTROY_WITH_PARENT, GTK_MESSAGE_WARNING, GTK_BUTTONS_OK, - "Unable to get tables list.\n%s", - error != NULL && error->message != NULL ? error->message : "No details."); + _("Unable to get tables list.\n%s"), + error != NULL && error->message != NULL ? error->message : _("No details.")); gtk_dialog_run (GTK_DIALOG (dialog)); gtk_widget_destroy (dialog); break; @@ -443,8 +449,8 @@ datasources_add_all_tables (Datasources *datasources) GTK_DIALOG_DESTROY_WITH_PARENT, GTK_MESSAGE_WARNING, GTK_BUTTONS_OK, - "Unable to get tables list.\n%s", - error != NULL && error->message != NULL ? error->message : "No details."); + _("Unable to get tables list.\n%s"), + error != NULL && error->message != NULL ? error->message : _("No details.")); gtk_dialog_run (GTK_DIALOG (dialog)); gtk_widget_destroy (dialog); break; @@ -461,8 +467,8 @@ datasources_add_all_tables (Datasources *datasources) GTK_DIALOG_DESTROY_WITH_PARENT, GTK_MESSAGE_WARNING, GTK_BUTTONS_OK, - "Unable to get tables list.\n%s", - error != NULL && error->message != NULL ? error->message : "No details."); + _("Unable to get tables list.\n%s"), + error != NULL && error->message != NULL ? error->message : _("No details.")); gtk_dialog_run (GTK_DIALOG (dialog)); gtk_widget_destroy (dialog); break; @@ -475,8 +481,8 @@ datasources_add_all_tables (Datasources *datasources) GTK_DIALOG_DESTROY_WITH_PARENT, GTK_MESSAGE_WARNING, GTK_BUTTONS_OK, - "Unable to get tables list.\n%s", - error != NULL && error->message != NULL ? error->message : "No details."); + _("Unable to get tables list.\n%s"), + error != NULL && error->message != NULL ? error->message : _("No details.")); gtk_dialog_run (GTK_DIALOG (dialog)); gtk_widget_destroy (dialog); break; @@ -501,8 +507,8 @@ datasources_add_all_tables (Datasources *datasources) GTK_DIALOG_DESTROY_WITH_PARENT, GTK_MESSAGE_WARNING, GTK_BUTTONS_OK, - "Unable to get tables list.\n%s", - error != NULL && error->message != NULL ? error->message : "No details."); + _("Unable to get tables list.\n%s"), + error != NULL && error->message != NULL ? error->message : _("No details.")); gtk_dialog_run (GTK_DIALOG (dialog)); gtk_widget_destroy (dialog); break; @@ -519,8 +525,8 @@ datasources_add_all_tables (Datasources *datasources) GTK_DIALOG_DESTROY_WITH_PARENT, GTK_MESSAGE_WARNING, GTK_BUTTONS_OK, - "Unable to get tables list.\n%s", - error != NULL && error->message != NULL ? error->message : "No details."); + _("Unable to get tables list.\n%s"), + error != NULL && error->message != NULL ? error->message : _("No details.")); gtk_dialog_run (GTK_DIALOG (dialog)); gtk_widget_destroy (dialog); break; @@ -546,8 +552,8 @@ datasources_add_all_tables (Datasources *datasources) GTK_DIALOG_DESTROY_WITH_PARENT, GTK_MESSAGE_WARNING, GTK_BUTTONS_OK, - "Unable to get fields list.\n%s", - error != NULL && error->message != NULL ? error->message : "No details."); + _("Unable to get fields list.\n%s"), + error != NULL && error->message != NULL ? error->message : _("No details.")); gtk_dialog_run (GTK_DIALOG (dialog)); gtk_widget_destroy (dialog); break; @@ -585,8 +591,8 @@ datasources_add_all_tables (Datasources *datasources) GTK_DIALOG_DESTROY_WITH_PARENT, GTK_MESSAGE_WARNING, GTK_BUTTONS_OK, - "Unable to get tables list.\n%s", - error != NULL && error->message != NULL ? error->message : "No details."); + _("Unable to get tables list.\n%s"), + error != NULL && error->message != NULL ? error->message : _("No details.")); gtk_dialog_run (GTK_DIALOG (dialog)); gtk_widget_destroy (dialog); break; @@ -608,8 +614,8 @@ datasources_add_all_tables (Datasources *datasources) GTK_DIALOG_DESTROY_WITH_PARENT, GTK_MESSAGE_WARNING, GTK_BUTTONS_OK, - "Unable to get tables list.\n%s", - error != NULL && error->message != NULL ? error->message : "No details."); + _("Unable to get tables list.\n%s"), + error != NULL && error->message != NULL ? error->message : _("No details.")); gtk_dialog_run (GTK_DIALOG (dialog)); gtk_widget_destroy (dialog); break; @@ -635,8 +641,8 @@ datasources_add_all_tables (Datasources *datasources) NULL); if (dm == NULL || error != NULL) { - g_warning ("Unable to get the primary key: %s.", - error != NULL && error->message != NULL ? error->message : "no details"); + g_warning (_("Unable to get the primary key: %s."), + error != NULL && error->message != NULL ? error->message : _("no details")); } is_key = (dm != NULL && gda_data_model_get_n_rows (dm) > 0); @@ -654,8 +660,8 @@ datasources_add_all_tables (Datasources *datasources) } else if (error != NULL) { - g_warning ("Error getting new id field: %s", - error != NULL && error->message != NULL ? error->message : "No details."); + g_warning (_("Error getting new id field: %s"), + error != NULL && error->message != NULL ? error->message : _("No details.")); } id_field++; @@ -676,8 +682,8 @@ datasources_add_all_tables (Datasources *datasources) g_object_unref (stmt); if (error != NULL) { - g_warning ("Error saving new field: %s", - error->message != NULL ? error->message : "No details."); + g_warning (_("Error saving new field: %s"), + error->message != NULL ? error->message : _("No details.")); } ids_fields_saved = g_strconcat (ids_fields_saved, g_strdup_printf ("%d,", id_field), NULL); @@ -695,8 +701,8 @@ datasources_add_all_tables (Datasources *datasources) GTK_DIALOG_DESTROY_WITH_PARENT, GTK_MESSAGE_WARNING, GTK_BUTTONS_OK, - "Unable to get tables list.\n%s", - error != NULL && error->message != NULL ? error->message : "No details."); + _("Unable to get tables list.\n%s"), + error != NULL && error->message != NULL ? error->message : _("No details.")); gtk_dialog_run (GTK_DIALOG (dialog)); gtk_widget_destroy (dialog); return; @@ -749,7 +755,7 @@ datasources_add_all_tables (Datasources *datasources) GTK_DIALOG_DESTROY_WITH_PARENT, GTK_MESSAGE_WARNING, GTK_BUTTONS_OK, - "Select a datasource."); + _("Select a datasource.")); gtk_dialog_run (GTK_DIALOG (dialog)); gtk_widget_destroy (dialog); } @@ -760,7 +766,7 @@ datasources_add_all_tables (Datasources *datasources) GTK_DIALOG_DESTROY_WITH_PARENT, GTK_MESSAGE_WARNING, GTK_BUTTONS_OK, - "Select a datasource."); + _("Select a datasource.")); gtk_dialog_run (GTK_DIALOG (dialog)); gtk_widget_destroy (dialog); } @@ -800,8 +806,8 @@ GdaConnection g_set_error (error, DATASOURCES_GETGDACONNECTION_ERROR, DATASOURCES_GETGDACONNECTION_ERROR_NOT_PARSE, - "Unable to parse sql string.\n%s", - (_error != NULL && _error->message != NULL ? _error->message : "No details.")); + _("Unable to parse sql string.\n%s"), + (_error != NULL && _error->message != NULL ? _error->message : _("No details."))); return NULL; } @@ -815,7 +821,7 @@ GdaConnection g_set_error (error, DATASOURCES_GETGDACONNECTION_ERROR, DATASOURCES_GETGDACONNECTION_ERROR_NOT_FOUND, - "Datasource with id «%d» not found.", + _("Datasource with id «%d» not found."), id); return NULL; } @@ -830,8 +836,8 @@ GdaConnection g_set_error (error, DATASOURCES_GETGDACONNECTION_ERROR, DATASOURCES_GETGDACONNECTION_ERROR_NOT_PARSE, - "Unable to execute sql.\n%s", - (_error != NULL && _error->message != NULL ? _error->message : "No details.")); + _("Unable to execute sql.\n%s"), + (_error != NULL && _error->message != NULL ? _error->message : _("No details."))); return NULL; } @@ -845,8 +851,8 @@ GdaConnection g_set_error (error, DATASOURCES_GETGDACONNECTION_ERROR, DATASOURCES_GETGDACONNECTION_ERROR_NO_CONNECTION, - "Unable to to open the connection.\n%s", - (_error != NULL && _error->message != NULL ? _error->message : "No details.")); + _("Unable to to open the connection.\n%s"), + (_error != NULL && _error->message != NULL ? _error->message : _("No details."))); return NULL; } @@ -1042,7 +1048,7 @@ datasources_edit (Datasources *datasources) GTK_DIALOG_DESTROY_WITH_PARENT, GTK_MESSAGE_WARNING, GTK_BUTTONS_OK, - "Select a datasource."); + _("Select a datasource.")); gtk_dialog_run (GTK_DIALOG (dialog)); gtk_widget_destroy (dialog); } @@ -1162,7 +1168,7 @@ datasources_on_btn_new_table_clicked (GtkButton *button, GTK_DIALOG_DESTROY_WITH_PARENT, GTK_MESSAGE_WARNING, GTK_BUTTONS_OK, - "Select a datasource or a table."); + _("Select a datasource or a table.")); gtk_dialog_run (GTK_DIALOG (dialog)); gtk_widget_destroy (dialog); } @@ -1173,7 +1179,7 @@ datasources_on_btn_new_table_clicked (GtkButton *button, GTK_DIALOG_DESTROY_WITH_PARENT, GTK_MESSAGE_WARNING, GTK_BUTTONS_OK, - "Select a datasource or a table."); + _("Select a datasource or a table.")); gtk_dialog_run (GTK_DIALOG (dialog)); gtk_widget_destroy (dialog); } @@ -1205,7 +1211,7 @@ datasources_on_btn_delete_clicked (GtkButton *button, GTK_DIALOG_DESTROY_WITH_PARENT, GTK_MESSAGE_QUESTION, GTK_BUTTONS_YES_NO, - "Are you sure to want to delete the selected datasource?"); + _("Are you sure to want to delete the selected datasource?")); risp = gtk_dialog_run (GTK_DIALOG (dialog)); if (risp == GTK_RESPONSE_YES) { @@ -1243,7 +1249,7 @@ datasources_on_btn_delete_clicked (GtkButton *button, GTK_DIALOG_DESTROY_WITH_PARENT, GTK_MESSAGE_WARNING, GTK_BUTTONS_OK, - "You must select a datasource or a table."); + _("You must select a datasource or a table.")); return; } @@ -1253,8 +1259,8 @@ datasources_on_btn_delete_clicked (GtkButton *button, GTK_DIALOG_DESTROY_WITH_PARENT, GTK_MESSAGE_WARNING, GTK_BUTTONS_OK, - "Error on saving.\n\n%s", - (error != NULL && error->message != NULL ? error->message : "No details.")); + _("Error on saving.\n\n%s"), + (error != NULL && error->message != NULL ? error->message : _("No details."))); } datasources_load (datasources); @@ -1267,7 +1273,7 @@ datasources_on_btn_delete_clicked (GtkButton *button, GTK_DIALOG_DESTROY_WITH_PARENT, GTK_MESSAGE_WARNING, GTK_BUTTONS_OK, - "Select a datasource or a table."); + _("Select a datasource or a table.")); gtk_dialog_run (GTK_DIALOG (dialog)); gtk_widget_destroy (dialog); } diff --git a/src/main.c b/src/main.c index 3de62ab..535dc96 100644 --- a/src/main.c +++ b/src/main.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2010-2011 Andrea Zagli + * Copyright (C) 2010-2015 Andrea Zagli * * 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,6 +22,8 @@ #include +#include + #include #include @@ -97,7 +99,7 @@ main_on_ds_opened (gpointer instance, const gchar *arg1, gpointer user_data) GTK_DIALOG_DESTROY_WITH_PARENT, GTK_MESSAGE_WARNING, GTK_BUTTONS_OK, - "Unable to connect to the choosen audit db.\n\n%s\n\n%s", + _("Unable to connect to the choosen audit db.\n\n%s\n\n%s"), arg1, (error != NULL && error->message != NULL ? error->message : "No details.")); gtk_dialog_run (GTK_DIALOG (dialog)); @@ -191,6 +193,8 @@ main (int argc, char *argv[]) { GError *error; + gchar *localedir; + gtk_init (&argc, &argv); gda_init (); @@ -210,19 +214,28 @@ main (int argc, char *argv[]) && g_ascii_strcasecmp (p + 1, "src") == 0) { commons->guidir = g_strdup (GUIDIR); + localedir = g_strdup (LOCALEDIR); } else { commons->guidir = g_build_filename (moddir, "share", PACKAGE, "gui", NULL); + localedir = g_build_filename (moddir, "share", "locale", NULL); } #else commons->guidir = g_strdup (GUIDIR); + localedir = g_strdup (LOCALEDIR); #endif - commons->guifile = g_build_filename (commons->guidir, "audit-gui.gui", NULL); + bindtextdomain (GETTEXT_PACKAGE, localedir); + textdomain (GETTEXT_PACKAGE); + bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8"); + + g_free (localedir); + + commons->guifile = g_build_filename (commons->guidir, "audit-gui.ui", NULL); commons->gtkbuilder = gtk_builder_new (); diff --git a/src/openauditds.c b/src/openauditds.c index f3499d5..52e1508 100644 --- a/src/openauditds.c +++ b/src/openauditds.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2010 Andrea Zagli + * Copyright (C) 2010-2015 Andrea Zagli * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -17,6 +17,12 @@ * */ +#ifdef HAVE_CONFIG_H + #include +#endif + +#include + #include #include "openauditds.h" @@ -113,7 +119,7 @@ OpenAuditDS &error); if (error != NULL) { - g_warning ("Errore: %s.", error->message); + g_warning (_("Error: %s."), error->message); return NULL; } diff --git a/src/table.c b/src/table.c index bd23b8b..2f5e6cf 100644 --- a/src/table.c +++ b/src/table.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2010-2013 Andrea Zagli + * Copyright (C) 2010-2015 Andrea Zagli * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -17,7 +17,14 @@ * */ +#ifdef HAVE_CONFIG_H + #include +#endif + #include + +#include + #include #include "table.h" @@ -139,7 +146,7 @@ Table &error); if (error != NULL) { - g_warning ("Errore: %s.", error->message); + g_warning (_("Error: %s."), error->message); return NULL; } @@ -233,8 +240,8 @@ table_update_metastore (gpointer data) priv->gdacon = datasources_get_gdaconnection (priv->commons, priv->update_metastore_datasource_id, &error); if (priv->gdacon == NULL || error != NULL) { - priv->error_update_metastore = g_strdup_printf ("Unable to update metastore.\n%s", - (error != NULL && error->message != NULL ? error->message : "No details.")); + priv->error_update_metastore = g_strdup_printf (_("Unable to update metastore.\n%s"), + (error != NULL && error->message != NULL ? error->message : _("No details."))); priv->update_metastore_ended = TRUE; return NULL; } @@ -242,8 +249,8 @@ table_update_metastore (gpointer data) error = NULL; if (!gda_connection_update_meta_store (priv->gdacon, &mcontext, &error)) { - priv->error_update_metastore = g_strdup_printf ("Unable to update metastore.\n%s", - (error != NULL && error->message != NULL ? error->message : "No details.")); + priv->error_update_metastore = g_strdup_printf (_("Unable to update metastore.\n%s"), + (error != NULL && error->message != NULL ? error->message : _("No details."))); priv->update_metastore_ended = TRUE; return NULL; } @@ -297,15 +304,15 @@ table_load_db_tables (Table *table) GTK_DIALOG_DESTROY_WITH_PARENT, GTK_MESSAGE_WARNING, GTK_BUTTONS_OK, - "Unable to update the metastore: %s", - error != NULL && error->message != NULL ? error->message : "no details"); + _("Unable to update the metastore: %s"), + error != NULL && error->message != NULL ? error->message : _("no details")); gtk_dialog_run (GTK_DIALOG (dialog)); gtk_widget_destroy (dialog); return; } gtk_label_set_text (GTK_LABEL (gtk_builder_get_object (priv->commons->gtkbuilder, "label10")), - "Updating meta store"); + _("Updating meta store")); gtk_widget_show_all (dialog); gtk_widget_show_now (dialog); @@ -362,8 +369,8 @@ table_load_db_tables (Table *table) GTK_DIALOG_DESTROY_WITH_PARENT, GTK_MESSAGE_WARNING, GTK_BUTTONS_OK, - "Unable to get tables list.\n%s", - (error != NULL && error->message != NULL ? error->message : "No details.")); + _("Unable to get tables list.\n%s"), + (error != NULL && error->message != NULL ? error->message : _("No details."))); gtk_dialog_run (GTK_DIALOG (dialog)); gtk_widget_destroy (dialog); return; @@ -431,7 +438,7 @@ table_load (Table *table) GTK_DIALOG_DESTROY_WITH_PARENT, GTK_MESSAGE_WARNING, GTK_BUTTONS_OK, - "Record %d doesn't exist.", + _("Record %d doesn't exist."), priv->id); gtk_dialog_run (GTK_DIALOG (dialog)); gtk_widget_destroy (dialog); @@ -475,7 +482,7 @@ table_save (Table *table) GTK_DIALOG_DESTROY_WITH_PARENT, GTK_MESSAGE_WARNING, GTK_BUTTONS_OK, - "You must select a table."); + _("You must select a table.")); gtk_dialog_run (GTK_DIALOG (dialog)); gtk_widget_destroy (dialog); return; @@ -564,8 +571,8 @@ table_save (Table *table) NULL); if (dm == NULL || error != NULL) { - g_warning ("Unable to get the primary key: %s.", - error != NULL && error->message != NULL ? error->message : "no details"); + g_warning (_("Unable to get the primary key: %s."), + error != NULL && error->message != NULL ? error->message : _("no details")); } is_key = (dm != NULL && gda_data_model_get_n_rows (dm) > 0); @@ -580,8 +587,8 @@ table_save (Table *table) } else { - g_warning ("Error getting new id field: %s", - (error != NULL && error->message != NULL ? error->message : "No details.")); + g_warning (_("Error getting new id field: %s"), + (error != NULL && error->message != NULL ? error->message : _("No details."))); } id_field++; @@ -602,8 +609,8 @@ table_save (Table *table) gda_connection_statement_execute_non_select (priv->commons->gdacon, stmt, NULL, NULL, &error); if (error != NULL) { - g_warning ("Error saving new field: %s", - (error->message != NULL ? error->message : "No details.")); + g_warning (_("Error saving new field: %s"), + (error->message != NULL ? error->message : _("No details."))); } g_free (sql); @@ -628,8 +635,8 @@ table_save (Table *table) gda_connection_statement_execute_non_select (priv->commons->gdacon, stmt, NULL, NULL, &error); if (error != NULL) { - g_warning ("Error removing old fields: %s", - (error->message != NULL ? error->message : "No details.")); + g_warning (_("Error removing old fields: %s"), + (error->message != NULL ? error->message : _("No details."))); } g_object_unref (stmt); g_free (sql); @@ -640,7 +647,7 @@ table_save (Table *table) GTK_DIALOG_DESTROY_WITH_PARENT, GTK_MESSAGE_INFO, GTK_BUTTONS_OK, - "Saved with success."); + _("Saved with success.")); gtk_dialog_run (GTK_DIALOG (dialog)); gtk_widget_destroy (dialog); } @@ -655,8 +662,8 @@ table_save (Table *table) GTK_DIALOG_DESTROY_WITH_PARENT, GTK_MESSAGE_WARNING, GTK_BUTTONS_OK, - "Error on saving.\n\n%s", - (error != NULL && error->message != NULL ? error->message : "No details.")); + _("Error on saving.\n\n%s"), + (error != NULL && error->message != NULL ? error->message : _("No details."))); gtk_dialog_run (GTK_DIALOG (dialog)); gtk_widget_destroy (dialog); } @@ -769,8 +776,8 @@ table_on_cb_tables_changed (GtkComboBox *widget, GTK_DIALOG_DESTROY_WITH_PARENT, GTK_MESSAGE_WARNING, GTK_BUTTONS_OK, - "Unable to get fields list.\n\n%s", - (error != NULL && error->message != NULL ? error->message : "No details.")); + _("Unable to get fields list.\n\n%s"), + (error != NULL && error->message != NULL ? error->message : _("No details."))); gtk_dialog_run (GTK_DIALOG (dialog)); gtk_widget_destroy (dialog); return; -- 2.49.0