Conversion to gettext to allow localization

This is just the first step - convert the string literals, try to catch
all the places where this isn't possible and the program needs to convert
string constants at runtime (those are the N_ macros).

Add a very rough first German localization so I can at least test what I
have done. Seriously, I have never used a localized OS, so I am certain
that I have many of the 'standard' translations wrong. Someone please take
over :-)

Major issues with this:

- right now it hardcodes the search path for the message catalog to be
  ./locale - that's of course bogus, but it works well while doing initial
  testing. Once the tooling support is there we just should use the OS
  default.

- even though de_DE defaults to ISO-8859-15 (or ISO-8859-1 - the internets
  can't seem to agree) I went with UTF-8 as that is what Gtk appears to
  want to use internally. ISO-8859-15 encoded .mo files create funny
  looking artefacts instead of Umlaute.

- no support at all in the Makefile - I was hoping someone with more
  experience in how to best set this up would contribute a good set of
  Makefile rules - likely this will help fix the first issue in that it
  will also install the .mo file(s) in the correct place(s)

  For now simply run

  msgfmt -c -o subsurface.mo deutsch.po

  to create the subsurface.mo file and then move it to
  ./locale/de_DE.UTF-8/LC_MESSAGES/subsurface.mo

  If you make changes to the sources and need to add new strings to be
  translated, this is what seems to work (again, should be tooled through
  the Makefile):

  xgettext -o subsurface-new.pot -s -k_ -kN_ --add-comments="++GETTEXT" *.c
  msgmerge -s -U po/deutsch.po subsurface-new.pot

  If you do this PLEASE do one commit that just has the new msgid as
  changes in line numbers create a TON of diff-noise. Do changes to
  translations in a SEPARATE commit.

- no testing at all on Windows or Mac
  It builds on Windows :-)

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
Dirk Hohndel 2012-10-11 09:42:59 +09:00
parent a2afe41280
commit 99846da77f
16 changed files with 1255 additions and 250 deletions

3
dive.c
View file

@ -2,6 +2,7 @@
/* maintains the internal dive list structure */
#include <string.h>
#include <stdio.h>
#include <glib/gi18n.h>
#include "dive.h"
@ -614,7 +615,7 @@ static char *merge_text(const char *a, const char *b)
res = malloc(strlen(a) + strlen(b) + 9);
if (!res)
return (char *)a;
sprintf(res, "(%s) or (%s)", a, b);
sprintf(res, _("(%s) or (%s)"), a, b);
return res;
}

View file

@ -15,6 +15,7 @@
#include <string.h>
#include <time.h>
#include <math.h>
#include <glib/gi18n.h>
#include "divelist.h"
#include "dive.h"
@ -1254,18 +1255,18 @@ static struct divelist_column {
int *visible;
} dl_column[] = {
[DIVE_NR] = { "#", nr_data_func, NULL, ALIGN_RIGHT | UNSORTABLE },
[DIVE_DATE] = { "Date", date_data_func, NULL, ALIGN_LEFT },
[DIVE_DATE] = { N_("Date"), date_data_func, NULL, ALIGN_LEFT },
[DIVE_RATING] = { UTF8_BLACKSTAR, star_data_func, NULL, ALIGN_LEFT },
[DIVE_DEPTH] = { "ft", depth_data_func, NULL, ALIGN_RIGHT },
[DIVE_DURATION] = { "min", duration_data_func, NULL, ALIGN_RIGHT },
[DIVE_DEPTH] = { N_("ft"), depth_data_func, NULL, ALIGN_RIGHT },
[DIVE_DURATION] = { N_("min"), duration_data_func, NULL, ALIGN_RIGHT },
[DIVE_TEMPERATURE] = { UTF8_DEGREE "F", temperature_data_func, NULL, ALIGN_RIGHT, &visible_cols.temperature },
[DIVE_TOTALWEIGHT] = { "lbs", weight_data_func, NULL, ALIGN_RIGHT, &visible_cols.totalweight },
[DIVE_SUIT] = { "Suit", NULL, NULL, ALIGN_LEFT, &visible_cols.suit },
[DIVE_CYLINDER] = { "Cyl", NULL, NULL, 0, &visible_cols.cylinder },
[DIVE_TOTALWEIGHT] = { N_("lbs"), weight_data_func, NULL, ALIGN_RIGHT, &visible_cols.totalweight },
[DIVE_SUIT] = { N_("Suit"), NULL, NULL, ALIGN_LEFT, &visible_cols.suit },
[DIVE_CYLINDER] = { N_("Cyl"), NULL, NULL, 0, &visible_cols.cylinder },
[DIVE_NITROX] = { "O" UTF8_SUBSCRIPT_2 "%", nitrox_data_func, nitrox_sort_func, 0, &visible_cols.nitrox },
[DIVE_SAC] = { "SAC", sac_data_func, NULL, 0, &visible_cols.sac },
[DIVE_OTU] = { "OTU", otu_data_func, NULL, 0, &visible_cols.otu },
[DIVE_LOCATION] = { "Location", NULL, NULL, ALIGN_LEFT },
[DIVE_SAC] = { N_("SAC"), sac_data_func, NULL, 0, &visible_cols.sac },
[DIVE_OTU] = { N_("OTU"), otu_data_func, NULL, 0, &visible_cols.otu },
[DIVE_LOCATION] = { N_("Location"), NULL, NULL, ALIGN_LEFT },
};
@ -1998,8 +1999,12 @@ static void delete_dive_cb(GtkWidget *menuitem, GtkTreePath *path)
static void popup_divelist_menu(GtkTreeView *tree_view, GtkTreeModel *model, int button, GdkEventButton *event)
{
GtkWidget *menu, *menuitem, *image;
char editlabel[] = "Edit dives";
char deletelabel[] = "Delete dives";
char editplurallabel[] = N_("Edit dives");
char editsinglelabel[] = N_("Edit dive");
char *editlabel;
char deleteplurallabel[] = N_("Delete dives");
char deletesinglelabel[] = N_("Delete dive");
char *deletelabel;
GtkTreePath *path, *prevpath, *nextpath;
GtkTreeIter iter, previter, nextiter;
int idx, previdx, nextidx;
@ -2011,7 +2016,7 @@ static void popup_divelist_menu(GtkTreeView *tree_view, GtkTreeModel *model, int
gtk_tree_model_get(MODEL(dive_list), &iter, DIVE_INDEX, &idx, -1);
menu = gtk_menu_new();
menuitem = gtk_image_menu_item_new_with_label("Add dive");
menuitem = gtk_image_menu_item_new_with_label(_("Add dive"));
image = gtk_image_new_from_stock(GTK_STOCK_ADD, GTK_ICON_SIZE_MENU);
gtk_image_menu_item_set_image(GTK_IMAGE_MENU_ITEM(menuitem), image);
g_signal_connect(menuitem, "activate", G_CALLBACK(add_dive_cb), NULL);
@ -2019,7 +2024,7 @@ static void popup_divelist_menu(GtkTreeView *tree_view, GtkTreeModel *model, int
if (idx < 0) {
/* mouse pointer is on a trip summary entry */
menuitem = gtk_menu_item_new_with_label("Edit Trip Summary");
menuitem = gtk_menu_item_new_with_label(_("Edit Trip Summary"));
g_signal_connect(menuitem, "activate", G_CALLBACK(edit_trip_cb), path);
gtk_menu_shell_append(GTK_MENU_SHELL(menu), menuitem);
prevpath = gtk_tree_path_copy(path);
@ -2027,7 +2032,7 @@ static void popup_divelist_menu(GtkTreeView *tree_view, GtkTreeModel *model, int
gtk_tree_model_get_iter(MODEL(dive_list), &previter, prevpath)) {
gtk_tree_model_get(MODEL(dive_list), &previter, DIVE_INDEX, &previdx, -1);
if (previdx < 0) {
menuitem = gtk_menu_item_new_with_label("Merge trip with trip above");
menuitem = gtk_menu_item_new_with_label(_("Merge trip with trip above"));
g_signal_connect(menuitem, "activate", G_CALLBACK(merge_trips_cb), path);
gtk_menu_shell_append(GTK_MENU_SHELL(menu), menuitem);
}
@ -2037,12 +2042,12 @@ static void popup_divelist_menu(GtkTreeView *tree_view, GtkTreeModel *model, int
if (gtk_tree_model_get_iter(MODEL(dive_list), &nextiter, nextpath)) {
gtk_tree_model_get(MODEL(dive_list), &nextiter, DIVE_INDEX, &nextidx, -1);
if (nextidx < 0) {
menuitem = gtk_menu_item_new_with_label("Merge trip with trip below");
menuitem = gtk_menu_item_new_with_label(_("Merge trip with trip below"));
g_signal_connect(menuitem, "activate", G_CALLBACK(merge_trips_cb), nextpath);
gtk_menu_shell_append(GTK_MENU_SHELL(menu), menuitem);
}
}
menuitem = gtk_menu_item_new_with_label("Remove Trip");
menuitem = gtk_menu_item_new_with_label(_("Remove Trip"));
g_signal_connect(menuitem, "activate", G_CALLBACK(remove_trip_cb), path);
gtk_menu_shell_append(GTK_MENU_SHELL(menu), menuitem);
} else {
@ -2050,8 +2055,11 @@ static void popup_divelist_menu(GtkTreeView *tree_view, GtkTreeModel *model, int
/* if we right click on selected dive(s), edit or delete those */
if (dive->selected) {
if (amount_selected == 1) {
deletelabel[strlen(deletelabel) - 1] = '\0';
editlabel[strlen(editlabel) - 1] = '\0';
deletelabel = _(deletesinglelabel);
editlabel = _(editsinglelabel);
} else {
deletelabel = _(deleteplurallabel);
editlabel = _(editplurallabel);
}
menuitem = gtk_menu_item_new_with_label(deletelabel);
g_signal_connect(menuitem, "activate", G_CALLBACK(delete_selected_dives_cb), path);
@ -2061,12 +2069,12 @@ static void popup_divelist_menu(GtkTreeView *tree_view, GtkTreeModel *model, int
g_signal_connect(menuitem, "activate", G_CALLBACK(edit_selected_dives_cb), NULL);
gtk_menu_shell_append(GTK_MENU_SHELL(menu), menuitem);
} else {
deletelabel[strlen(deletelabel) - 1] = '\0';
deletelabel = _(deletesinglelabel);
menuitem = gtk_menu_item_new_with_label(deletelabel);
g_signal_connect(menuitem, "activate", G_CALLBACK(delete_dive_cb), path);
gtk_menu_shell_append(GTK_MENU_SHELL(menu), menuitem);
editlabel[strlen(editlabel) - 1] = '\0';
editlabel = _(editsinglelabel);
menuitem = gtk_menu_item_new_with_label(editlabel);
g_signal_connect(menuitem, "activate", G_CALLBACK(edit_dive_from_path_cb), path);
gtk_menu_shell_append(GTK_MENU_SHELL(menu), menuitem);
@ -2077,7 +2085,7 @@ static void popup_divelist_menu(GtkTreeView *tree_view, GtkTreeModel *model, int
int *indices = gtk_tree_path_get_indices(path);
/* top level dive or child dive that is not the first child */
if (depth == 1 || indices[1] > 0) {
menuitem = gtk_menu_item_new_with_label("Create new trip above");
menuitem = gtk_menu_item_new_with_label(_("Create new trip above"));
g_signal_connect(menuitem, "activate", G_CALLBACK(insert_trip_before_cb), path);
gtk_menu_shell_append(GTK_MENU_SHELL(menu), menuitem);
}
@ -2087,24 +2095,24 @@ static void popup_divelist_menu(GtkTreeView *tree_view, GtkTreeModel *model, int
gtk_tree_path_prev(prevpath) &&
gtk_tree_model_get_iter(MODEL(dive_list), &previter, prevpath) &&
gtk_tree_model_iter_n_children(model, &previter)) {
menuitem = gtk_menu_item_new_with_label("Add to trip above");
menuitem = gtk_menu_item_new_with_label(_("Add to trip above"));
g_signal_connect(menuitem, "activate", G_CALLBACK(merge_dive_into_trip_above_cb), path);
gtk_menu_shell_append(GTK_MENU_SHELL(menu), menuitem);
}
if (DIVE_IN_TRIP(dive)) {
if (dive->selected && amount_selected > 1)
menuitem = gtk_menu_item_new_with_label("Remove selected dives from trip");
menuitem = gtk_menu_item_new_with_label(_("Remove selected dives from trip"));
else
menuitem = gtk_menu_item_new_with_label("Remove dive from trip");
menuitem = gtk_menu_item_new_with_label(_("Remove dive from trip"));
g_signal_connect(menuitem, "activate", G_CALLBACK(remove_from_trip_cb), path);
gtk_menu_shell_append(GTK_MENU_SHELL(menu), menuitem);
}
}
}
menuitem = gtk_menu_item_new_with_label("Expand all");
menuitem = gtk_menu_item_new_with_label(_("Expand all"));
g_signal_connect(menuitem, "activate", G_CALLBACK(expand_all_cb), tree_view);
gtk_menu_shell_append(GTK_MENU_SHELL(menu), menuitem);
menuitem = gtk_menu_item_new_with_label("Collapse all");
menuitem = gtk_menu_item_new_with_label(_("Collapse all"));
g_signal_connect(menuitem, "activate", G_CALLBACK(collapse_all_cb), tree_view);
gtk_menu_shell_append(GTK_MENU_SHELL(menu), menuitem);
gtk_widget_show_all(menu);

View file

@ -12,6 +12,7 @@
#include <stdlib.h>
#include <stdarg.h>
#include <time.h>
#include <glib/gi18n.h>
#include "dive.h"
#include "display.h"
@ -540,7 +541,7 @@ static void set_one_weightsystem(void *_data, GtkListStore *model, GtkTreeIter *
weightsystem_t *ws = _data;
gtk_list_store_set(model, iter,
WS_DESC, ws->description ? : "unspecified",
WS_DESC, ws->description ? : _("unspecified"),
WS_WEIGHT, ws->weight.grams,
-1);
}
@ -818,11 +819,11 @@ static struct ws_info {
const char *name;
int grams;
} ws_info[100] = {
{ "integrated", 0 },
{ "belt", 0 },
{ "ankle", 0 },
{ "bar", 0 },
{ "clip-on", 0 },
{ N_("integrated"), 0 },
{ N_("belt"), 0 },
{ N_("ankle"), 0 },
{ N_("bar"), 0 },
{ N_("clip-on"), 0 },
};
static void fill_ws_list(GtkListStore *store)
@ -833,7 +834,7 @@ static void fill_ws_list(GtkListStore *store)
while (info->name) {
gtk_list_store_append(store, &iter);
gtk_list_store_set(store, &iter,
0, info->name,
0, _(info->name),
1, info->grams,
-1);
info++;
@ -922,7 +923,7 @@ static void cylinder_widget(GtkWidget *vbox, struct cylinder_widget *cylinder, G
* Cylinder type: description, size and
* working pressure
*/
frame = gtk_frame_new("Cylinder");
frame = gtk_frame_new(_("Cylinder"));
hbox = gtk_hbox_new(FALSE, 3);
gtk_container_add(GTK_CONTAINER(frame), hbox);
@ -956,12 +957,12 @@ static void cylinder_widget(GtkWidget *vbox, struct cylinder_widget *cylinder, G
/*
* Cylinder start/end pressures
*/
hbox = frame_box("Pressure", vbox);
hbox = frame_box(_("Pressure"), vbox);
widget = labeled_spinbutton(hbox, "Start", 0, 5000, 1);
widget = labeled_spinbutton(hbox, _("Start"), 0, 5000, 1);
cylinder->start = widget;
widget = labeled_spinbutton(hbox, "End", 0, 5000, 1);
widget = labeled_spinbutton(hbox, _("End"), 0, 5000, 1);
cylinder->end = widget;
cylinder->pressure_button = gtk_check_button_new();
@ -971,7 +972,7 @@ static void cylinder_widget(GtkWidget *vbox, struct cylinder_widget *cylinder, G
/*
* Cylinder gas mix: Air, Nitrox or Trimix
*/
hbox = frame_box("Gasmix", vbox);
hbox = frame_box(_("Gasmix"), vbox);
widget = labeled_spinbutton(hbox, "O"UTF8_SUBSCRIPT_2 "%", 1, 100, 0.1);
cylinder->o2 = widget;
@ -1008,7 +1009,7 @@ static void ws_widget(GtkWidget *vbox, struct ws_widget *ws_widget, GtkListStore
/*
* weight_system: description and weight
*/
frame = gtk_frame_new("Weight");
frame = gtk_frame_new(_("Weight"));
hbox = gtk_hbox_new(FALSE, 3);
gtk_container_add(GTK_CONTAINER(frame), hbox);
@ -1058,7 +1059,7 @@ static int edit_cylinder_dialog(GtkWidget *w, int index, cylinder_t *cyl, int w_
return 0;
*cyl = dive->cylinder[index];
dialog = gtk_dialog_new_with_buttons("Cylinder",
dialog = gtk_dialog_new_with_buttons(_("Cylinder"),
GTK_WINDOW(main_window),
GTK_DIALOG_DESTROY_WITH_PARENT,
GTK_STOCK_OK, GTK_RESPONSE_ACCEPT,
@ -1113,7 +1114,7 @@ static int edit_weightsystem_dialog(GtkWidget *w, int index, weightsystem_t *ws,
return 0;
*ws = dive->weightsystem[index];
dialog = gtk_dialog_new_with_buttons("Weight System",
dialog = gtk_dialog_new_with_buttons(_("Weight System"),
GTK_WINDOW(main_window),
GTK_DIALOG_DESTROY_WITH_PARENT,
GTK_STOCK_OK, GTK_RESPONSE_ACCEPT,
@ -1374,7 +1375,7 @@ static void size_data_func(GtkTreeViewColumn *col,
if (size)
snprintf(buffer, sizeof(buffer), "%.1f", size);
else
strcpy(buffer, "unkn");
strcpy(buffer, _("unkn"));
g_object_set(renderer, "text", buffer, NULL);
}
@ -1394,7 +1395,7 @@ static void weight_data_func(GtkTreeViewColumn *col,
if (grams)
snprintf(buffer, sizeof(buffer), "%.*f", decimals, value);
else
strcpy(buffer, "unkn");
strcpy(buffer, _("unkn"));
g_object_set(renderer, "text", buffer, NULL);
}
@ -1481,11 +1482,11 @@ GtkWidget *cylinder_list_widget(int w_idx)
"enable-grid-lines", GTK_TREE_VIEW_GRID_LINES_BOTH,
NULL);
tree_view_column(tree_view, CYL_DESC, "Type", NULL, ALIGN_LEFT | UNSORTABLE);
tree_view_column(tree_view, CYL_SIZE, "Size", size_data_func, ALIGN_RIGHT | UNSORTABLE);
tree_view_column(tree_view, CYL_WORKP, "MaxPress", pressure_data_func, ALIGN_RIGHT | UNSORTABLE);
tree_view_column(tree_view, CYL_STARTP, "Start", pressure_data_func, ALIGN_RIGHT | UNSORTABLE);
tree_view_column(tree_view, CYL_ENDP, "End", pressure_data_func, ALIGN_RIGHT | UNSORTABLE);
tree_view_column(tree_view, CYL_DESC, _("Type"), NULL, ALIGN_LEFT | UNSORTABLE);
tree_view_column(tree_view, CYL_SIZE, _("Size"), size_data_func, ALIGN_RIGHT | UNSORTABLE);
tree_view_column(tree_view, CYL_WORKP, _("MaxPress"), pressure_data_func, ALIGN_RIGHT | UNSORTABLE);
tree_view_column(tree_view, CYL_STARTP, _("Start"), pressure_data_func, ALIGN_RIGHT | UNSORTABLE);
tree_view_column(tree_view, CYL_ENDP, _("End"), pressure_data_func, ALIGN_RIGHT | UNSORTABLE);
tree_view_column(tree_view, CYL_O2, "O" UTF8_SUBSCRIPT_2 "%", percentage_data_func, ALIGN_RIGHT | UNSORTABLE);
tree_view_column(tree_view, CYL_HE, "He%", percentage_data_func, ALIGN_RIGHT | UNSORTABLE);
return tree_view;
@ -1509,8 +1510,8 @@ GtkWidget *weightsystem_list_widget(int w_idx)
"enable-grid-lines", GTK_TREE_VIEW_GRID_LINES_BOTH,
NULL);
tree_view_column(tree_view, WS_DESC, "Type", NULL, ALIGN_LEFT | UNSORTABLE);
tree_view_column(tree_view, WS_WEIGHT, "weight",
tree_view_column(tree_view, WS_DESC, _("Type"), NULL, ALIGN_LEFT | UNSORTABLE);
tree_view_column(tree_view, WS_WEIGHT, _("weight"),
weight_data_func, ALIGN_RIGHT | UNSORTABLE);
return tree_view;
@ -1568,7 +1569,7 @@ GtkWidget *equipment_widget(int w_idx)
hbox = gtk_hbox_new(FALSE, 3);
gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 3);
frame = gtk_frame_new("Cylinders");
frame = gtk_frame_new(_("Cylinders"));
gtk_box_pack_start(GTK_BOX(hbox), frame, TRUE, FALSE, 3);
framebox = gtk_vbox_new(FALSE, 3);
@ -1605,7 +1606,7 @@ GtkWidget *equipment_widget(int w_idx)
tree_view = weightsystem_list_create(w_idx);
weightsystem_list[w_idx].tree_view = GTK_TREE_VIEW(tree_view);
frame = gtk_frame_new("Weight");
frame = gtk_frame_new(_("Weight"));
gtk_box_pack_start(GTK_BOX(hbox), frame, TRUE, FALSE, 3);
framebox = gtk_vbox_new(FALSE, 3);

7
file.c
View file

@ -4,6 +4,7 @@
#include <stdlib.h>
#include <string.h>
#include <errno.h>
#include <glib/gi18n.h>
#include "dive.h"
#include "file.h"
@ -71,7 +72,7 @@ static void suunto_read(struct zip_file *file, GError **error)
size = read * 3 / 2;
mem = realloc(mem, size);
}
parse_xml_buffer("SDE file", mem, read, error, FALSE);
parse_xml_buffer(_("SDE file"), mem, read, error, FALSE);
free(mem);
}
#endif
@ -258,11 +259,11 @@ void parse_file(const char *filename, GError **error, gboolean possible_default_
if (default_filename && ! strcmp(filename, default_filename))
return;
g_warning("Failed to read '%s'.\n", filename);
g_warning(_("Failed to read '%s'.\n"), filename);
if (error) {
*error = g_error_new(g_quark_from_string("subsurface"),
DIVE_ERROR_PARSE,
"Failed to read '%s'",
_("Failed to read '%s'"),
filename);
}
return;

143
gtk-gui.c
View file

@ -3,6 +3,8 @@
/* creates the window and overall layout
* divelist, dive info, equipment and printing are handled in their own source files
*/
#include <libintl.h>
#include <glib/gi18n.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
@ -135,7 +137,7 @@ void report_error(GError* error)
{
error_count++;
char buffer[256];
snprintf(buffer, sizeof(buffer), "Failed to open %i files.", error_count);
snprintf(buffer, sizeof(buffer), _("Failed to open %i files."), error_count);
gtk_label_set(GTK_LABEL(error_label), buffer);
}
}
@ -148,7 +150,7 @@ static GtkFileFilter *setup_filter(void)
gtk_file_filter_add_pattern(filter, "*.sda");
gtk_file_filter_add_pattern(filter, "*.SDA");
gtk_file_filter_add_mime_type(filter, "text/xml");
gtk_file_filter_set_name(filter, "XML file");
gtk_file_filter_set_name(filter, _("XML file"));
return filter;
}
@ -160,7 +162,7 @@ static void file_save_as(GtkWidget *w, gpointer data)
char *current_file;
char *current_dir;
dialog = gtk_file_chooser_dialog_new("Save File As",
dialog = gtk_file_chooser_dialog_new(_("Save File As"),
GTK_WINDOW(main_window),
GTK_FILE_CHOOSER_ACTION_SAVE,
GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
@ -223,7 +225,7 @@ static gboolean ask_save_changes()
{
GtkWidget *dialog, *label, *content;
gboolean quit = TRUE;
dialog = gtk_dialog_new_with_buttons("Save Changes?",
dialog = gtk_dialog_new_with_buttons(_("Save Changes?"),
GTK_WINDOW(main_window), GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT,
GTK_STOCK_SAVE, GTK_RESPONSE_ACCEPT,
GTK_STOCK_NO, GTK_RESPONSE_NO,
@ -233,11 +235,11 @@ static gboolean ask_save_changes()
if (!existing_filename){
label = gtk_label_new (
"You have unsaved changes\nWould you like to save those before closing the datafile?");
_("You have unsaved changes\nWould you like to save those before closing the datafile?"));
} else {
char *label_text = (char*) malloc(sizeof(char) * (94 + strlen(existing_filename)));
sprintf(label_text,
"You have unsaved changes to file: %s \nWould you like to save those before closing the datafile?",
_("You have unsaved changes to file: %s \nWould you like to save those before closing the datafile?"),
existing_filename);
label = gtk_label_new (label_text);
free(label_text);
@ -308,7 +310,7 @@ static void file_open(GtkWidget *w, gpointer data)
GtkFileFilter *filter;
const char *current_default;
dialog = gtk_file_chooser_dialog_new("Open File",
dialog = gtk_file_chooser_dialog_new(_("Open File"),
GTK_WINDOW(main_window),
GTK_FILE_CHOOSER_ACTION_OPEN,
GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
@ -515,7 +517,7 @@ static void pick_default_file(GtkWidget *w, GtkButton *button)
GtkFileFilter *filter;
struct stat sb;
fs_dialog = gtk_file_chooser_dialog_new("Choose Default XML File",
fs_dialog = gtk_file_chooser_dialog_new(_("Choose Default XML File"),
GTK_WINDOW(main_window),
GTK_FILE_CHOOSER_ACTION_SAVE,
GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
@ -565,57 +567,57 @@ static void preferences_dialog(GtkWidget *w, gpointer data)
menu_units = output_units;
dialog = gtk_dialog_new_with_buttons("Preferences",
dialog = gtk_dialog_new_with_buttons(_("Preferences"),
GTK_WINDOW(main_window),
GTK_DIALOG_DESTROY_WITH_PARENT,
GTK_STOCK_OK, GTK_RESPONSE_ACCEPT,
GTK_STOCK_CANCEL, GTK_RESPONSE_REJECT,
NULL);
frame = gtk_frame_new("Units");
frame = gtk_frame_new(_("Units"));
vbox = gtk_dialog_get_content_area(GTK_DIALOG(dialog));
gtk_box_pack_start(GTK_BOX(vbox), frame, FALSE, FALSE, 5);
box = gtk_vbox_new(FALSE, 6);
gtk_container_add(GTK_CONTAINER(frame), box);
create_radio(box, "Depth:",
"Meter", set_meter, (output_units.length == METERS),
"Feet", set_feet, (output_units.length == FEET),
create_radio(box, _("Depth:"),
_("Meter"), set_meter, (output_units.length == METERS),
_("Feet"), set_feet, (output_units.length == FEET),
NULL);
create_radio(box, "Pressure:",
"Bar", set_bar, (output_units.pressure == BAR),
"PSI", set_psi, (output_units.pressure == PSI),
create_radio(box, _("Pressure:"),
_("Bar"), set_bar, (output_units.pressure == BAR),
_("PSI"), set_psi, (output_units.pressure == PSI),
NULL);
create_radio(box, "Volume:",
"Liter", set_liter, (output_units.volume == LITER),
"CuFt", set_cuft, (output_units.volume == CUFT),
create_radio(box, _("Volume:"),
_("Liter"), set_liter, (output_units.volume == LITER),
_("CuFt"), set_cuft, (output_units.volume == CUFT),
NULL);
create_radio(box, "Temperature:",
"Celsius", set_celsius, (output_units.temperature == CELSIUS),
"Fahrenheit", set_fahrenheit, (output_units.temperature == FAHRENHEIT),
create_radio(box, _("Temperature:"),
_("Celsius"), set_celsius, (output_units.temperature == CELSIUS),
_("Fahrenheit"), set_fahrenheit, (output_units.temperature == FAHRENHEIT),
NULL);
create_radio(box, "Weight:",
"kg", set_kg, (output_units.weight == KG),
"lbs", set_lbs, (output_units.weight == LBS),
create_radio(box, _("Weight:"),
_("kg"), set_kg, (output_units.weight == KG),
_("lbs"), set_lbs, (output_units.weight == LBS),
NULL);
frame = gtk_frame_new("Show Columns");
frame = gtk_frame_new(_("Show Columns"));
gtk_box_pack_start(GTK_BOX(GTK_DIALOG(dialog)->vbox), frame, FALSE, FALSE, 5);
box = gtk_hbox_new(FALSE, 6);
gtk_container_add(GTK_CONTAINER(frame), box);
button = gtk_check_button_new_with_label("Temp");
button = gtk_check_button_new_with_label(_("Temp"));
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(button), visible_cols.temperature);
gtk_box_pack_start(GTK_BOX(box), button, FALSE, FALSE, 6);
g_signal_connect(G_OBJECT(button), "toggled", G_CALLBACK(temperature_toggle), NULL);
button = gtk_check_button_new_with_label("Cyl");
button = gtk_check_button_new_with_label(_("Cyl"));
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(button), visible_cols.cylinder);
gtk_box_pack_start(GTK_BOX(box), button, FALSE, FALSE, 6);
g_signal_connect(G_OBJECT(button), "toggled", G_CALLBACK(cylinder_toggle), NULL);
@ -625,44 +627,44 @@ static void preferences_dialog(GtkWidget *w, gpointer data)
gtk_box_pack_start(GTK_BOX(box), button, FALSE, FALSE, 6);
g_signal_connect(G_OBJECT(button), "toggled", G_CALLBACK(nitrox_toggle), NULL);
button = gtk_check_button_new_with_label("SAC");
button = gtk_check_button_new_with_label(_("SAC"));
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(button), visible_cols.sac);
gtk_box_pack_start(GTK_BOX(box), button, FALSE, FALSE, 6);
g_signal_connect(G_OBJECT(button), "toggled", G_CALLBACK(sac_toggle), NULL);
button = gtk_check_button_new_with_label("OTU");
button = gtk_check_button_new_with_label(_("OTU"));
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(button), visible_cols.otu);
gtk_box_pack_start(GTK_BOX(box), button, FALSE, FALSE, 6);
g_signal_connect(G_OBJECT(button), "toggled", G_CALLBACK(otu_toggle), NULL);
button = gtk_check_button_new_with_label("Weight");
button = gtk_check_button_new_with_label(_("Weight"));
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(button), visible_cols.totalweight);
gtk_box_pack_start(GTK_BOX(box), button, FALSE, FALSE, 6);
g_signal_connect(G_OBJECT(button), "toggled", G_CALLBACK(totalweight_toggle), NULL);
button = gtk_check_button_new_with_label("Suit");
button = gtk_check_button_new_with_label(_("Suit"));
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(button), visible_cols.suit);
gtk_box_pack_start(GTK_BOX(box), button, FALSE, FALSE, 6);
g_signal_connect(G_OBJECT(button), "toggled", G_CALLBACK(suit_toggle), NULL);
frame = gtk_frame_new("Divelist Font");
frame = gtk_frame_new(_("Divelist Font"));
gtk_box_pack_start(GTK_BOX(GTK_DIALOG(dialog)->vbox), frame, FALSE, FALSE, 5);
font = gtk_font_button_new_with_font(divelist_font);
gtk_container_add(GTK_CONTAINER(frame),font);
frame = gtk_frame_new("Misc. Options");
frame = gtk_frame_new(_("Misc. Options"));
gtk_box_pack_start(GTK_BOX(GTK_DIALOG(dialog)->vbox), frame, FALSE, FALSE, 5);
box = gtk_hbox_new(FALSE, 6);
gtk_container_add(GTK_CONTAINER(frame), box);
button = gtk_check_button_new_with_label("Automatically group dives in trips");
button = gtk_check_button_new_with_label(_("Automatically group dives in trips"));
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(button), autogroup);
gtk_box_pack_start(GTK_BOX(box), button, FALSE, FALSE, 6);
g_signal_connect(G_OBJECT(button), "toggled", G_CALLBACK(autogroup_toggle), NULL);
frame = gtk_frame_new("Default XML Data File");
frame = gtk_frame_new(_("Default XML Data File"));
gtk_box_pack_start(GTK_BOX(box), frame, FALSE, FALSE, 5);
box = gtk_hbox_new(FALSE, 6);
gtk_container_add(GTK_CONTAINER(frame), box);
@ -757,7 +759,7 @@ static void selectevents_dialog(GtkWidget *w, gpointer data)
int result;
GtkWidget *dialog, *frame, *vbox, *table;
dialog = gtk_dialog_new_with_buttons("SelectEvents",
dialog = gtk_dialog_new_with_buttons(_("SelectEvents"),
GTK_WINDOW(main_window),
GTK_DIALOG_DESTROY_WITH_PARENT,
GTK_STOCK_OK, GTK_RESPONSE_ACCEPT,
@ -766,7 +768,7 @@ static void selectevents_dialog(GtkWidget *w, gpointer data)
/* initialize the function that fills the table */
create_toggle(NULL, NULL, NULL);
frame = gtk_frame_new("Enable / Disable Events");
frame = gtk_frame_new(_("Enable / Disable Events"));
vbox = gtk_dialog_get_content_area(GTK_DIALOG(dialog));
gtk_box_pack_start(GTK_BOX(vbox), frame, FALSE, FALSE, 5);
@ -797,7 +799,7 @@ static void renumber_dialog(GtkWidget *w, gpointer data)
struct dive *dive;
GtkWidget *dialog, *frame, *button, *vbox;
dialog = gtk_dialog_new_with_buttons("Renumber",
dialog = gtk_dialog_new_with_buttons(_("Renumber"),
GTK_WINDOW(main_window),
GTK_DIALOG_DESTROY_WITH_PARENT,
GTK_STOCK_OK, GTK_RESPONSE_ACCEPT,
@ -806,7 +808,7 @@ static void renumber_dialog(GtkWidget *w, gpointer data)
vbox = gtk_dialog_get_content_area(GTK_DIALOG(dialog));
frame = gtk_frame_new("New starting number");
frame = gtk_frame_new(_("New starting number"));
gtk_box_pack_start(GTK_BOX(vbox), frame, FALSE, FALSE, 5);
button = gtk_spin_button_new_with_range(1, 50000, 1);
@ -846,10 +848,10 @@ static void about_dialog(GtkWidget *w, gpointer data)
gtk_show_about_dialog(NULL,
"program-name", "Subsurface",
"comments", "Multi-platform divelog software in C",
"comments", _("Multi-platform divelog software in C"),
"license", "GPLv2",
"version", VERSION_STRING,
"copyright", "Linus Torvalds, Dirk Hohndel, and others, 2011, 2012",
"copyright", _("Linus Torvalds, Dirk Hohndel, and others, 2011, 2012"),
"logo-icon-name", "subsurface",
/* Must be last: */
logo_property, logo,
@ -894,36 +896,36 @@ static void toggle_zoom(GtkWidget *w, gpointer data)
}
static GtkActionEntry menu_items[] = {
{ "FileMenuAction", NULL, "File", NULL, NULL, NULL},
{ "LogMenuAction", NULL, "Log", NULL, NULL, NULL},
{ "ViewMenuAction", NULL, "View", NULL, NULL, NULL},
{ "FilterMenuAction", NULL, "Filter", NULL, NULL, NULL},
{ "HelpMenuAction", NULL, "Help", NULL, NULL, NULL},
{ "FileMenuAction", NULL, N_("File"), NULL, NULL, NULL},
{ "LogMenuAction", NULL, N_("Log"), NULL, NULL, NULL},
{ "ViewMenuAction", NULL, N_("View"), NULL, NULL, NULL},
{ "FilterMenuAction", NULL, N_("Filter"), NULL, NULL, NULL},
{ "HelpMenuAction", NULL, N_("Help"), NULL, NULL, NULL},
{ "NewFile", GTK_STOCK_NEW, NULL, CTRLCHAR "N", NULL, G_CALLBACK(file_close) },
{ "OpenFile", GTK_STOCK_OPEN, NULL, CTRLCHAR "O", NULL, G_CALLBACK(file_open) },
{ "SaveFile", GTK_STOCK_SAVE, NULL, CTRLCHAR "S", NULL, G_CALLBACK(file_save) },
{ "SaveAsFile", GTK_STOCK_SAVE_AS, NULL, SHIFTCHAR CTRLCHAR "S", NULL, G_CALLBACK(file_save_as) },
{ "CloseFile", GTK_STOCK_CLOSE, NULL, NULL, NULL, G_CALLBACK(file_close) },
{ "Print", GTK_STOCK_PRINT, NULL, CTRLCHAR "P", NULL, G_CALLBACK(do_print) },
{ "ImportFile", GTK_STOCK_GO_BACK, "Import XML File(s)", CTRLCHAR "I", NULL, G_CALLBACK(import_files) },
{ "DownloadLog", GTK_STOCK_GO_DOWN, "Download From Dive Computer", CTRLCHAR "D", NULL, G_CALLBACK(download_dialog) },
{ "AddDive", GTK_STOCK_ADD, "Add Dive", NULL, NULL, G_CALLBACK(add_dive_cb) },
{ "Preferences", GTK_STOCK_PREFERENCES, "Preferences", PREFERENCE_ACCEL, NULL, G_CALLBACK(preferences_dialog) },
{ "Renumber", NULL, "Renumber", NULL, NULL, G_CALLBACK(renumber_dialog) },
{ "YearlyStats", NULL, "Yearly Statistics", NULL, NULL, G_CALLBACK(show_yearly_stats) },
{ "SelectEvents", NULL, "SelectEvents", NULL, NULL, G_CALLBACK(selectevents_dialog) },
{ "ImportFile", GTK_STOCK_GO_BACK, N_("Import XML File(s)"), CTRLCHAR "I", NULL, G_CALLBACK(import_files) },
{ "DownloadLog", GTK_STOCK_GO_DOWN, N_("Download From Dive Computer"), CTRLCHAR "D", NULL, G_CALLBACK(download_dialog) },
{ "AddDive", GTK_STOCK_ADD, N_("Add Dive"), NULL, NULL, G_CALLBACK(add_dive_cb) },
{ "Preferences", GTK_STOCK_PREFERENCES, N_("Preferences"), PREFERENCE_ACCEL, NULL, G_CALLBACK(preferences_dialog) },
{ "Renumber", NULL, N_("Renumber"), NULL, NULL, G_CALLBACK(renumber_dialog) },
{ "YearlyStats", NULL, N_("Yearly Statistics"), NULL, NULL, G_CALLBACK(show_yearly_stats) },
{ "SelectEvents", NULL, N_("SelectEvents"), NULL, NULL, G_CALLBACK(selectevents_dialog) },
{ "Quit", GTK_STOCK_QUIT, NULL, CTRLCHAR "Q", NULL, G_CALLBACK(quit) },
{ "About", GTK_STOCK_ABOUT, NULL, NULL, NULL, G_CALLBACK(about_dialog) },
{ "ViewList", NULL, "List", CTRLCHAR "1", NULL, G_CALLBACK(view_list) },
{ "ViewProfile", NULL, "Profile", CTRLCHAR "2", NULL, G_CALLBACK(view_profile) },
{ "ViewInfo", NULL, "Info", CTRLCHAR "3", NULL, G_CALLBACK(view_info) },
{ "ViewThree", NULL, "Three", CTRLCHAR "4", NULL, G_CALLBACK(view_three) },
{ "ViewList", NULL, N_("List"), CTRLCHAR "1", NULL, G_CALLBACK(view_list) },
{ "ViewProfile", NULL, N_("Profile"), CTRLCHAR "2", NULL, G_CALLBACK(view_profile) },
{ "ViewInfo", NULL, N_("Info"), CTRLCHAR "3", NULL, G_CALLBACK(view_info) },
{ "ViewThree", NULL, N_("Three"), CTRLCHAR "4", NULL, G_CALLBACK(view_three) },
};
static gint nmenu_items = sizeof (menu_items) / sizeof (menu_items[0]);
static GtkToggleActionEntry toggle_items[] = {
{ "Autogroup", NULL, "Autogroup", NULL, NULL, G_CALLBACK(autogroup_cb), FALSE },
{ "ToggleZoom", NULL, "Toggle Zoom", CTRLCHAR "0", NULL, G_CALLBACK(toggle_zoom), FALSE },
{ "Autogroup", NULL, N_("Autogroup"), NULL, NULL, G_CALLBACK(autogroup_cb), FALSE },
{ "ToggleZoom", NULL, N_("Toggle Zoom"), CTRLCHAR "0", NULL, G_CALLBACK(toggle_zoom), FALSE },
};
static gint ntoggle_items = sizeof (toggle_items) / sizeof (toggle_items[0]);
@ -974,6 +976,7 @@ static const gchar* ui_string = " \
static GtkWidget *get_menubar_menu(GtkWidget *window, GtkUIManager *ui_manager)
{
GtkActionGroup *action_group = gtk_action_group_new("Menu");
gtk_action_group_set_translation_domain(action_group, "subsurface");
gtk_action_group_add_actions(action_group, menu_items, nmenu_items, 0);
toggle_items[0].is_active = autogroup;
gtk_action_group_add_toggle_actions(action_group, toggle_items, ntoggle_items, 0);
@ -1106,19 +1109,19 @@ void init_ui(int *argcp, char ***argvp)
/* Frame for extended dive info */
nb_page = extended_dive_info_widget();
gtk_notebook_append_page(GTK_NOTEBOOK(notebook), nb_page, gtk_label_new("Dive Notes"));
gtk_notebook_append_page(GTK_NOTEBOOK(notebook), nb_page, gtk_label_new(_("Dive Notes")));
/* Frame for dive equipment */
nb_page = equipment_widget(W_IDX_PRIMARY);
gtk_notebook_append_page(GTK_NOTEBOOK(notebook), nb_page, gtk_label_new("Equipment"));
gtk_notebook_append_page(GTK_NOTEBOOK(notebook), nb_page, gtk_label_new(_("Equipment")));
/* Frame for single dive statistics */
nb_page = single_stats_widget();
gtk_notebook_append_page(GTK_NOTEBOOK(notebook), nb_page, gtk_label_new("Dive Info"));
gtk_notebook_append_page(GTK_NOTEBOOK(notebook), nb_page, gtk_label_new(_("Dive Info")));
/* Frame for total dive statistics */
nb_page = total_stats_widget();
gtk_notebook_append_page(GTK_NOTEBOOK(notebook), nb_page, gtk_label_new("Stats"));
gtk_notebook_append_page(GTK_NOTEBOOK(notebook), nb_page, gtk_label_new(_("Stats")));
gtk_widget_set_app_paintable(win, TRUE);
gtk_widget_show_all(win);
@ -1327,7 +1330,7 @@ static GtkComboBox *dive_computer_selector(GtkWidget *vbox)
model = gtk_list_store_new(1, G_TYPE_POINTER);
default_index = fill_computer_list(model);
frame = gtk_frame_new("Dive computer");
frame = gtk_frame_new(_("Dive computer"));
gtk_box_pack_start(GTK_BOX(hbox), frame, FALSE, TRUE, 3);
combo_box = gtk_combo_box_new_with_model(GTK_TREE_MODEL(model));
@ -1358,7 +1361,7 @@ static GtkEntry *dive_computer_device(GtkWidget *vbox)
hbox = gtk_hbox_new(FALSE, 6);
gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 3);
frame = gtk_frame_new("Device name");
frame = gtk_frame_new(_("Device name"));
gtk_box_pack_start(GTK_BOX(hbox), frame, FALSE, TRUE, 3);
entry = gtk_entry_new();
@ -1390,7 +1393,7 @@ void import_files(GtkWidget *w, gpointer data)
struct stat sb;
GSList *filenames = NULL;
fs_dialog = gtk_file_chooser_dialog_new("Choose XML Files To Import Into Current Data File",
fs_dialog = gtk_file_chooser_dialog_new(_("Choose XML Files To Import Into Current Data File"),
GTK_WINDOW(main_window),
GTK_FILE_CHOOSER_ACTION_OPEN,
GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
@ -1465,7 +1468,7 @@ static GtkWidget *import_dive_computer(device_data_t *data, GtkDialog *dialog)
button = gtk_dialog_get_widget_for_response(dialog, GTK_RESPONSE_ACCEPT);
gtk_button_set_use_stock(GTK_BUTTON(button), 0);
gtk_button_set_label(GTK_BUTTON(button), "Retry");
gtk_button_set_label(GTK_BUTTON(button), _("Retry"));
vbox = gtk_dialog_get_content_area(dialog);
@ -1488,7 +1491,7 @@ void download_dialog(GtkWidget *w, gpointer data)
.devname = NULL,
};
dialog = gtk_dialog_new_with_buttons("Download From Dive Computer",
dialog = gtk_dialog_new_with_buttons(_("Download From Dive Computer"),
GTK_WINDOW(main_window),
GTK_DIALOG_DESTROY_WITH_PARENT,
GTK_STOCK_OK, GTK_RESPONSE_ACCEPT,
@ -1496,7 +1499,7 @@ void download_dialog(GtkWidget *w, gpointer data)
NULL);
vbox = gtk_dialog_get_content_area(GTK_DIALOG(dialog));
label = gtk_label_new(" Please select dive computer and device. ");
label = gtk_label_new(_(" Please select dive computer and device. "));
gtk_box_pack_start(GTK_BOX(vbox), label, FALSE, TRUE, 3);
computer = dive_computer_selector(vbox);
device = dive_computer_device(vbox);

65
info.c
View file

@ -13,6 +13,7 @@
#include <time.h>
#include <ctype.h>
#include <sys/time.h>
#include <glib/gi18n.h>
#include "dive.h"
#include "display.h"
@ -102,7 +103,7 @@ static int divename(char *buf, size_t size, struct dive *dive)
struct tm tm;
utc_mkdate(dive->when, &tm);
return snprintf(buf, size, "Dive #%d - %s %02d/%02d/%04d at %d:%02d",
return snprintf(buf, size, _("Dive #%d - %s %02d/%02d/%04d at %d:%02d"),
dive->number,
weekday(tm.tm_wday),
tm.tm_mon+1, tm.tm_mday,
@ -140,7 +141,7 @@ void show_dive_info(struct dive *dive)
if (!text)
text = "";
if (*text) {
snprintf(buffer, sizeof(buffer), "Dive #%d - %s", dive->number, text);
snprintf(buffer, sizeof(buffer), _("Dive #%d - %s"), dive->number, text);
} else {
divename(buffer, sizeof(buffer), dive);
}
@ -174,7 +175,7 @@ static int delete_dive_info(struct dive *dive)
if (!dive)
return 0;
dialog = gtk_dialog_new_with_buttons("Delete Dive",
dialog = gtk_dialog_new_with_buttons(_("Delete Dive"),
GTK_WINDOW(main_window),
GTK_DIALOG_DESTROY_WITH_PARENT,
GTK_STOCK_OK, GTK_RESPONSE_ACCEPT,
@ -223,8 +224,8 @@ static void add_menu_item(GtkMenu *menu, const char *label, const char *icon, vo
static void populate_popup_cb(GtkTextView *entry, GtkMenu *menu, gpointer user_data)
{
add_menu_item(menu, "Delete", GTK_STOCK_DELETE, info_menu_delete_cb);
add_menu_item(menu, "Edit", GTK_STOCK_EDIT, info_menu_edit_cb);
add_menu_item(menu, _("Delete"), GTK_STOCK_DELETE, info_menu_delete_cb);
add_menu_item(menu, _("Edit"), GTK_STOCK_EDIT, info_menu_edit_cb);
}
static GtkEntry *text_value(GtkWidget *box, const char *label)
@ -449,17 +450,17 @@ static void save_dive_info_changes(struct dive *dive, struct dive *master, struc
static void dive_trip_widget(GtkWidget *box, dive_trip_t *trip, struct dive_info *info)
{
GtkWidget *hbox, *label;
char buffer[80] = "Edit trip summary";
char buffer[80] = N_("Edit trip summary");
label = gtk_label_new(buffer);
label = gtk_label_new(_(buffer));
gtk_box_pack_start(GTK_BOX(box), label, FALSE, TRUE, 0);
info->location = text_entry(box, "Location", location_list, trip->location);
info->location = text_entry(box, _("Location"), location_list, trip->location);
hbox = gtk_hbox_new(FALSE, 3);
gtk_box_pack_start(GTK_BOX(box), hbox, FALSE, TRUE, 0);
info->notes = text_view(box, "Notes", READ_WRITE);
info->notes = text_view(box, _("Notes"), READ_WRITE);
if (trip->notes && *trip->notes)
gtk_text_buffer_set_text(gtk_text_view_get_buffer(info->notes), trip->notes, -1);
}
@ -467,32 +468,32 @@ static void dive_trip_widget(GtkWidget *box, dive_trip_t *trip, struct dive_info
static void dive_info_widget(GtkWidget *box, struct dive *dive, struct dive_info *info, gboolean multi)
{
GtkWidget *hbox, *label, *frame, *equipment;
char buffer[80] = "Edit multiple dives";
char buffer[80] = N_("Edit multiple dives");
if (!multi)
divename(buffer, sizeof(buffer), dive);
label = gtk_label_new(buffer);
divename(_(buffer), sizeof(_(buffer)), dive);
label = gtk_label_new(_(buffer));
gtk_box_pack_start(GTK_BOX(box), label, FALSE, TRUE, 0);
info->location = text_entry(box, "Location", location_list, dive->location);
info->location = text_entry(box, _("Location"), location_list, dive->location);
hbox = gtk_hbox_new(FALSE, 3);
gtk_box_pack_start(GTK_BOX(box), hbox, FALSE, TRUE, 0);
info->divemaster = text_entry(hbox, "Dive master", people_list, dive->divemaster);
info->buddy = text_entry(hbox, "Buddy", people_list, dive->buddy);
info->divemaster = text_entry(hbox, _("Dive master"), people_list, dive->divemaster);
info->buddy = text_entry(hbox, _("Buddy"), people_list, dive->buddy);
hbox = gtk_hbox_new(FALSE, 3);
gtk_box_pack_start(GTK_BOX(box), hbox, FALSE, TRUE, 0);
info->rating = text_entry(hbox, "Rating", star_list, star_strings[dive->rating]);
info->suit = text_entry(hbox, "Suit", suit_list, dive->suit);
info->rating = text_entry(hbox, _("Rating"), star_list, star_strings[dive->rating]);
info->suit = text_entry(hbox, _("Suit"), suit_list, dive->suit);
/* only show notes if editing a single dive */
if (multi) {
info->notes = NULL;
} else {
info->notes = text_view(box, "Notes", READ_WRITE);
info->notes = text_view(box, _("Notes"), READ_WRITE);
if (dive->notes && *dive->notes)
gtk_text_buffer_set_text(gtk_text_view_get_buffer(info->notes), dive->notes, -1);
}
@ -500,7 +501,7 @@ static void dive_info_widget(GtkWidget *box, struct dive *dive, struct dive_info
gtk_box_pack_start(GTK_BOX(box), hbox, FALSE, TRUE, 0);
/* create a secondary Equipment widget */
frame = gtk_frame_new("Equipment");
frame = gtk_frame_new(_("Equipment"));
equipment = equipment_widget(W_IDX_SECONDARY);
gtk_container_add(GTK_CONTAINER(frame), equipment);
gtk_box_pack_start(GTK_BOX(hbox), frame, FALSE, TRUE, 0);
@ -624,7 +625,7 @@ gboolean edit_trip(dive_trip_t *trip)
struct dive_info info;
memset(&info, 0, sizeof(struct dive_info));
dialog = gtk_dialog_new_with_buttons("Edit Trip Info",
dialog = gtk_dialog_new_with_buttons(_("Edit Trip Info"),
GTK_WINDOW(main_window),
GTK_DIALOG_DESTROY_WITH_PARENT,
GTK_STOCK_OK, GTK_RESPONSE_ACCEPT,
@ -665,7 +666,7 @@ int edit_multi_dive_info(struct dive *single_dive)
struct dive *master;
gboolean multi;
dialog = gtk_dialog_new_with_buttons("Dive Info",
dialog = gtk_dialog_new_with_buttons(_("Dive Info"),
GTK_WINDOW(main_window),
GTK_DIALOG_DESTROY_WITH_PARENT,
GTK_STOCK_OK, GTK_RESPONSE_ACCEPT,
@ -772,7 +773,7 @@ static timestamp_t dive_time_widget(struct dive *dive)
int success;
double depthinterval, val;
dialog = gtk_dialog_new_with_buttons("Date and Time",
dialog = gtk_dialog_new_with_buttons(_("Date and Time"),
GTK_WINDOW(main_window),
GTK_DIALOG_DESTROY_WITH_PARENT,
GTK_STOCK_OK, GTK_RESPONSE_ACCEPT,
@ -782,12 +783,12 @@ static timestamp_t dive_time_widget(struct dive *dive)
vbox = gtk_dialog_get_content_area(GTK_DIALOG(dialog));
/* Calendar hbox */
hbox = frame_box(vbox, "Date:");
hbox = frame_box(vbox, _("Date:"));
cal = gtk_calendar_new();
gtk_box_pack_start(GTK_BOX(hbox), cal, FALSE, TRUE, 0);
/* Time hbox */
hbox = frame_box(vbox, "Time");
hbox = frame_box(vbox, _("Time"));
h = gtk_spin_button_new_with_range (0.0, 23.0, 1.0);
m = gtk_spin_button_new_with_range (0.0, 59.0, 1.0);
@ -827,12 +828,12 @@ static timestamp_t dive_time_widget(struct dive *dive)
gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0);
/* Duration hbox */
box = frame_box(hbox, "Duration (min)");
box = frame_box(hbox, _("Duration (min)"));
duration = gtk_spin_button_new_with_range (0.0, 1000.0, 1.0);
gtk_box_pack_end(GTK_BOX(box), duration, FALSE, FALSE, 0);
/* Depth box */
box = frame_box(hbox, "Depth (%s):", output_units.length == FEET ? "ft" : "m");
box = frame_box(hbox, _("Depth (%s):"), output_units.length == FEET ? "ft" : "m");
if (output_units.length == FEET) {
depthinterval = 1.0;
} else {
@ -901,20 +902,20 @@ GtkWidget *extended_dive_info_widget(void)
suit_list = gtk_list_store_new(1, G_TYPE_STRING);
gtk_container_set_border_width(GTK_CONTAINER(vbox), 6);
location = text_value(vbox, "Location");
location = text_value(vbox, _("Location"));
hbox = gtk_hbox_new(FALSE, 3);
gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, TRUE, 0);
divemaster = text_value(hbox, "Divemaster");
buddy = text_value(hbox, "Buddy");
divemaster = text_value(hbox, _("Divemaster"));
buddy = text_value(hbox, _("Buddy"));
hbox = gtk_hbox_new(FALSE, 3);
gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, TRUE, 0);
rating = text_value(hbox, "Rating");
suit = text_value(hbox, "Suit");
rating = text_value(hbox, _("Rating"));
suit = text_value(hbox, _("Suit"));
notes = text_view(vbox, "Notes", READ_ONLY);
notes = text_view(vbox, _("Notes"), READ_ONLY);
return vbox;
}

View file

@ -2,6 +2,7 @@
#include <pthread.h>
#include <unistd.h>
#include <inttypes.h>
#include <glib/gi18n.h>
#include "dive.h"
#include "divelist.h"

22
main.c
View file

@ -1,8 +1,11 @@
/* main.c */
#include <locale.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <time.h>
#include <libintl.h>
#include <glib/gi18n.h>
#include "dive.h"
#include "divelist.h"
@ -29,17 +32,19 @@ static int sortfn(const void *_a, const void *_b)
const char *weekday(int wday)
{
static const char wday_array[7][4] = {
"Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"
static const char wday_array[7][7] = {
/*++GETTEXT: these are three letter days - we allow up to six code bytes */
N_("Sun"), N_("Mon"), N_("Tue"), N_("Wed"), N_("Thu"), N_("Fri"), N_("Sat")
};
return wday_array[wday];
}
const char *monthname(int mon)
{
static const char month_array[12][4] = {
"Jan", "Feb", "Mar", "Apr", "May", "Jun",
"Jul", "Aug", "Sep", "Oct", "Nov", "Dec",
static const char month_array[12][7] = {
/*++GETTEXT: these are three letter months - we allow up to six code bytes*/
N_("Jan"), N_("Feb"), N_("Mar"), N_("Apr"), N_("May"), N_("Jun"),
N_("Jul"), N_("Aug"), N_("Sep"), N_("Oct"), N_("Nov"), N_("Dec"),
};
return month_array[mon];
}
@ -221,6 +226,13 @@ int main(int argc, char **argv)
int i;
gboolean no_filenames = TRUE;
/* set up l18n - the search directory needs to change
* so that it uses the correct system directory when
* subsurface isn't run from the local directory */
setlocale( LC_ALL, "" );
bindtextdomain("subsurface", "./locale");
bind_textdomain_codeset("subsurface", "utf-8");
textdomain("subsurface");
output_units = SI_units;
subsurface_command_line_init(&argc, &argv);

View file

@ -11,6 +11,7 @@
#ifdef XSLT
#include <libxslt/transform.h>
#endif
#include <glib/gi18n.h>
#include "dive.h"
#include "uemis.h"
@ -1462,12 +1463,12 @@ void parse_xml_buffer(const char *url, const char *buffer, int size, GError **er
doc = xmlReadMemory(buffer, size, url, NULL, 0);
if (!doc) {
fprintf(stderr, "Failed to parse '%s'.\n", url);
fprintf(stderr, _("Failed to parse '%s'.\n"), url);
if (error != NULL)
{
*error = g_error_new(g_quark_from_string("subsurface"),
DIVE_ERROR_PARSE,
"Failed to parse '%s'",
_("Failed to parse '%s'"),
url);
}
return;

971
po/deutsch.po Normal file
View file

@ -0,0 +1,971 @@
# German translations for PACKAGE package
# German messages for PACKAGE.
# Copyright (C) 2012 THE PACKAGE'S COPYRIGHT HOLDER
# This file is distributed under the same license as the PACKAGE package.
# Dirk Hohndel <dirk@hohndel.org>, 2012.
#
msgid ""
msgstr ""
"Project-Id-Version: 2.0.1\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2012-10-11 07:42+0900\n"
"PO-Revision-Date: 2012-10-10 16:27+0900\n"
"Last-Translator: Dirk Hohndel <dirk@hohndel.org>\n"
"Language-Team: German\n"
"Language: de\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"
#: statistics.c:160
msgid ""
"\n"
"Average"
msgstr ""
"\n"
"Durchschnitt"
#: statistics.c:161
msgid ""
"\n"
"Longest"
msgstr ""
"\n"
"längster"
#: statistics.c:162 statistics.c:163
msgid ""
"\n"
"Maximum"
msgstr ""
"\n"
"Grösste"
#: statistics.c:161 statistics.c:162 statistics.c:163
msgid ""
"\n"
"Minimum"
msgstr ""
"\n"
"Kleinste"
#: statistics.c:161
msgid ""
"\n"
"Shortest"
msgstr ""
"\n"
"Kürzeste"
#: gtk-gui.c:1502
msgid " Please select dive computer and device. "
msgstr " Bitte Tauchcomputer und Gerät auswählen. "
#: statistics.c:601 statistics.c:603 statistics.c:605
#, c-format
msgid "%.*f %s/min"
msgstr "%.*f %s/min"
#: print.c:252 statistics.c:512
#, c-format
msgid "%d min"
msgstr "%d min"
#: statistics.c:484
#, c-format
msgid "%dd %dh %dmin"
msgstr "%dt %dst %dmin"
#: statistics.c:486
#, c-format
msgid "%dh %dmin"
msgstr "%dst %dmin"
#: dive.c:618
#, c-format
msgid "(%s) or (%s)"
msgstr "(%s) oder (%s)"
#: gtk-gui.c:912
msgid "Add Dive"
msgstr "Tauchgang hinzufügen"
#: divelist.c:2019
msgid "Add dive"
msgstr "Tauchgang hinzufügen"
#: divelist.c:2098
msgid "Add to trip above"
msgstr "Zum obigen Trip hinzufügen"
#: main.c:47
msgid "Apr"
msgstr "Apr"
#: main.c:48
msgid "Aug"
msgstr "Aug"
#: gtk-gui.c:927
msgid "Autogroup"
msgstr "Automatisch gruppieren"
#: gtk-gui.c:662
msgid "Automatically group dives in trips"
msgstr "Automatisch die Tauchgänge in Trips gruppieren"
#: statistics.c:668 statistics.c:705
msgid "Avg Depth"
msgstr "Durchschn. Tiefe"
#: statistics.c:676
msgid "Avg SAC"
msgstr "Durchschn. Gasverbrauch"
#: statistics.c:651
msgid "Avg Temp"
msgstr "Durchschn. Temp"
#: statistics.c:658
msgid "Avg Time"
msgstr "Duchschn. Dauer"
#: gtk-gui.c:590
msgid "Bar"
msgstr "bar"
#: info.c:484 info.c:911 print.c:155
msgid "Buddy"
msgstr "Partner"
#: gtk-gui.c:600
msgid "Celsius"
msgstr "Celsius"
#: gtk-gui.c:520
msgid "Choose Default XML File"
msgstr "Default XML Datei auswählen"
#: gtk-gui.c:1396
msgid "Choose XML Files To Import Into Current Data File"
msgstr ""
"Bitte XML Dateien auswählen, die in die aktuelle Datei eingefügt werden "
"sollen"
#: divelist.c:2115
msgid "Collapse all"
msgstr "Alle einfalten"
#: divelist.c:2088
msgid "Create new trip above"
msgstr "Neuen Trip darüber einfügen"
#: gtk-gui.c:596
msgid "CuFt"
msgstr "cuft"
#: divelist.c:1265 gtk-gui.c:620
msgid "Cyl"
msgstr "Tank"
#: equipment.c:926 equipment.c:1062
msgid "Cylinder"
msgstr "Tank"
#: equipment.c:1572
msgid "Cylinders"
msgstr "Tanks"
#: divelist.c:1258 print.c:154 statistics.c:696
msgid "Date"
msgstr "Datum"
#: info.c:776
msgid "Date and Time"
msgstr "Datum und Zeit"
#: info.c:786
msgid "Date:"
msgstr "Datum:"
#: main.c:48
msgid "Dec"
msgstr "Dez"
#: gtk-gui.c:667
msgid "Default XML Data File"
msgstr "Default XML Datei"
#: info.c:227
msgid "Delete"
msgstr "Löschen"
#: info.c:178
msgid "Delete Dive"
msgstr "Tauchgang löschen"
#: divelist.c:2006
msgid "Delete dive"
msgstr "Tauchgang löschen"
#: divelist.c:2005
msgid "Delete dives"
msgstr "Tauchgänge löschen"
#: print.c:154
msgid "Depth"
msgstr "Tiefe"
#: statistics.c:161
msgid ""
"Depth\n"
"Average"
msgstr ""
"Tiefe\n"
"Durchschnitt"
#: info.c:836
#, c-format
msgid "Depth (%s):"
msgstr "Tiefe (%s):"
#: uemis.c:156
msgid "Depth Limit Exceeded"
msgstr "Tiefenschwelle überschritten"
#: gtk-gui.c:584
msgid "Depth:"
msgstr "Tiefe:"
#: gtk-gui.c:1364
msgid "Device name"
msgstr "Geräte Name"
#: print.c:67
#, c-format
msgid "Dive #%d - "
msgstr "Tauchgang #%d - "
#: info.c:144
#, c-format
msgid "Dive #%d - %s"
msgstr "Tauchgang #%d - %s"
#: info.c:106
#, c-format
msgid "Dive #%d - %s %02d/%02d/%04d at %d:%02d"
msgstr "Tauchgang #%d - %s %02d/%02d/%04d um %d:%02d"
#: gtk-gui.c:1120 info.c:669 statistics.c:687
msgid "Dive Info"
msgstr "Informationen"
#: gtk-gui.c:1112
msgid "Dive Notes"
msgstr "Notizen"
#: statistics.c:697
msgid "Dive Time"
msgstr "Startzeit"
#: uemis.c:162
msgid "Dive Time Alert"
msgstr "Alarm: Tauchgangdauer"
#: uemis.c:160
msgid "Dive Time Info"
msgstr "Info: Tauchgangdauer"
#: gtk-gui.c:1333
msgid "Dive computer"
msgstr "Tauchcomputer"
#: print.c:474
msgid "Dive details"
msgstr "Notizen zum Tauchgang"
#: info.c:483
msgid "Dive master"
msgstr "Dive-Master"
#: print.c:154
msgid "Dive#"
msgstr "Tauchgang Nr."
#: gtk-gui.c:650
msgid "Divelist Font"
msgstr "Schriftart für Tauchliste"
#: info.c:910
msgid "Divemaster"
msgstr "Divemaster"
#: statistics.c:648
msgid "Dives"
msgstr "Tauchgänge"
#: gtk-gui.c:911 gtk-gui.c:1494
msgid "Download From Dive Computer"
msgstr "Vom Tauchcomputer runterladen"
#: statistics.c:160
msgid ""
"Duration\n"
"Total"
msgstr ""
"Dauer\n"
"Total"
#: info.c:831
msgid "Duration (min)"
msgstr "Dauer (min)"
#: info.c:228
msgid "Edit"
msgstr "Editieren"
#: info.c:628
msgid "Edit Trip Info"
msgstr "Trip Informationen editieren"
#: divelist.c:2027
msgid "Edit Trip Summary"
msgstr "Trip Übersicht editieren"
#: divelist.c:2003
msgid "Edit dive"
msgstr "Tauchgang editieren"
#: divelist.c:2002
msgid "Edit dives"
msgstr "Tauchgänge editieren"
#: info.c:471
msgid "Edit multiple dives"
msgstr "Mehrere Tauchgänge editieren"
#: info.c:453
msgid "Edit trip summary"
msgstr "Trip Übersicht editieren"
#: gtk-gui.c:771
msgid "Enable / Disable Events"
msgstr "Ereignisse Ein-/Ausblenden"
#: equipment.c:965 equipment.c:1489
msgid "End"
msgstr "Ende"
#: gtk-gui.c:1116 info.c:504
msgid "Equipment"
msgstr "Ausrüstung"
#: divelist.c:2112
msgid "Expand all"
msgstr "Alle ausfalten"
#: gtk-gui.c:601
msgid "Fahrenheit"
msgstr "Fahrenheit"
#: gtk-gui.c:140
#, c-format
msgid "Failed to open %i files."
msgstr "Fehler beim Öffnen von %i Dateien"
#: parse-xml.c:1471
#, c-format
msgid "Failed to parse '%s'"
msgstr "Fehler beim Analysieren von '%s'"
#: parse-xml.c:1466
#, c-format
msgid "Failed to parse '%s'.\n"
msgstr "Fehler beim Analysieren von '%s'.\n"
#: file.c:266
#, c-format
msgid "Failed to read '%s'"
msgstr "Fehler beim Lesen von '%s'"
#: file.c:262
#, c-format
msgid "Failed to read '%s'.\n"
msgstr "Fehler beim Lesen von '%s'.\n"
#: main.c:47
msgid "Feb"
msgstr "Feb"
#: gtk-gui.c:586
msgid "Feet"
msgstr "Fuß"
#: gtk-gui.c:899
msgid "File"
msgstr "Datei"
#: gtk-gui.c:902
msgid "Filter"
msgstr "Filter"
#: main.c:38
msgid "Fri"
msgstr "Fr"
#: statistics.c:715
msgid "Gas Used"
msgstr "Gasverbrauch"
#: equipment.c:975
msgid "Gasmix"
msgstr "Gasmischung"
#: gtk-gui.c:903
msgid "Help"
msgstr "Hilfe"
#: gtk-gui.c:910
msgid "Import XML File(s)"
msgstr "XML Datei(en) einlesen"
#: gtk-gui.c:921
msgid "Info"
msgstr "Informatinen"
#. ++GETTEXT: these are three character months
#: main.c:47
msgid "Jan"
msgstr "Jan"
#: main.c:48
msgid "Jul"
msgstr "Jul"
#: main.c:47
msgid "Jun"
msgstr "Jun"
#: gtk-gui.c:854
msgid "Linus Torvalds, Dirk Hohndel, and others, 2011, 2012"
msgstr "Linus Torvalds, Dirk Hohndel und andere, 2011, 2012"
#: gtk-gui.c:919
msgid "List"
msgstr "Liste"
#: gtk-gui.c:595
msgid "Liter"
msgstr "Liter"
#: divelist.c:1269 info.c:458 info.c:478 info.c:905 print.c:155
msgid "Location"
msgstr "Ort"
#: gtk-gui.c:900
msgid "Log"
msgstr "Log"
#: statistics.c:659
msgid "Longest Dive"
msgstr "Längster Tauchgang"
#: uemis.c:170
msgid "Low Battery Alert"
msgstr "Alarm: Batterie schwach"
#: uemis.c:168
msgid "Low Battery Warning"
msgstr "Warnung: Batterie schwach"
#: main.c:47
msgid "Mar"
msgstr "Mär"
#: uemis.c:164
msgid "Marker"
msgstr "Markierung"
#: print.c:154
msgid "Master"
msgstr "Master"
#: uemis.c:158
msgid "Max Deco Time Warning"
msgstr "Warnung: Maximale Deco Zeit"
#: statistics.c:666 statistics.c:704
msgid "Max Depth"
msgstr "Max. Tiefe"
#: statistics.c:674
msgid "Max SAC"
msgstr "Max. Gasverbrauch"
#: statistics.c:649
msgid "Max Temp"
msgstr "Max. Temp."
#: print.c:94
#, c-format
msgid ""
"Max depth: %.*f %s\n"
"Duration: %d min\n"
"%s"
msgstr ""
"Max. Tiefe: %.*f %s\n"
"Dauer: %d min\n"
"%s"
#: equipment.c:1487
msgid "MaxPress"
msgstr "Max.Druck"
#: main.c:47
msgid "May"
msgstr "Mai"
#: divelist.c:2035
msgid "Merge trip with trip above"
msgstr "Trip mit dem darüber verbinden"
#: divelist.c:2045
msgid "Merge trip with trip below"
msgstr "Trip mit dem darunter verbinden"
#: gtk-gui.c:585
msgid "Meter"
msgstr "Meter"
#: statistics.c:667
msgid "Min Depth"
msgstr "Min. Tiefe"
#: statistics.c:675
msgid "Min SAC"
msgstr "Min. Gasverbrauch"
#: statistics.c:650
msgid "Min Temp"
msgstr "Min. Temp."
#: gtk-gui.c:656
msgid "Misc. Options"
msgstr "Verschiedene Optionen"
#: main.c:38
msgid "Mon"
msgstr "Mo"
#: gtk-gui.c:851
msgid "Multi-platform divelog software in C"
msgstr "Multi-Platform Tauchprogram in C"
#: gtk-gui.c:811
msgid "New starting number"
msgstr "Neue erste Nummer"
#: uemis.c:166
msgid "No Tank Data"
msgstr "Keine Tank Informationen"
#: info.c:463 info.c:496 info.c:919
msgid "Notes"
msgstr "Notizen"
#: main.c:48
msgid "Nov"
msgstr "Nov"
#: divelist.c:1268 gtk-gui.c:635 statistics.c:713
msgid "OTU"
msgstr "OTU"
#: main.c:48
msgid "Oct"
msgstr "Okt"
#: gtk-gui.c:313
msgid "Open File"
msgstr "Datei öffnen"
#: uemis.c:144
msgid "PO2 Ascend Alarm"
msgstr "Alarm: Aufstieg"
#: uemis.c:142
msgid "PO2 Ascend Warning"
msgstr "Warnung: Aufstieg / PO2"
#: uemis.c:139
msgid "PO2 Green Warning"
msgstr "Warnung: PO2 Grün"
#: gtk-gui.c:591
msgid "PSI"
msgstr "psi"
#: gtk-gui.c:570 gtk-gui.c:913
msgid "Preferences"
msgstr "Einstellungen"
#: equipment.c:960
msgid "Pressure"
msgstr "Druck"
#: gtk-gui.c:589
msgid "Pressure:"
msgstr "Druck:"
#: print.c:484
msgid "Pretty print"
msgstr "Schön drucken"
#: print.c:505
msgid "Print only selected dives"
msgstr "Nur ausgewählte Tauchgänge drucken"
#: print.c:500
msgid "Print selection"
msgstr "Auswahl drucken"
#: print.c:478
msgid "Print type"
msgstr "Art des Ausdrucks"
#: gtk-gui.c:920
msgid "Profile"
msgstr "Profil"
#: uemis.c:152
msgid "RGT Alert"
msgstr "Alarm: verbleibende Gas-Zeit"
#: uemis.c:150
msgid "RGT Warning"
msgstr "Warnung: verbleibende Gas-Zeit"
#: info.c:489 info.c:916
msgid "Rating"
msgstr "Bewertung"
#: uemis-downloader.c:267
#, c-format
msgid "Reading dive %s"
msgstr "Lese Tauchgang %s"
#: divelist.c:2050
msgid "Remove Trip"
msgstr "Trip entfernen"
#: divelist.c:2106
msgid "Remove dive from trip"
msgstr "Tauchgang vom Trip entfernen"
#: divelist.c:2104
msgid "Remove selected dives from trip"
msgstr "Ausgewählte Tauchgänge vom Trip entfernen"
#: gtk-gui.c:802 gtk-gui.c:914
msgid "Renumber"
msgstr "Neu nummerieren"
#: gtk-gui.c:1471
msgid "Retry"
msgstr "Wiederholen"
#: divelist.c:1267 gtk-gui.c:630 statistics.c:712
msgid "SAC"
msgstr "Gasverbrauchsrate"
#: statistics.c:162
msgid ""
"SAC\n"
"Average"
msgstr ""
"Gasverbrauchsrate\n"
"Durchschnitt"
#: file.c:75
msgid "SDE file"
msgstr "SDE Datei"
#: uemis.c:132
msgid "Safety Stop Violation"
msgstr "Verletzung des Sicherheitsstops"
#: main.c:38
msgid "Sat"
msgstr "Sa"
#: gtk-gui.c:228
msgid "Save Changes?"
msgstr "Änderungen speichern?"
#: gtk-gui.c:165
msgid "Save File As"
msgstr "Datei speichern unter"
#: gtk-gui.c:762 gtk-gui.c:916
msgid "SelectEvents"
msgstr "Ereignisse auswählen"
#: main.c:48
msgid "Sep"
msgstr "Sep"
#: uemis-downloader.c:30
msgid ""
"Short write to req.txt file\n"
"Is the Uemis Zurich plugged in correctly?"
msgstr ""
"Partieller Schreibvorgang der req.txt Datei\n"
"Ist der Uemis Zurich korrekt verbunden?"
#: statistics.c:660
msgid "Shortest Dive"
msgstr "Kürzester Tauchgang"
#: gtk-gui.c:609
msgid "Show Columns"
msgstr "Spalten anzeigen"
#: equipment.c:1486
msgid "Size"
msgstr "Größe"
#: uemis.c:134
msgid "Speed Alarm"
msgstr "Alarm: Geschwindigkeit"
#: uemis.c:137
msgid "Speed Warning"
msgstr "Warnung: Geschwindigkeit"
#: equipment.c:962 equipment.c:1488
msgid "Start"
msgstr "Start"
#: statistics.c:640
msgid "Statistics"
msgstr "Statistiken"
#: gtk-gui.c:1124
msgid "Stats"
msgstr "Statistiken"
#: divelist.c:1264 gtk-gui.c:645 info.c:490 info.c:917
msgid "Suit"
msgstr "Taucheranzug"
#. ++GETTEXT: these are three character days
#: main.c:38
msgid "Sun"
msgstr "So"
#: statistics.c:698
msgid "Surf Intv"
msgstr "Oberflächenzeit"
#: print.c:488
msgid "Table print"
msgstr "Tabellenausdruck"
#: uemis.c:154
msgid "Tank Change Suggested"
msgstr "Tank-Wechsel Vorschlag"
#: uemis.c:148
msgid "Tank Pressure Info"
msgstr "Info: Tankdruck"
#: gtk-gui.c:615
msgid "Temp"
msgstr "Temperatur"
#: statistics.c:162
msgid ""
"Temperature\n"
"Average"
msgstr ""
"Temperatur\n"
"Durchschnitt"
#: gtk-gui.c:599
msgid "Temperature:"
msgstr "Temperatur:"
#: gtk-gui.c:922
msgid "Three"
msgstr "Drei"
#: main.c:38
msgid "Thu"
msgstr "Do"
#: info.c:791 print.c:154
msgid "Time"
msgstr "Zeit"
#: gtk-gui.c:928
msgid "Toggle Zoom"
msgstr "Zoom ein-/ausschalten"
#: statistics.c:657
msgid "Total Time"
msgstr "Gesamtzeit"
#: main.c:38
msgid "Tue"
msgstr "Di"
#: equipment.c:1485 equipment.c:1513
msgid "Type"
msgstr "Typ"
#: uemis-downloader.c:28
msgid ""
"Uemis Zurich: File System is almost full\n"
"Disconnect/reconnect the dive computer\n"
"and try again"
msgstr ""
"Uemis Zurich: Dateisystem beinahe voll\n"
"Bitte den Tauchcomputer ausstecken und wieder einstecken\n"
"und erneut versuchen"
#: uemis-downloader.c:29
msgid ""
"Uemis Zurich: File System is full\n"
"Disconnect/reconnect the dive computer\n"
"and try again"
msgstr ""
"Uemis Zurich: Dateisystem voll\n"
"Bitte den Tauchcomputer ausstecken und wieder einstecken\n"
"und erneut versuchen"
#: uemis-downloader.c:559
msgid "Uemis init failed"
msgstr "Uemis Initialisierung fehlgeschlagen"
#: gtk-gui.c:577
msgid "Units"
msgstr "Einheiten"
#: gtk-gui.c:901
msgid "View"
msgstr "Ansicht"
#: gtk-gui.c:594
msgid "Volume:"
msgstr "Volumen:"
#: statistics.c:706
msgid "Water Temp"
msgstr "Wassertemperatur"
#: main.c:38
msgid "Wed"
msgstr "Mi"
#: equipment.c:1012 equipment.c:1609 gtk-gui.c:640
msgid "Weight"
msgstr "Gewicht"
#: equipment.c:1117
msgid "Weight System"
msgstr "Gewicht"
#: gtk-gui.c:604
msgid "Weight:"
msgstr "Gewicht:"
#: gtk-gui.c:153
msgid "XML file"
msgstr "XML Datei"
#: statistics.c:160
msgid ""
"Year\n"
" > Month"
msgstr ""
"Jahr\n"
" > Monat"
#: gtk-gui.c:915 statistics.c:345
msgid "Yearly Statistics"
msgstr "Jährliche Statistiken"
#: gtk-gui.c:238
msgid ""
"You have unsaved changes\n"
"Would you like to save those before closing the datafile?"
msgstr ""
"Nicht alle Änderungen wurden gespeichert.\n"
"Sollen Änderungen vor dem Schließen der Datei gespeichert werden_"
#: gtk-gui.c:242
#, c-format
msgid ""
"You have unsaved changes to file: %s \n"
"Would you like to save those before closing the datafile?"
msgstr ""
"Nicht alle Änderungen in der Dati %s wurden gespeichert.\n"
"Sollen Änderungen vor dem Schließen der Datei gespeichert werden_"
#: equipment.c:824
msgid "ankle"
msgstr "Fuß"
#: equipment.c:825
msgid "bar"
msgstr "bar"
#: equipment.c:823
msgid "belt"
msgstr "Gürtel"
#: equipment.c:826
msgid "clip-on"
msgstr "clip-on"
#: divelist.c:1260
msgid "ft"
msgstr "ft"
#: equipment.c:822
msgid "integrated"
msgstr "integriert"
#: gtk-gui.c:605
msgid "kg"
msgstr "kg"
#: divelist.c:1263 gtk-gui.c:606
msgid "lbs"
msgstr "US Pfund"
#: divelist.c:1261
msgid "min"
msgstr "min"
#: statistics.c:478
#, c-format
msgid "more than %d days"
msgstr "mehr als %d Tage"
#: equipment.c:1378 equipment.c:1398
msgid "unkn"
msgstr "unbk"
#: statistics.c:517
msgid "unknown"
msgstr "unbekannt"
#: equipment.c:544
msgid "unspecified"
msgstr "nicht angegeben"
#: equipment.c:1514
msgid "weight"
msgstr "Gewicht"

33
print.c
View file

@ -1,3 +1,4 @@
#include <glib/gi18n.h>
#include <stdio.h>
#include <string.h>
#include <stdarg.h>
@ -63,7 +64,7 @@ static void show_dive_text(struct dive *dive, cairo_t *cr, double w,
*divenr = 0;
if (dive->number)
snprintf(divenr, sizeof(divenr), "Dive #%d - ", dive->number);
snprintf(divenr, sizeof(divenr), _("Dive #%d - "), dive->number);
utc_mkdate(dive->when, &tm);
len = snprintf(buffer, sizeof(buffer),
@ -90,9 +91,7 @@ static void show_dive_text(struct dive *dive, cairo_t *cr, double w,
depth = get_depth_units(dive->maxdepth.mm, &decimals, &unit);
snprintf(buffer, sizeof(buffer),
"Max depth: %.*f %s\n"
"Duration: %d min\n"
"%s",
_("Max depth: %.*f %s\nDuration: %d min\n%s"),
decimals, depth, unit,
(dive->duration.seconds+59) / 60,
people);
@ -152,8 +151,8 @@ static void show_table_header(cairo_t *cr, double w, double h,
int i;
double maxwidth, maxheight, colwidth, curwidth;
PangoLayout *layout;
char headers[7][80]= { "Dive#", "Date", "Depth", "Time", "Master",
"Buddy", "Location" };
char headers[7][80]= { N_("Dive#"), N_("Date"), N_("Depth"), N_("Time"), N_("Master"),
N_("Buddy"), N_("Location") };
maxwidth = w * PANGO_SCALE;
maxheight = h * PANGO_SCALE * 0.9;
@ -177,7 +176,7 @@ static void show_table_header(cairo_t *cr, double w, double h,
pango_layout_set_width(layout, colwidth);
curwidth = curwidth + colwidth;
}
pango_layout_set_text(layout, headers[i], -1);
pango_layout_set_text(layout, _(headers[i]), -1);
pango_layout_set_justify(layout, 1);
pango_cairo_show_layout(cr, layout);
}
@ -250,7 +249,7 @@ static void show_dive_table(struct dive *dive, cairo_t *cr, double w,
// Col 4: Time
len = snprintf(buffer, sizeof(buffer),
"%d min",(dive->duration.seconds+59) / 60);
_("%d min"),(dive->duration.seconds+59) / 60);
cairo_move_to(cr, curwidth / PANGO_SCALE, 0);
pango_layout_set_width(layout, colwidth/ (double) 2);
pango_layout_set_text(layout, buffer, len);
@ -472,21 +471,21 @@ static GtkWidget *print_dialog(GtkPrintOperation *operation, gpointer user_data)
{
GtkWidget *vbox, *radio1, *radio2, *frame, *box;
int dives;
gtk_print_operation_set_custom_tab_label(operation, "Dive details");
gtk_print_operation_set_custom_tab_label(operation, _("Dive details"));
vbox = gtk_vbox_new(TRUE, 5);
frame = gtk_frame_new("Print type");
frame = gtk_frame_new(_("Print type"));
gtk_box_pack_start(GTK_BOX(vbox), frame, FALSE, FALSE, 1);
box = gtk_hbox_new(FALSE, 2);
gtk_container_add(GTK_CONTAINER(frame), box);
radio1 = gtk_radio_button_new_with_label (NULL, "Pretty print");
radio1 = gtk_radio_button_new_with_label (NULL, _("Pretty print"));
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(radio1),
print_options.type == PRETTY);
radio2 = gtk_radio_button_new_with_label_from_widget (
GTK_RADIO_BUTTON (radio1), "Table print");
GTK_RADIO_BUTTON (radio1), _("Table print"));
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(radio2),
print_options.type == TABLE);
gtk_box_pack_start (GTK_BOX (box), radio1, TRUE, TRUE, 0);
@ -498,12 +497,12 @@ static GtkWidget *print_dialog(GtkPrintOperation *operation, gpointer user_data)
dives = nr_selected_dives();
print_options.print_selected = dives >= 1;
if (print_options.print_selected) {
frame = gtk_frame_new("Print selection");
gtk_box_pack_start(GTK_BOX(vbox), frame, FALSE, FALSE, 1);
box = gtk_hbox_new(FALSE, 1);
gtk_container_add(GTK_CONTAINER(frame), box);
frame = gtk_frame_new(_("Print selection"));
gtk_box_pack_start(GTK_BOX(vbox), frame, FALSE, FALSE, 1);
box = gtk_hbox_new(FALSE, 1);
gtk_container_add(GTK_CONTAINER(frame), box);
GtkWidget *button;
button = gtk_check_button_new_with_label("Print only selected dives");
button = gtk_check_button_new_with_label(_("Print only selected dives"));
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(button),
print_options.print_selected);
gtk_box_pack_start(GTK_BOX(box), button, FALSE, FALSE, 2);

View file

@ -2,6 +2,7 @@
/* creates all the necessary data for drawing the dive profile
* uses cairo to draw it
*/
#include <glib/gi18n.h>
#include <stdio.h>
#include <stdlib.h>
#include <stdarg.h>

View file

@ -8,6 +8,7 @@
* called from gtk-ui:
* GtkWidget *stats_widget(void)
*/
#include <glib/gi18n.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
@ -156,15 +157,15 @@ static void init_tree()
renderer = gtk_cell_renderer_text_new ();
char *columns[] = {
"Year\n > Month", "#", "Duration\nTotal", "\nAverage",
"\nShortest", "\nLongest", "Depth\nAverage", "\nMinimum",
"\nMaximum", "SAC\nAverage", "\nMinimum", "\nMaximum", "Temperature\nAverage",
"\nMinimum", "\nMaximum" };
N_("Year\n > Month"), "#", N_("Duration\nTotal"), N_("\nAverage"),
N_("\nShortest"), N_("\nLongest"), N_("Depth\nAverage"), N_("\nMinimum"),
N_("\nMaximum"), N_("SAC\nAverage"), N_("\nMinimum"), N_("\nMaximum"), N_("Temperature\nAverage"),
N_("\nMinimum"), N_("\nMaximum") };
/* Add all the columns to the tree view */
for (i = 0; i < N_COLUMNS; ++i) {
column = gtk_tree_view_column_new();
gtk_tree_view_column_set_title(column, columns[i]);
gtk_tree_view_column_set_title(column, _(columns[i]));
gtk_tree_view_append_column(GTK_TREE_VIEW(yearly_tree), column);
renderer = gtk_cell_renderer_text_new();
gtk_tree_view_column_pack_start(column, renderer, TRUE);
@ -341,7 +342,7 @@ void show_yearly_stats()
gtk_window_set_position(GTK_WINDOW(window), GTK_WIN_POS_CENTER);
gtk_window_set_default_size(GTK_WINDOW(window), 640, 480);
gtk_window_set_title(GTK_WINDOW(window), "Yearly Statistics");
gtk_window_set_title(GTK_WINDOW(window), _("Yearly Statistics"));
gtk_container_set_border_width(GTK_CONTAINER(window), 5);
GTK_WINDOW(window)->allow_shrink = TRUE;
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (sw), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
@ -474,15 +475,15 @@ static char * get_time_string(int seconds, int maxdays)
{
static char buf[80];
if (maxdays && seconds > 3600 * 24 * maxdays)
snprintf(buf, sizeof(buf), "more than %d days", maxdays);
snprintf(buf, sizeof(buf), _("more than %d days"), maxdays);
else {
int days = seconds / 3600 / 24;
int hours = (seconds - days * 3600 * 24) / 3600;
int minutes = (seconds - days * 3600 * 24 - hours * 3600) / 60;
if (days > 0)
snprintf(buf, sizeof(buf), "%dd %dh %dmin", days, hours, minutes);
snprintf(buf, sizeof(buf), _("%dd %dh %dmin"), days, hours, minutes);
else
snprintf(buf, sizeof(buf), "%dh %dmin", hours, minutes);
snprintf(buf, sizeof(buf), _("%dh %dmin"), hours, minutes);
}
return buf;
}
@ -508,12 +509,12 @@ static void show_single_dive_stats(struct dive *dive)
tm.tm_hour, tm.tm_min);
set_label(single_w.date, buf);
set_label(single_w.dive_time, "%d min", (dive->duration.seconds + 30) / 60);
set_label(single_w.dive_time, _("%d min"), (dive->duration.seconds + 30) / 60);
if (prev_dive)
set_label(single_w.surf_intv,
get_time_string(dive->when - (prev_dive->when + prev_dive->duration.seconds), 4));
else
set_label(single_w.surf_intv, "unknown");
set_label(single_w.surf_intv, _("unknown"));
value = get_depth_units(dive->maxdepth.mm, &decimals, &unit);
set_label(single_w.max_depth, "%.*f %s", decimals, value, unit);
value = get_depth_units(dive->meandepth.mm, &decimals, &unit);
@ -597,11 +598,11 @@ static void show_total_dive_stats(struct dive *dive)
value = get_depth_units(stats_ptr->avg_depth.mm, &decimals, &unit);
set_label(stats_w.avg_overall_depth, "%.*f %s", decimals, value, unit);
value = get_volume_units(stats_ptr->max_sac.mliter, &decimals, &unit);
set_label(stats_w.max_sac, "%.*f %s/min", decimals, value, unit);
set_label(stats_w.max_sac, _("%.*f %s/min"), decimals, value, unit);
value = get_volume_units(stats_ptr->min_sac.mliter, &decimals, &unit);
set_label(stats_w.min_sac, "%.*f %s/min", decimals, value, unit);
set_label(stats_w.min_sac, _("%.*f %s/min"), decimals, value, unit);
value = get_volume_units(stats_ptr->avg_sac.mliter, &decimals, &unit);
set_label(stats_w.avg_sac, "%.*f %s/min", decimals, value, unit);
set_label(stats_w.avg_sac, _("%.*f %s/min"), decimals, value, unit);
}
void show_dive_stats(struct dive *dive)
@ -636,7 +637,7 @@ GtkWidget *total_stats_widget(void)
vbox = gtk_vbox_new(FALSE, 3);
statsframe = gtk_frame_new("Statistics");
statsframe = gtk_frame_new(_("Statistics"));
gtk_box_pack_start(GTK_BOX(vbox), statsframe, TRUE, FALSE, 3);
framebox = gtk_vbox_new(FALSE, 3);
gtk_container_add(GTK_CONTAINER(statsframe), framebox);
@ -644,35 +645,35 @@ GtkWidget *total_stats_widget(void)
/* first row */
hbox = gtk_hbox_new(FALSE, 3);
gtk_box_pack_start(GTK_BOX(framebox), hbox, TRUE, FALSE, 3);
stats_w.selection_size = new_info_label_in_frame(hbox, "Dives");
stats_w.max_temp = new_info_label_in_frame(hbox, "Max Temp");
stats_w.min_temp = new_info_label_in_frame(hbox, "Min Temp");
stats_w.avg_temp = new_info_label_in_frame(hbox, "Avg Temp");
stats_w.selection_size = new_info_label_in_frame(hbox, _("Dives"));
stats_w.max_temp = new_info_label_in_frame(hbox, _("Max Temp"));
stats_w.min_temp = new_info_label_in_frame(hbox, _("Min Temp"));
stats_w.avg_temp = new_info_label_in_frame(hbox, _("Avg Temp"));
/* second row */
hbox = gtk_hbox_new(FALSE, 3);
gtk_box_pack_start(GTK_BOX(framebox), hbox, TRUE, FALSE, 3);
stats_w.total_time = new_info_label_in_frame(hbox, "Total Time");
stats_w.avg_time = new_info_label_in_frame(hbox, "Avg Time");
stats_w.longest_time = new_info_label_in_frame(hbox, "Longest Dive");
stats_w.shortest_time = new_info_label_in_frame(hbox, "Shortest Dive");
stats_w.total_time = new_info_label_in_frame(hbox, _("Total Time"));
stats_w.avg_time = new_info_label_in_frame(hbox, _("Avg Time"));
stats_w.longest_time = new_info_label_in_frame(hbox, _("Longest Dive"));
stats_w.shortest_time = new_info_label_in_frame(hbox, _("Shortest Dive"));
/* third row */
hbox = gtk_hbox_new(FALSE, 3);
gtk_box_pack_start(GTK_BOX(framebox), hbox, TRUE, FALSE, 3);
stats_w.max_overall_depth = new_info_label_in_frame(hbox, "Max Depth");
stats_w.min_overall_depth = new_info_label_in_frame(hbox, "Min Depth");
stats_w.avg_overall_depth = new_info_label_in_frame(hbox, "Avg Depth");
stats_w.max_overall_depth = new_info_label_in_frame(hbox, _("Max Depth"));
stats_w.min_overall_depth = new_info_label_in_frame(hbox, _("Min Depth"));
stats_w.avg_overall_depth = new_info_label_in_frame(hbox, _("Avg Depth"));
/* fourth row */
hbox = gtk_hbox_new(FALSE, 3);
gtk_box_pack_start(GTK_BOX(framebox), hbox, TRUE, FALSE, 3);
stats_w.max_sac = new_info_label_in_frame(hbox, "Max SAC");
stats_w.min_sac = new_info_label_in_frame(hbox, "Min SAC");
stats_w.avg_sac = new_info_label_in_frame(hbox, "Avg SAC");
stats_w.max_sac = new_info_label_in_frame(hbox, _("Max SAC"));
stats_w.min_sac = new_info_label_in_frame(hbox, _("Min SAC"));
stats_w.avg_sac = new_info_label_in_frame(hbox, _("Avg SAC"));
return vbox;
}
@ -683,7 +684,7 @@ GtkWidget *single_stats_widget(void)
vbox = gtk_vbox_new(FALSE, 3);
infoframe = gtk_frame_new("Dive Info");
infoframe = gtk_frame_new(_("Dive Info"));
gtk_box_pack_start(GTK_BOX(vbox), infoframe, TRUE, FALSE, 3);
framebox = gtk_vbox_new(FALSE, 3);
gtk_container_add(GTK_CONTAINER(infoframe), framebox);
@ -692,26 +693,26 @@ GtkWidget *single_stats_widget(void)
hbox = gtk_hbox_new(FALSE, 3);
gtk_box_pack_start(GTK_BOX(framebox), hbox, TRUE, FALSE, 3);
single_w.date = new_info_label_in_frame(hbox, "Date");
single_w.dive_time = new_info_label_in_frame(hbox, "Dive Time");
single_w.surf_intv = new_info_label_in_frame(hbox, "Surf Intv");
single_w.date = new_info_label_in_frame(hbox, _("Date"));
single_w.dive_time = new_info_label_in_frame(hbox, _("Dive Time"));
single_w.surf_intv = new_info_label_in_frame(hbox, _("Surf Intv"));
/* second row */
hbox = gtk_hbox_new(FALSE, 3);
gtk_box_pack_start(GTK_BOX(framebox), hbox, TRUE, FALSE, 3);
single_w.max_depth = new_info_label_in_frame(hbox, "Max Depth");
single_w.avg_depth = new_info_label_in_frame(hbox, "Avg Depth");
single_w.water_temp = new_info_label_in_frame(hbox, "Water Temp");
single_w.max_depth = new_info_label_in_frame(hbox, _("Max Depth"));
single_w.avg_depth = new_info_label_in_frame(hbox, _("Avg Depth"));
single_w.water_temp = new_info_label_in_frame(hbox, _("Water Temp"));
/* third row */
hbox = gtk_hbox_new(FALSE, 3);
gtk_box_pack_start(GTK_BOX(framebox), hbox, TRUE, FALSE, 3);
single_w.sac = new_info_label_in_frame(hbox, "SAC");
single_w.otu = new_info_label_in_frame(hbox, "OTU");
single_w.sac = new_info_label_in_frame(hbox, _("SAC"));
single_w.otu = new_info_label_in_frame(hbox, _("OTU"));
single_w.o2he = new_info_label_in_frame(hbox, "O" UTF8_SUBSCRIPT_2 " / He");
single_w.gas_used = new_info_label_in_frame(hbox, "Gas Used");
single_w.gas_used = new_info_label_in_frame(hbox, _("Gas Used"));
return vbox;
}

1
time.c
View file

@ -1,3 +1,4 @@
#include <glib/gi18n.h>
#include <string.h>
#include "dive.h"

View file

@ -17,15 +17,17 @@
#include <pthread.h>
#include <unistd.h>
#include <string.h>
#include <glib/gi18n.h>
#include "uemis.h"
#include "dive.h"
#include "divelist.h"
#include "display.h"
#include "display-gtk.h"
#define ERR_FS_ALMOST_FULL "Uemis Zurich: File System is almost full\nDisconnect/reconnect the dive computer\nand try again"
#define ERR_FS_FULL "Uemis Zurich: File System is full\nDisconnect/reconnect the dive computer\nand try again"
#define ERR_FS_SHORT_WRITE "Short write to req.txt file\nIs the Uemis Zurich plugged in correctly?"
#define ERR_FS_ALMOST_FULL N_("Uemis Zurich: File System is almost full\nDisconnect/reconnect the dive computer\nand try again")
#define ERR_FS_FULL N_("Uemis Zurich: File System is full\nDisconnect/reconnect the dive computer\nand try again")
#define ERR_FS_SHORT_WRITE N_("Short write to req.txt file\nIs the Uemis Zurich plugged in correctly?")
#define BUFLEN 2048
#define NUM_PARAM_BUFS 6
#define UEMIS_TIMEOUT 100000
@ -262,7 +264,7 @@ static void show_progress(char *buf)
while (*p != '{' && t < tmp + 9)
*t++ = *p++;
*t = '\0';
uemis_info("Reading dive %s", tmp);
uemis_info(_("Reading dive %s"), tmp);
}
}
}
@ -301,11 +303,11 @@ static gboolean uemis_get_answer(const char *path, char *request, int n_param_in
fprintf(debugfile,"::w req.txt \"%s\"\n", sb);
#endif
if (write(reqtxt_file, sb, strlen(sb)) != strlen(sb)) {
*error_text = ERR_FS_SHORT_WRITE;
*error_text = _(ERR_FS_SHORT_WRITE);
return FALSE;
}
if (! next_file(number_of_files)) {
*error_text = ERR_FS_FULL;
*error_text = _(ERR_FS_FULL);
more_files = FALSE;
}
trigger_response(reqtxt_file, "n", filenr, file_length);
@ -334,7 +336,7 @@ static gboolean uemis_get_answer(const char *path, char *request, int n_param_in
assembling_mbuf = FALSE;
if (assembling_mbuf) {
if (! next_file(number_of_files)) {
*error_text = ERR_FS_FULL;
*error_text = _(ERR_FS_FULL);
more_files = FALSE;
assembling_mbuf = FALSE;
}
@ -343,7 +345,7 @@ static gboolean uemis_get_answer(const char *path, char *request, int n_param_in
}
} else {
if (! next_file(number_of_files - 1)) {
*error_text = ERR_FS_FULL;
*error_text = _(ERR_FS_FULL);
more_files = FALSE;
assembling_mbuf = FALSE;
searching = FALSE;
@ -554,7 +556,7 @@ static char *do_uemis_download(struct argument_block *args)
buffer_add(xml_buffer, &xml_buffer_size, "<dives type='uemis'><string></string>\n<list>\n");
uemis_info("Init Communication");
if (! uemis_init(mountpath))
return "Uemis init failed";
return _("Uemis init failed");
if (! uemis_get_answer(mountpath, "getDeviceId", 0, 1, &result))
goto bail;
deviceid = strdup(param_buff[0]);
@ -587,7 +589,7 @@ static char *do_uemis_download(struct argument_block *args)
break;
/* finally, if the memory is getting too full, maybe we better stop, too */
if (progress_bar_fraction > 0.85) {
result = ERR_FS_ALMOST_FULL;
result = _(ERR_FS_ALMOST_FULL);
break;
}
/* clean up mbuf */
@ -601,7 +603,7 @@ static char *do_uemis_download(struct argument_block *args)
goto bail;
if (! strcmp(param_buff[0], "error")) {
if (! strcmp(param_buff[2],"Out of Memory"))
result = ERR_FS_FULL;
result = _(ERR_FS_FULL);
else
result = param_buff[2];
}

37
uemis.c
View file

@ -12,6 +12,7 @@
#include <string.h>
#include <stdint.h>
#include <stdlib.h>
#include <glib/gi18n.h>
#define __USE_XOPEN
#include <time.h>
@ -128,45 +129,45 @@ void uemis_event(struct dive *dive, struct sample *sample, uemis_sample_t *u_sam
uint8_t *flags = u_sample->flags;
if (flags[1] & 0x01)
add_event(dive, sample->time.seconds, 0, 0, 0, "Safety Stop Violation");
add_event(dive, sample->time.seconds, 0, 0, 0, _("Safety Stop Violation"));
if (flags[1] & 0x08)
add_event(dive, sample->time.seconds, 0, 0, 0, "Speed Alarm");
add_event(dive, sample->time.seconds, 0, 0, 0, _("Speed Alarm"));
#if WANT_CRAZY_WARNINGS
if (flags[1] & 0x06) /* both bits 1 and 2 are a warning */
add_event(dive, sample->time.seconds, 0, 0, 0, "Speed Warning");
add_event(dive, sample->time.seconds, 0, 0, 0, _("Speed Warning"));
if (flags[1] & 0x10)
add_event(dive, sample->time.seconds, 0, 0, 0, "PO2 Green Warning");
add_event(dive, sample->time.seconds, 0, 0, 0, _("PO2 Green Warning"));
#endif
if (flags[1] & 0x20)
add_event(dive, sample->time.seconds, 0, 0, 0, "PO2 Ascend Warning");
add_event(dive, sample->time.seconds, 0, 0, 0, _("PO2 Ascend Warning"));
if (flags[1] & 0x40)
add_event(dive, sample->time.seconds, 0, 0, 0, "PO2 Ascend Alarm");
add_event(dive, sample->time.seconds, 0, 0, 0, _("PO2 Ascend Alarm"));
/* flags[2] reflects the deco / time bar
* flags[3] reflects more display details on deco and pO2 */
if (flags[4] & 0x01)
add_event(dive, sample->time.seconds, 0, 0, 0, "Tank Pressure Info");
add_event(dive, sample->time.seconds, 0, 0, 0, _("Tank Pressure Info"));
if (flags[4] & 0x04)
add_event(dive, sample->time.seconds, 0, 0, 0, "RGT Warning");
add_event(dive, sample->time.seconds, 0, 0, 0, _("RGT Warning"));
if (flags[4] & 0x08)
add_event(dive, sample->time.seconds, 0, 0, 0, "RGT Alert");
add_event(dive, sample->time.seconds, 0, 0, 0, _("RGT Alert"));
if (flags[4] & 0x40)
add_event(dive, sample->time.seconds, 0, 0, 0, "Tank Change Suggested");
add_event(dive, sample->time.seconds, 0, 0, 0, _("Tank Change Suggested"));
if (flags[4] & 0x80)
add_event(dive, sample->time.seconds, 0, 0, 0, "Depth Limit Exceeded");
add_event(dive, sample->time.seconds, 0, 0, 0, _("Depth Limit Exceeded"));
if (flags[5] & 0x01)
add_event(dive, sample->time.seconds, 0, 0, 0, "Max Deco Time Warning");
add_event(dive, sample->time.seconds, 0, 0, 0, _("Max Deco Time Warning"));
if (flags[5] & 0x04)
add_event(dive, sample->time.seconds, 0, 0, 0, "Dive Time Info");
add_event(dive, sample->time.seconds, 0, 0, 0, _("Dive Time Info"));
if (flags[5] & 0x08)
add_event(dive, sample->time.seconds, 0, 0, 0, "Dive Time Alert");
add_event(dive, sample->time.seconds, 0, 0, 0, _("Dive Time Alert"));
if (flags[5] & 0x10)
add_event(dive, sample->time.seconds, 0, 0, 0, "Marker");
add_event(dive, sample->time.seconds, 0, 0, 0, _("Marker"));
if (flags[6] & 0x02)
add_event(dive, sample->time.seconds, 0, 0, 0, "No Tank Data");
add_event(dive, sample->time.seconds, 0, 0, 0, _("No Tank Data"));
if (flags[6] & 0x04)
add_event(dive, sample->time.seconds, 0, 0, 0, "Low Battery Warning");
add_event(dive, sample->time.seconds, 0, 0, 0, _("Low Battery Warning"));
if (flags[6] & 0x08)
add_event(dive, sample->time.seconds, 0, 0, 0, "Low Battery Alert");
add_event(dive, sample->time.seconds, 0, 0, 0, _("Low Battery Alert"));
/* flags[7] reflects the little on screen icons that remind of previous
* warnings / alerts - not useful for events */
}