Merge branch 'gettext'

Bring all the localization changes into master in preparation for
Subsurface 2.1
This commit is contained in:
Dirk Hohndel 2012-10-15 09:37:09 -07:00
commit 4b9a59a154
29 changed files with 9068 additions and 263 deletions

View file

@ -119,11 +119,14 @@ endif
LIBS = $(LIBXML2) $(LIBXSLT) $(LIBGTK) $(LIBGCONF2) $(LIBDIVECOMPUTER) $(EXTRALIBS) $(LIBZIP) -lpthread -lm LIBS = $(LIBXML2) $(LIBXSLT) $(LIBGTK) $(LIBGCONF2) $(LIBDIVECOMPUTER) $(EXTRALIBS) $(LIBZIP) -lpthread -lm
MSGLANGS=$(notdir $(wildcard po/*po))
MSGOBJS=$(addprefix locale/,$(MSGLANGS:.po=.UTF-8/LC_MESSAGES/subsurface.mo))
OBJS = main.o dive.o time.o profile.o info.o equipment.o divelist.o \ OBJS = main.o dive.o time.o profile.o info.o equipment.o divelist.o \
parse-xml.o save-xml.o libdivecomputer.o print.o uemis.o uemis-downloader.o \ parse-xml.o save-xml.o libdivecomputer.o print.o uemis.o uemis-downloader.o \
gtk-gui.o statistics.o file.o cochran.o $(OSSUPPORT).o $(RESFILE) gtk-gui.o statistics.o file.o cochran.o $(OSSUPPORT).o $(RESFILE)
$(NAME): $(OBJS) $(NAME): $(OBJS) $(MSGOBJS)
$(CC) $(LDFLAGS) -o $(NAME) $(OBJS) $(LIBS) $(CC) $(LDFLAGS) -o $(NAME) $(OBJS) $(LIBS)
install: $(NAME) install: $(NAME)
@ -152,6 +155,10 @@ install-macosx: $(NAME)
$(INSTALL) $(MACOSXFILES)/Info.plist $(MACOSXINSTALL)/Contents/ $(INSTALL) $(MACOSXFILES)/Info.plist $(MACOSXINSTALL)/Contents/
$(INSTALL) $(ICONFILE) $(MACOSXINSTALL)/Contents/Resources/ $(INSTALL) $(ICONFILE) $(MACOSXINSTALL)/Contents/Resources/
$(INSTALL) $(MACOSXFILES)/Subsurface.icns $(MACOSXINSTALL)/Contents/Resources/ $(INSTALL) $(MACOSXFILES)/Subsurface.icns $(MACOSXINSTALL)/Contents/Resources/
$(INSTALL) -d -m 755 $(addprefix $(MACOSXINSTALL)/Contents/Resources/,$(dir $(MSGOBJS)))
for MSG in $(MSGOBJS); do\
install $$MSG $(MACOSXINSTALL)/Contents/Resources/$$MSG;\
done
file.o: file.c dive.h file.h file.o: file.c dive.h file.h
$(CC) $(CFLAGS) $(GLIB2CFLAGS) $(XML2CFLAGS) $(XSLT) $(ZIP) -c file.c $(CC) $(CFLAGS) $(GLIB2CFLAGS) $(XML2CFLAGS) $(XSLT) $(ZIP) -c file.c
@ -212,8 +219,13 @@ uemis-downloader.o: uemis-downloader.c dive.h uemis.h
$(OSSUPPORT).o: $(OSSUPPORT).c display-gtk.h $(OSSUPPORT).o: $(OSSUPPORT).c display-gtk.h
$(CC) $(CFLAGS) $(OSSUPPORT_CFLAGS) -c $(OSSUPPORT).c $(CC) $(CFLAGS) $(OSSUPPORT_CFLAGS) -c $(OSSUPPORT).c
locale/%.UTF-8/LC_MESSAGES/subsurface.mo: po/%.po
mkdir -p $(dir $@)
msgfmt -c -o $@ po/$*.po
doc: doc:
$(MAKE) -C Documentation doc $(MAKE) -C Documentation doc
clean: clean:
rm -f $(OBJS) *~ $(NAME) $(NAME).exe rm -f $(OBJS) *~ $(NAME) $(NAME).exe
rm -rf locale

3
dive.c
View file

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

1
dive.h
View file

@ -440,6 +440,7 @@ extern const char *star_strings[];
extern const char *default_filename; extern const char *default_filename;
extern const char *existing_filename; extern const char *existing_filename;
extern const char *subsurface_default_filename(void); extern const char *subsurface_default_filename(void);
extern const char *subsurface_gettext_domainpath(void);
extern void subsurface_command_line_init(gint *, gchar ***); extern void subsurface_command_line_init(gint *, gchar ***);
extern void subsurface_command_line_exit(gint *, gchar ***); extern void subsurface_command_line_exit(gint *, gchar ***);
#define AIR_PERMILLE 209 #define AIR_PERMILLE 209

View file

@ -15,6 +15,7 @@
#include <string.h> #include <string.h>
#include <time.h> #include <time.h>
#include <math.h> #include <math.h>
#include <glib/gi18n.h>
#include "divelist.h" #include "divelist.h"
#include "dive.h" #include "dive.h"
@ -1254,25 +1255,25 @@ static struct divelist_column {
int *visible; int *visible;
} dl_column[] = { } dl_column[] = {
[DIVE_NR] = { "#", nr_data_func, NULL, ALIGN_RIGHT | UNSORTABLE }, [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_RATING] = { UTF8_BLACKSTAR, star_data_func, NULL, ALIGN_LEFT },
[DIVE_DEPTH] = { "ft", depth_data_func, NULL, ALIGN_RIGHT }, [DIVE_DEPTH] = { N_("ft"), depth_data_func, NULL, ALIGN_RIGHT },
[DIVE_DURATION] = { "min", duration_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_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_TOTALWEIGHT] = { N_("lbs"), weight_data_func, NULL, ALIGN_RIGHT, &visible_cols.totalweight },
[DIVE_SUIT] = { "Suit", NULL, NULL, ALIGN_LEFT, &visible_cols.suit }, [DIVE_SUIT] = { N_("Suit"), NULL, NULL, ALIGN_LEFT, &visible_cols.suit },
[DIVE_CYLINDER] = { "Cyl", NULL, NULL, 0, &visible_cols.cylinder }, [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_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_SAC] = { N_("SAC"), sac_data_func, NULL, 0, &visible_cols.sac },
[DIVE_OTU] = { "OTU", otu_data_func, NULL, 0, &visible_cols.otu }, [DIVE_OTU] = { N_("OTU"), otu_data_func, NULL, 0, &visible_cols.otu },
[DIVE_LOCATION] = { "Location", NULL, NULL, ALIGN_LEFT }, [DIVE_LOCATION] = { N_("Location"), NULL, NULL, ALIGN_LEFT },
}; };
static GtkTreeViewColumn *divelist_column(struct DiveList *dl, struct divelist_column *col) static GtkTreeViewColumn *divelist_column(struct DiveList *dl, struct divelist_column *col)
{ {
int index = col - &dl_column[0]; int index = col - &dl_column[0];
const char *title = col->header; const char *title = _(col->header);
data_func_t data_func = col->data; data_func_t data_func = col->data;
sort_func_t sort_func = col->sort; sort_func_t sort_func = col->sort;
unsigned int flags = col->flags; unsigned int flags = col->flags;
@ -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) static void popup_divelist_menu(GtkTreeView *tree_view, GtkTreeModel *model, int button, GdkEventButton *event)
{ {
GtkWidget *menu, *menuitem, *image; GtkWidget *menu, *menuitem, *image;
char editlabel[] = "Edit dives"; char editplurallabel[] = N_("Edit dives");
char deletelabel[] = "Delete dives"; char editsinglelabel[] = N_("Edit dive");
char *editlabel;
char deleteplurallabel[] = N_("Delete dives");
char deletesinglelabel[] = N_("Delete dive");
char *deletelabel;
GtkTreePath *path, *prevpath, *nextpath; GtkTreePath *path, *prevpath, *nextpath;
GtkTreeIter iter, previter, nextiter; GtkTreeIter iter, previter, nextiter;
int idx, previdx, nextidx; 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); gtk_tree_model_get(MODEL(dive_list), &iter, DIVE_INDEX, &idx, -1);
menu = gtk_menu_new(); 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); 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); gtk_image_menu_item_set_image(GTK_IMAGE_MENU_ITEM(menuitem), image);
g_signal_connect(menuitem, "activate", G_CALLBACK(add_dive_cb), NULL); 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) { if (idx < 0) {
/* mouse pointer is on a trip summary entry */ /* 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); g_signal_connect(menuitem, "activate", G_CALLBACK(edit_trip_cb), path);
gtk_menu_shell_append(GTK_MENU_SHELL(menu), menuitem); gtk_menu_shell_append(GTK_MENU_SHELL(menu), menuitem);
prevpath = gtk_tree_path_copy(path); 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_iter(MODEL(dive_list), &previter, prevpath)) {
gtk_tree_model_get(MODEL(dive_list), &previter, DIVE_INDEX, &previdx, -1); gtk_tree_model_get(MODEL(dive_list), &previter, DIVE_INDEX, &previdx, -1);
if (previdx < 0) { 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); g_signal_connect(menuitem, "activate", G_CALLBACK(merge_trips_cb), path);
gtk_menu_shell_append(GTK_MENU_SHELL(menu), menuitem); 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)) { if (gtk_tree_model_get_iter(MODEL(dive_list), &nextiter, nextpath)) {
gtk_tree_model_get(MODEL(dive_list), &nextiter, DIVE_INDEX, &nextidx, -1); gtk_tree_model_get(MODEL(dive_list), &nextiter, DIVE_INDEX, &nextidx, -1);
if (nextidx < 0) { 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); g_signal_connect(menuitem, "activate", G_CALLBACK(merge_trips_cb), nextpath);
gtk_menu_shell_append(GTK_MENU_SHELL(menu), menuitem); 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); g_signal_connect(menuitem, "activate", G_CALLBACK(remove_trip_cb), path);
gtk_menu_shell_append(GTK_MENU_SHELL(menu), menuitem); gtk_menu_shell_append(GTK_MENU_SHELL(menu), menuitem);
} else { } 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 we right click on selected dive(s), edit or delete those */
if (dive->selected) { if (dive->selected) {
if (amount_selected == 1) { if (amount_selected == 1) {
deletelabel[strlen(deletelabel) - 1] = '\0'; deletelabel = _(deletesinglelabel);
editlabel[strlen(editlabel) - 1] = '\0'; editlabel = _(editsinglelabel);
} else {
deletelabel = _(deleteplurallabel);
editlabel = _(editplurallabel);
} }
menuitem = gtk_menu_item_new_with_label(deletelabel); menuitem = gtk_menu_item_new_with_label(deletelabel);
g_signal_connect(menuitem, "activate", G_CALLBACK(delete_selected_dives_cb), path); 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); g_signal_connect(menuitem, "activate", G_CALLBACK(edit_selected_dives_cb), NULL);
gtk_menu_shell_append(GTK_MENU_SHELL(menu), menuitem); gtk_menu_shell_append(GTK_MENU_SHELL(menu), menuitem);
} else { } else {
deletelabel[strlen(deletelabel) - 1] = '\0'; deletelabel = _(deletesinglelabel);
menuitem = gtk_menu_item_new_with_label(deletelabel); menuitem = gtk_menu_item_new_with_label(deletelabel);
g_signal_connect(menuitem, "activate", G_CALLBACK(delete_dive_cb), path); g_signal_connect(menuitem, "activate", G_CALLBACK(delete_dive_cb), path);
gtk_menu_shell_append(GTK_MENU_SHELL(menu), menuitem); gtk_menu_shell_append(GTK_MENU_SHELL(menu), menuitem);
editlabel[strlen(editlabel) - 1] = '\0'; editlabel = _(editsinglelabel);
menuitem = gtk_menu_item_new_with_label(editlabel); menuitem = gtk_menu_item_new_with_label(editlabel);
g_signal_connect(menuitem, "activate", G_CALLBACK(edit_dive_from_path_cb), path); g_signal_connect(menuitem, "activate", G_CALLBACK(edit_dive_from_path_cb), path);
gtk_menu_shell_append(GTK_MENU_SHELL(menu), menuitem); 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); int *indices = gtk_tree_path_get_indices(path);
/* top level dive or child dive that is not the first child */ /* top level dive or child dive that is not the first child */
if (depth == 1 || indices[1] > 0) { 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); g_signal_connect(menuitem, "activate", G_CALLBACK(insert_trip_before_cb), path);
gtk_menu_shell_append(GTK_MENU_SHELL(menu), menuitem); 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_path_prev(prevpath) &&
gtk_tree_model_get_iter(MODEL(dive_list), &previter, prevpath) && gtk_tree_model_get_iter(MODEL(dive_list), &previter, prevpath) &&
gtk_tree_model_iter_n_children(model, &previter)) { 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); g_signal_connect(menuitem, "activate", G_CALLBACK(merge_dive_into_trip_above_cb), path);
gtk_menu_shell_append(GTK_MENU_SHELL(menu), menuitem); gtk_menu_shell_append(GTK_MENU_SHELL(menu), menuitem);
} }
if (DIVE_IN_TRIP(dive)) { if (DIVE_IN_TRIP(dive)) {
if (dive->selected && amount_selected > 1) 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 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); g_signal_connect(menuitem, "activate", G_CALLBACK(remove_from_trip_cb), path);
gtk_menu_shell_append(GTK_MENU_SHELL(menu), menuitem); 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); g_signal_connect(menuitem, "activate", G_CALLBACK(expand_all_cb), tree_view);
gtk_menu_shell_append(GTK_MENU_SHELL(menu), menuitem); 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); g_signal_connect(menuitem, "activate", G_CALLBACK(collapse_all_cb), tree_view);
gtk_menu_shell_append(GTK_MENU_SHELL(menu), menuitem); gtk_menu_shell_append(GTK_MENU_SHELL(menu), menuitem);
gtk_widget_show_all(menu); gtk_widget_show_all(menu);

View file

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

7
file.c
View file

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

159
gtk-gui.c
View file

@ -3,6 +3,8 @@
/* creates the window and overall layout /* creates the window and overall layout
* divelist, dive info, equipment and printing are handled in their own source files * divelist, dive info, equipment and printing are handled in their own source files
*/ */
#include <libintl.h>
#include <glib/gi18n.h>
#include <stdio.h> #include <stdio.h>
#include <string.h> #include <string.h>
#include <stdlib.h> #include <stdlib.h>
@ -135,7 +137,7 @@ void report_error(GError* error)
{ {
error_count++; error_count++;
char buffer[256]; 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); 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_pattern(filter, "*.SDA"); gtk_file_filter_add_pattern(filter, "*.SDA");
gtk_file_filter_add_mime_type(filter, "text/xml"); 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; return filter;
} }
@ -160,7 +162,7 @@ static void file_save_as(GtkWidget *w, gpointer data)
char *current_file; char *current_file;
char *current_dir; 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_WINDOW(main_window),
GTK_FILE_CHOOSER_ACTION_SAVE, GTK_FILE_CHOOSER_ACTION_SAVE,
GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
@ -223,7 +225,7 @@ static gboolean ask_save_changes()
{ {
GtkWidget *dialog, *label, *content; GtkWidget *dialog, *label, *content;
gboolean quit = TRUE; 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_WINDOW(main_window), GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT,
GTK_STOCK_SAVE, GTK_RESPONSE_ACCEPT, GTK_STOCK_SAVE, GTK_RESPONSE_ACCEPT,
GTK_STOCK_NO, GTK_RESPONSE_NO, GTK_STOCK_NO, GTK_RESPONSE_NO,
@ -233,11 +235,11 @@ static gboolean ask_save_changes()
if (!existing_filename){ if (!existing_filename){
label = gtk_label_new ( 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 { } else {
char *label_text = (char*) malloc(sizeof(char) * (94 + strlen(existing_filename))); char *label_text = (char*) malloc(sizeof(char) * (94 + strlen(existing_filename)));
sprintf(label_text, 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); existing_filename);
label = gtk_label_new (label_text); label = gtk_label_new (label_text);
free(label_text); free(label_text);
@ -308,7 +310,7 @@ static void file_open(GtkWidget *w, gpointer data)
GtkFileFilter *filter; GtkFileFilter *filter;
const char *current_default; 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_WINDOW(main_window),
GTK_FILE_CHOOSER_ACTION_OPEN, GTK_FILE_CHOOSER_ACTION_OPEN,
GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
@ -515,7 +517,7 @@ static void pick_default_file(GtkWidget *w, GtkButton *button)
GtkFileFilter *filter; GtkFileFilter *filter;
struct stat sb; 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_WINDOW(main_window),
GTK_FILE_CHOOSER_ACTION_SAVE, GTK_FILE_CHOOSER_ACTION_SAVE,
GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
@ -565,57 +567,57 @@ static void preferences_dialog(GtkWidget *w, gpointer data)
menu_units = output_units; menu_units = output_units;
dialog = gtk_dialog_new_with_buttons("Preferences", dialog = gtk_dialog_new_with_buttons(_("Preferences"),
GTK_WINDOW(main_window), GTK_WINDOW(main_window),
GTK_DIALOG_DESTROY_WITH_PARENT, GTK_DIALOG_DESTROY_WITH_PARENT,
GTK_STOCK_OK, GTK_RESPONSE_ACCEPT, GTK_STOCK_OK, GTK_RESPONSE_ACCEPT,
GTK_STOCK_CANCEL, GTK_RESPONSE_REJECT, GTK_STOCK_CANCEL, GTK_RESPONSE_REJECT,
NULL); NULL);
frame = gtk_frame_new("Units"); frame = gtk_frame_new(_("Units"));
vbox = gtk_dialog_get_content_area(GTK_DIALOG(dialog)); vbox = gtk_dialog_get_content_area(GTK_DIALOG(dialog));
gtk_box_pack_start(GTK_BOX(vbox), frame, FALSE, FALSE, 5); gtk_box_pack_start(GTK_BOX(vbox), frame, FALSE, FALSE, 5);
box = gtk_vbox_new(FALSE, 6); box = gtk_vbox_new(FALSE, 6);
gtk_container_add(GTK_CONTAINER(frame), box); gtk_container_add(GTK_CONTAINER(frame), box);
create_radio(box, "Depth:", create_radio(box, _("Depth:"),
"Meter", set_meter, (output_units.length == METERS), _("Meter"), set_meter, (output_units.length == METERS),
"Feet", set_feet, (output_units.length == FEET), _("Feet"), set_feet, (output_units.length == FEET),
NULL); NULL);
create_radio(box, "Pressure:", create_radio(box, _("Pressure:"),
"Bar", set_bar, (output_units.pressure == BAR), _("Bar"), set_bar, (output_units.pressure == BAR),
"PSI", set_psi, (output_units.pressure == PSI), _("PSI"), set_psi, (output_units.pressure == PSI),
NULL); NULL);
create_radio(box, "Volume:", create_radio(box, _("Volume:"),
"Liter", set_liter, (output_units.volume == LITER), _("Liter"), set_liter, (output_units.volume == LITER),
"CuFt", set_cuft, (output_units.volume == CUFT), _("CuFt"), set_cuft, (output_units.volume == CUFT),
NULL); NULL);
create_radio(box, "Temperature:", create_radio(box, _("Temperature:"),
"Celsius", set_celsius, (output_units.temperature == CELSIUS), _("Celsius"), set_celsius, (output_units.temperature == CELSIUS),
"Fahrenheit", set_fahrenheit, (output_units.temperature == FAHRENHEIT), _("Fahrenheit"), set_fahrenheit, (output_units.temperature == FAHRENHEIT),
NULL); NULL);
create_radio(box, "Weight:", create_radio(box, _("Weight:"),
"kg", set_kg, (output_units.weight == KG), _("kg"), set_kg, (output_units.weight == KG),
"lbs", set_lbs, (output_units.weight == LBS), _("lbs"), set_lbs, (output_units.weight == LBS),
NULL); 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); gtk_box_pack_start(GTK_BOX(GTK_DIALOG(dialog)->vbox), frame, FALSE, FALSE, 5);
box = gtk_hbox_new(FALSE, 6); box = gtk_hbox_new(FALSE, 6);
gtk_container_add(GTK_CONTAINER(frame), box); 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_toggle_button_set_active(GTK_TOGGLE_BUTTON(button), visible_cols.temperature);
gtk_box_pack_start(GTK_BOX(box), button, FALSE, FALSE, 6); gtk_box_pack_start(GTK_BOX(box), button, FALSE, FALSE, 6);
g_signal_connect(G_OBJECT(button), "toggled", G_CALLBACK(temperature_toggle), NULL); 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_toggle_button_set_active(GTK_TOGGLE_BUTTON(button), visible_cols.cylinder);
gtk_box_pack_start(GTK_BOX(box), button, FALSE, FALSE, 6); gtk_box_pack_start(GTK_BOX(box), button, FALSE, FALSE, 6);
g_signal_connect(G_OBJECT(button), "toggled", G_CALLBACK(cylinder_toggle), NULL); 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); gtk_box_pack_start(GTK_BOX(box), button, FALSE, FALSE, 6);
g_signal_connect(G_OBJECT(button), "toggled", G_CALLBACK(nitrox_toggle), NULL); 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_toggle_button_set_active(GTK_TOGGLE_BUTTON(button), visible_cols.sac);
gtk_box_pack_start(GTK_BOX(box), button, FALSE, FALSE, 6); gtk_box_pack_start(GTK_BOX(box), button, FALSE, FALSE, 6);
g_signal_connect(G_OBJECT(button), "toggled", G_CALLBACK(sac_toggle), NULL); 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_toggle_button_set_active(GTK_TOGGLE_BUTTON(button), visible_cols.otu);
gtk_box_pack_start(GTK_BOX(box), button, FALSE, FALSE, 6); gtk_box_pack_start(GTK_BOX(box), button, FALSE, FALSE, 6);
g_signal_connect(G_OBJECT(button), "toggled", G_CALLBACK(otu_toggle), NULL); 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_toggle_button_set_active(GTK_TOGGLE_BUTTON(button), visible_cols.totalweight);
gtk_box_pack_start(GTK_BOX(box), button, FALSE, FALSE, 6); gtk_box_pack_start(GTK_BOX(box), button, FALSE, FALSE, 6);
g_signal_connect(G_OBJECT(button), "toggled", G_CALLBACK(totalweight_toggle), NULL); 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_toggle_button_set_active(GTK_TOGGLE_BUTTON(button), visible_cols.suit);
gtk_box_pack_start(GTK_BOX(box), button, FALSE, FALSE, 6); gtk_box_pack_start(GTK_BOX(box), button, FALSE, FALSE, 6);
g_signal_connect(G_OBJECT(button), "toggled", G_CALLBACK(suit_toggle), NULL); 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); gtk_box_pack_start(GTK_BOX(GTK_DIALOG(dialog)->vbox), frame, FALSE, FALSE, 5);
font = gtk_font_button_new_with_font(divelist_font); font = gtk_font_button_new_with_font(divelist_font);
gtk_container_add(GTK_CONTAINER(frame),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); gtk_box_pack_start(GTK_BOX(GTK_DIALOG(dialog)->vbox), frame, FALSE, FALSE, 5);
box = gtk_hbox_new(FALSE, 6); box = gtk_hbox_new(FALSE, 6);
gtk_container_add(GTK_CONTAINER(frame), box); 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_toggle_button_set_active(GTK_TOGGLE_BUTTON(button), autogroup);
gtk_box_pack_start(GTK_BOX(box), button, FALSE, FALSE, 6); gtk_box_pack_start(GTK_BOX(box), button, FALSE, FALSE, 6);
g_signal_connect(G_OBJECT(button), "toggled", G_CALLBACK(autogroup_toggle), NULL); 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); gtk_box_pack_start(GTK_BOX(box), frame, FALSE, FALSE, 5);
box = gtk_hbox_new(FALSE, 6); box = gtk_hbox_new(FALSE, 6);
gtk_container_add(GTK_CONTAINER(frame), box); gtk_container_add(GTK_CONTAINER(frame), box);
@ -757,7 +759,7 @@ static void selectevents_dialog(GtkWidget *w, gpointer data)
int result; int result;
GtkWidget *dialog, *frame, *vbox, *table; GtkWidget *dialog, *frame, *vbox, *table;
dialog = gtk_dialog_new_with_buttons("SelectEvents", dialog = gtk_dialog_new_with_buttons(_("SelectEvents"),
GTK_WINDOW(main_window), GTK_WINDOW(main_window),
GTK_DIALOG_DESTROY_WITH_PARENT, GTK_DIALOG_DESTROY_WITH_PARENT,
GTK_STOCK_OK, GTK_RESPONSE_ACCEPT, 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 */ /* initialize the function that fills the table */
create_toggle(NULL, NULL, NULL); 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)); vbox = gtk_dialog_get_content_area(GTK_DIALOG(dialog));
gtk_box_pack_start(GTK_BOX(vbox), frame, FALSE, FALSE, 5); 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; struct dive *dive;
GtkWidget *dialog, *frame, *button, *vbox; GtkWidget *dialog, *frame, *button, *vbox;
dialog = gtk_dialog_new_with_buttons("Renumber", dialog = gtk_dialog_new_with_buttons(_("Renumber"),
GTK_WINDOW(main_window), GTK_WINDOW(main_window),
GTK_DIALOG_DESTROY_WITH_PARENT, GTK_DIALOG_DESTROY_WITH_PARENT,
GTK_STOCK_OK, GTK_RESPONSE_ACCEPT, 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)); 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); gtk_box_pack_start(GTK_BOX(vbox), frame, FALSE, FALSE, 5);
button = gtk_spin_button_new_with_range(1, 50000, 1); 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, gtk_show_about_dialog(NULL,
"program-name", "Subsurface", "program-name", "Subsurface",
"comments", "Multi-platform divelog software in C", "comments", _("Multi-platform divelog software in C"),
"license", "GPLv2", "license", "GPLv2",
"version", VERSION_STRING, "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", "logo-icon-name", "subsurface",
/* Must be last: */ /* Must be last: */
logo_property, logo, logo_property, logo,
@ -894,36 +896,36 @@ static void toggle_zoom(GtkWidget *w, gpointer data)
} }
static GtkActionEntry menu_items[] = { static GtkActionEntry menu_items[] = {
{ "FileMenuAction", NULL, "File", NULL, NULL, NULL}, { "FileMenuAction", NULL, N_("File"), NULL, NULL, NULL},
{ "LogMenuAction", NULL, "Log", NULL, NULL, NULL}, { "LogMenuAction", NULL, N_("Log"), NULL, NULL, NULL},
{ "ViewMenuAction", NULL, "View", NULL, NULL, NULL}, { "ViewMenuAction", NULL, N_("View"), NULL, NULL, NULL},
{ "FilterMenuAction", NULL, "Filter", NULL, NULL, NULL}, { "FilterMenuAction", NULL, N_("Filter"), NULL, NULL, NULL},
{ "HelpMenuAction", NULL, "Help", NULL, NULL, NULL}, { "HelpMenuAction", NULL, N_("Help"), NULL, NULL, NULL},
{ "NewFile", GTK_STOCK_NEW, NULL, CTRLCHAR "N", NULL, G_CALLBACK(file_close) }, { "NewFile", GTK_STOCK_NEW, N_("New"), CTRLCHAR "N", NULL, G_CALLBACK(file_close) },
{ "OpenFile", GTK_STOCK_OPEN, NULL, CTRLCHAR "O", NULL, G_CALLBACK(file_open) }, { "OpenFile", GTK_STOCK_OPEN, N_("Open"), CTRLCHAR "O", NULL, G_CALLBACK(file_open) },
{ "SaveFile", GTK_STOCK_SAVE, NULL, CTRLCHAR "S", NULL, G_CALLBACK(file_save) }, { "SaveFile", GTK_STOCK_SAVE, N_("Save"), CTRLCHAR "S", NULL, G_CALLBACK(file_save) },
{ "SaveAsFile", GTK_STOCK_SAVE_AS, NULL, SHIFTCHAR CTRLCHAR "S", NULL, G_CALLBACK(file_save_as) }, { "SaveAsFile", GTK_STOCK_SAVE_AS, N_("Save As"), SHIFTCHAR CTRLCHAR "S", NULL, G_CALLBACK(file_save_as) },
{ "CloseFile", GTK_STOCK_CLOSE, NULL, NULL, NULL, G_CALLBACK(file_close) }, { "CloseFile", GTK_STOCK_CLOSE, N_("Close"), NULL, NULL, G_CALLBACK(file_close) },
{ "Print", GTK_STOCK_PRINT, NULL, CTRLCHAR "P", NULL, G_CALLBACK(do_print) }, { "Print", GTK_STOCK_PRINT, N_("Print"), CTRLCHAR "P", NULL, G_CALLBACK(do_print) },
{ "ImportFile", GTK_STOCK_GO_BACK, "Import XML File(s)", CTRLCHAR "I", NULL, G_CALLBACK(import_files) }, { "ImportFile", GTK_STOCK_GO_BACK, N_("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) }, { "DownloadLog", GTK_STOCK_GO_DOWN, N_("Download From Dive Computer"), CTRLCHAR "D", NULL, G_CALLBACK(download_dialog) },
{ "AddDive", GTK_STOCK_ADD, "Add Dive", NULL, NULL, G_CALLBACK(add_dive_cb) }, { "AddDive", GTK_STOCK_ADD, N_("Add Dive"), NULL, NULL, G_CALLBACK(add_dive_cb) },
{ "Preferences", GTK_STOCK_PREFERENCES, "Preferences", PREFERENCE_ACCEL, NULL, G_CALLBACK(preferences_dialog) }, { "Preferences", GTK_STOCK_PREFERENCES, N_("Preferences"), PREFERENCE_ACCEL, NULL, G_CALLBACK(preferences_dialog) },
{ "Renumber", NULL, "Renumber", NULL, NULL, G_CALLBACK(renumber_dialog) }, { "Renumber", NULL, N_("Renumber"), NULL, NULL, G_CALLBACK(renumber_dialog) },
{ "YearlyStats", NULL, "Yearly Statistics", NULL, NULL, G_CALLBACK(show_yearly_stats) }, { "YearlyStats", NULL, N_("Yearly Statistics"), NULL, NULL, G_CALLBACK(show_yearly_stats) },
{ "SelectEvents", NULL, "SelectEvents", NULL, NULL, G_CALLBACK(selectevents_dialog) }, { "SelectEvents", NULL, N_("SelectEvents"), NULL, NULL, G_CALLBACK(selectevents_dialog) },
{ "Quit", GTK_STOCK_QUIT, NULL, CTRLCHAR "Q", NULL, G_CALLBACK(quit) }, { "Quit", GTK_STOCK_QUIT, N_("Quit"), CTRLCHAR "Q", NULL, G_CALLBACK(quit) },
{ "About", GTK_STOCK_ABOUT, NULL, NULL, NULL, G_CALLBACK(about_dialog) }, { "About", GTK_STOCK_ABOUT, N_("About"), NULL, NULL, G_CALLBACK(about_dialog) },
{ "ViewList", NULL, "List", CTRLCHAR "1", NULL, G_CALLBACK(view_list) }, { "ViewList", NULL, N_("List"), CTRLCHAR "1", NULL, G_CALLBACK(view_list) },
{ "ViewProfile", NULL, "Profile", CTRLCHAR "2", NULL, G_CALLBACK(view_profile) }, { "ViewProfile", NULL, N_("Profile"), CTRLCHAR "2", NULL, G_CALLBACK(view_profile) },
{ "ViewInfo", NULL, "Info", CTRLCHAR "3", NULL, G_CALLBACK(view_info) }, { "ViewInfo", NULL, N_("Info"), CTRLCHAR "3", NULL, G_CALLBACK(view_info) },
{ "ViewThree", NULL, "Three", CTRLCHAR "4", NULL, G_CALLBACK(view_three) }, { "ViewThree", NULL, N_("Three"), CTRLCHAR "4", NULL, G_CALLBACK(view_three) },
}; };
static gint nmenu_items = sizeof (menu_items) / sizeof (menu_items[0]); static gint nmenu_items = sizeof (menu_items) / sizeof (menu_items[0]);
static GtkToggleActionEntry toggle_items[] = { static GtkToggleActionEntry toggle_items[] = {
{ "Autogroup", NULL, "Autogroup", NULL, NULL, G_CALLBACK(autogroup_cb), FALSE }, { "Autogroup", NULL, N_("Autogroup"), NULL, NULL, G_CALLBACK(autogroup_cb), FALSE },
{ "ToggleZoom", NULL, "Toggle Zoom", CTRLCHAR "0", NULL, G_CALLBACK(toggle_zoom), 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]); 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) static GtkWidget *get_menubar_menu(GtkWidget *window, GtkUIManager *ui_manager)
{ {
GtkActionGroup *action_group = gtk_action_group_new("Menu"); 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); gtk_action_group_add_actions(action_group, menu_items, nmenu_items, 0);
toggle_items[0].is_active = autogroup; toggle_items[0].is_active = autogroup;
gtk_action_group_add_toggle_actions(action_group, toggle_items, ntoggle_items, 0); 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 */ /* Frame for extended dive info */
nb_page = extended_dive_info_widget(); 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 */ /* Frame for dive equipment */
nb_page = equipment_widget(W_IDX_PRIMARY); 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 */ /* Frame for single dive statistics */
nb_page = single_stats_widget(); 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 */ /* Frame for total dive statistics */
nb_page = total_stats_widget(); 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_set_app_paintable(win, TRUE);
gtk_widget_show_all(win); 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); model = gtk_list_store_new(1, G_TYPE_POINTER);
default_index = fill_computer_list(model); 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); gtk_box_pack_start(GTK_BOX(hbox), frame, FALSE, TRUE, 3);
combo_box = gtk_combo_box_new_with_model(GTK_TREE_MODEL(model)); 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); hbox = gtk_hbox_new(FALSE, 6);
gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 3); 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); gtk_box_pack_start(GTK_BOX(hbox), frame, FALSE, TRUE, 3);
entry = gtk_entry_new(); entry = gtk_entry_new();
@ -1390,7 +1393,7 @@ void import_files(GtkWidget *w, gpointer data)
struct stat sb; struct stat sb;
GSList *filenames = NULL; 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_WINDOW(main_window),
GTK_FILE_CHOOSER_ACTION_OPEN, GTK_FILE_CHOOSER_ACTION_OPEN,
GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, 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); button = gtk_dialog_get_widget_for_response(dialog, GTK_RESPONSE_ACCEPT);
gtk_button_set_use_stock(GTK_BUTTON(button), 0); 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); vbox = gtk_dialog_get_content_area(dialog);
@ -1488,7 +1491,7 @@ void download_dialog(GtkWidget *w, gpointer data)
.devname = NULL, .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_WINDOW(main_window),
GTK_DIALOG_DESTROY_WITH_PARENT, GTK_DIALOG_DESTROY_WITH_PARENT,
GTK_STOCK_OK, GTK_RESPONSE_ACCEPT, GTK_STOCK_OK, GTK_RESPONSE_ACCEPT,
@ -1496,7 +1499,7 @@ void download_dialog(GtkWidget *w, gpointer data)
NULL); NULL);
vbox = gtk_dialog_get_content_area(GTK_DIALOG(dialog)); 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); gtk_box_pack_start(GTK_BOX(vbox), label, FALSE, TRUE, 3);
computer = dive_computer_selector(vbox); computer = dive_computer_selector(vbox);
device = dive_computer_device(vbox); device = dive_computer_device(vbox);

65
info.c
View file

@ -13,6 +13,7 @@
#include <time.h> #include <time.h>
#include <ctype.h> #include <ctype.h>
#include <sys/time.h> #include <sys/time.h>
#include <glib/gi18n.h>
#include "dive.h" #include "dive.h"
#include "display.h" #include "display.h"
@ -102,7 +103,7 @@ static int divename(char *buf, size_t size, struct dive *dive)
struct tm tm; struct tm tm;
utc_mkdate(dive->when, &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, dive->number,
weekday(tm.tm_wday), weekday(tm.tm_wday),
tm.tm_mon+1, tm.tm_mday, tm.tm_mon+1, tm.tm_mday,
@ -140,7 +141,7 @@ void show_dive_info(struct dive *dive)
if (!text) if (!text)
text = ""; text = "";
if (*text) { if (*text) {
snprintf(buffer, sizeof(buffer), "Dive #%d - %s", dive->number, text); snprintf(buffer, sizeof(buffer), _("Dive #%d - %s"), dive->number, text);
} else { } else {
divename(buffer, sizeof(buffer), dive); divename(buffer, sizeof(buffer), dive);
} }
@ -174,7 +175,7 @@ static int delete_dive_info(struct dive *dive)
if (!dive) if (!dive)
return 0; return 0;
dialog = gtk_dialog_new_with_buttons("Delete Dive", dialog = gtk_dialog_new_with_buttons(_("Delete Dive"),
GTK_WINDOW(main_window), GTK_WINDOW(main_window),
GTK_DIALOG_DESTROY_WITH_PARENT, GTK_DIALOG_DESTROY_WITH_PARENT,
GTK_STOCK_OK, GTK_RESPONSE_ACCEPT, 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) 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, _("Delete"), GTK_STOCK_DELETE, info_menu_delete_cb);
add_menu_item(menu, "Edit", GTK_STOCK_EDIT, info_menu_edit_cb); add_menu_item(menu, _("Edit"), GTK_STOCK_EDIT, info_menu_edit_cb);
} }
static GtkEntry *text_value(GtkWidget *box, const char *label) 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) static void dive_trip_widget(GtkWidget *box, dive_trip_t *trip, struct dive_info *info)
{ {
GtkWidget *hbox, *label; 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); 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); hbox = gtk_hbox_new(FALSE, 3);
gtk_box_pack_start(GTK_BOX(box), hbox, FALSE, TRUE, 0); 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) if (trip->notes && *trip->notes)
gtk_text_buffer_set_text(gtk_text_view_get_buffer(info->notes), trip->notes, -1); 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) static void dive_info_widget(GtkWidget *box, struct dive *dive, struct dive_info *info, gboolean multi)
{ {
GtkWidget *hbox, *label, *frame, *equipment; GtkWidget *hbox, *label, *frame, *equipment;
char buffer[80] = "Edit multiple dives"; char buffer[80] = N_("Edit multiple dives");
if (!multi) if (!multi)
divename(buffer, sizeof(buffer), dive); divename(_(buffer), sizeof(_(buffer)), dive);
label = gtk_label_new(buffer); label = gtk_label_new(_(buffer));
gtk_box_pack_start(GTK_BOX(box), label, FALSE, TRUE, 0); 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); hbox = gtk_hbox_new(FALSE, 3);
gtk_box_pack_start(GTK_BOX(box), hbox, FALSE, TRUE, 0); gtk_box_pack_start(GTK_BOX(box), hbox, FALSE, TRUE, 0);
info->divemaster = text_entry(hbox, "Dive master", people_list, dive->divemaster); info->divemaster = text_entry(hbox, _("Dive master"), people_list, dive->divemaster);
info->buddy = text_entry(hbox, "Buddy", people_list, dive->buddy); info->buddy = text_entry(hbox, _("Buddy"), people_list, dive->buddy);
hbox = gtk_hbox_new(FALSE, 3); hbox = gtk_hbox_new(FALSE, 3);
gtk_box_pack_start(GTK_BOX(box), hbox, FALSE, TRUE, 0); gtk_box_pack_start(GTK_BOX(box), hbox, FALSE, TRUE, 0);
info->rating = text_entry(hbox, "Rating", star_list, star_strings[dive->rating]); info->rating = text_entry(hbox, _("Rating"), star_list, star_strings[dive->rating]);
info->suit = text_entry(hbox, "Suit", suit_list, dive->suit); info->suit = text_entry(hbox, _("Suit"), suit_list, dive->suit);
/* only show notes if editing a single dive */ /* only show notes if editing a single dive */
if (multi) { if (multi) {
info->notes = NULL; info->notes = NULL;
} else { } else {
info->notes = text_view(box, "Notes", READ_WRITE); info->notes = text_view(box, _("Notes"), READ_WRITE);
if (dive->notes && *dive->notes) if (dive->notes && *dive->notes)
gtk_text_buffer_set_text(gtk_text_view_get_buffer(info->notes), dive->notes, -1); 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); gtk_box_pack_start(GTK_BOX(box), hbox, FALSE, TRUE, 0);
/* create a secondary Equipment widget */ /* create a secondary Equipment widget */
frame = gtk_frame_new("Equipment"); frame = gtk_frame_new(_("Equipment"));
equipment = equipment_widget(W_IDX_SECONDARY); equipment = equipment_widget(W_IDX_SECONDARY);
gtk_container_add(GTK_CONTAINER(frame), equipment); gtk_container_add(GTK_CONTAINER(frame), equipment);
gtk_box_pack_start(GTK_BOX(hbox), frame, FALSE, TRUE, 0); 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; struct dive_info info;
memset(&info, 0, sizeof(struct dive_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_WINDOW(main_window),
GTK_DIALOG_DESTROY_WITH_PARENT, GTK_DIALOG_DESTROY_WITH_PARENT,
GTK_STOCK_OK, GTK_RESPONSE_ACCEPT, GTK_STOCK_OK, GTK_RESPONSE_ACCEPT,
@ -665,7 +666,7 @@ int edit_multi_dive_info(struct dive *single_dive)
struct dive *master; struct dive *master;
gboolean multi; gboolean multi;
dialog = gtk_dialog_new_with_buttons("Dive Info", dialog = gtk_dialog_new_with_buttons(_("Dive Info"),
GTK_WINDOW(main_window), GTK_WINDOW(main_window),
GTK_DIALOG_DESTROY_WITH_PARENT, GTK_DIALOG_DESTROY_WITH_PARENT,
GTK_STOCK_OK, GTK_RESPONSE_ACCEPT, GTK_STOCK_OK, GTK_RESPONSE_ACCEPT,
@ -772,7 +773,7 @@ static timestamp_t dive_time_widget(struct dive *dive)
int success; int success;
double depthinterval, val; 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_WINDOW(main_window),
GTK_DIALOG_DESTROY_WITH_PARENT, GTK_DIALOG_DESTROY_WITH_PARENT,
GTK_STOCK_OK, GTK_RESPONSE_ACCEPT, 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)); vbox = gtk_dialog_get_content_area(GTK_DIALOG(dialog));
/* Calendar hbox */ /* Calendar hbox */
hbox = frame_box(vbox, "Date:"); hbox = frame_box(vbox, _("Date:"));
cal = gtk_calendar_new(); cal = gtk_calendar_new();
gtk_box_pack_start(GTK_BOX(hbox), cal, FALSE, TRUE, 0); gtk_box_pack_start(GTK_BOX(hbox), cal, FALSE, TRUE, 0);
/* Time hbox */ /* 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); 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); 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); gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0);
/* Duration hbox */ /* 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); duration = gtk_spin_button_new_with_range (0.0, 1000.0, 1.0);
gtk_box_pack_end(GTK_BOX(box), duration, FALSE, FALSE, 0); gtk_box_pack_end(GTK_BOX(box), duration, FALSE, FALSE, 0);
/* Depth box */ /* 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) { if (output_units.length == FEET) {
depthinterval = 1.0; depthinterval = 1.0;
} else { } else {
@ -901,20 +902,20 @@ GtkWidget *extended_dive_info_widget(void)
suit_list = gtk_list_store_new(1, G_TYPE_STRING); suit_list = gtk_list_store_new(1, G_TYPE_STRING);
gtk_container_set_border_width(GTK_CONTAINER(vbox), 6); 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); hbox = gtk_hbox_new(FALSE, 3);
gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, TRUE, 0); gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, TRUE, 0);
divemaster = text_value(hbox, "Divemaster"); divemaster = text_value(hbox, _("Divemaster"));
buddy = text_value(hbox, "Buddy"); buddy = text_value(hbox, _("Buddy"));
hbox = gtk_hbox_new(FALSE, 3); hbox = gtk_hbox_new(FALSE, 3);
gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, TRUE, 0); gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, TRUE, 0);
rating = text_value(hbox, "Rating"); rating = text_value(hbox, _("Rating"));
suit = text_value(hbox, "Suit"); suit = text_value(hbox, _("Suit"));
notes = text_view(vbox, "Notes", READ_ONLY); notes = text_view(vbox, _("Notes"), READ_ONLY);
return vbox; return vbox;
} }

View file

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

View file

@ -84,6 +84,11 @@ const char *subsurface_default_filename()
} }
} }
const char *subsurface_gettext_domainpath()
{
return "./locale";
}
void subsurface_ui_setup(GtkSettings *settings, GtkWidget *menubar, void subsurface_ui_setup(GtkSettings *settings, GtkWidget *menubar,
GtkWidget *vbox, GtkUIManager *ui_manager) GtkWidget *vbox, GtkUIManager *ui_manager)
{ {

13
macos.c
View file

@ -104,6 +104,19 @@ const char *subsurface_default_filename()
} }
} }
const char *subsurface_gettext_domainpath()
{
CFBundleRef mainBundle = CFBundleGetMainBundle();
CFURLRef localeURL = CFBundleCopyResourceURL(mainBundle, CFSTR("locale"), CFSTR(""), NULL);
if (localeURL) {
CFStringRef localePath = CFURLCopyFileSystemPath(localeURL, kCFURLPOSIXPathStyle);
CFStringEncoding encodingMethod = CFStringGetSystemEncoding();
const char *path = CFStringGetCStringPtr(localePath, encodingMethod);
return path;
}
return "./locale";
}
static void show_main_window(GtkWidget *w, gpointer data) static void show_main_window(GtkWidget *w, gpointer data)
{ {
gtk_widget_show(main_window); gtk_widget_show(main_window);

24
main.c
View file

@ -1,8 +1,11 @@
/* main.c */ /* main.c */
#include <locale.h>
#include <stdio.h> #include <stdio.h>
#include <string.h> #include <string.h>
#include <stdlib.h> #include <stdlib.h>
#include <time.h> #include <time.h>
#include <libintl.h>
#include <glib/gi18n.h>
#include "dive.h" #include "dive.h"
#include "divelist.h" #include "divelist.h"
@ -29,17 +32,19 @@ static int sortfn(const void *_a, const void *_b)
const char *weekday(int wday) const char *weekday(int wday)
{ {
static const char wday_array[7][4] = { static const char wday_array[7][7] = {
"Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat" /*++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]; return wday_array[wday];
} }
const char *monthname(int mon) const char *monthname(int mon)
{ {
static const char month_array[12][4] = { static const char month_array[12][7] = {
"Jan", "Feb", "Mar", "Apr", "May", "Jun", /*++GETTEXT: these are three letter months - we allow up to six code bytes*/
"Jul", "Aug", "Sep", "Oct", "Nov", "Dec", 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]; return month_array[mon];
} }
@ -220,7 +225,16 @@ int main(int argc, char **argv)
{ {
int i; int i;
gboolean no_filenames = TRUE; gboolean no_filenames = TRUE;
const char *path;
/* 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, "" );
path = subsurface_gettext_domainpath();
bindtextdomain("subsurface", path);
bind_textdomain_codeset("subsurface", "utf-8");
textdomain("subsurface");
output_units = SI_units; output_units = SI_units;
subsurface_command_line_init(&argc, &argv); subsurface_command_line_init(&argc, &argv);

View file

@ -133,6 +133,7 @@ Section
File dll\pthreadGC2.dll File dll\pthreadGC2.dll
File dll\zlib1.dll File dll\zlib1.dll
File subsurface.ico File subsurface.ico
File /r ..\..\locale
# Store installation folder in registry # Store installation folder in registry
WriteRegStr HKCU "Software\Subsurface" "" $INSTDIR WriteRegStr HKCU "Software\Subsurface" "" $INSTDIR

View file

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

1096
po/bg_BG.po Normal file

File diff suppressed because it is too large Load diff

1049
po/de_DE.po Normal file

File diff suppressed because it is too large Load diff

1094
po/fi_FI.po Normal file

File diff suppressed because it is too large Load diff

1098
po/fr_FR.po Normal file

File diff suppressed because it is too large Load diff

1097
po/nl_NL.po Normal file

File diff suppressed because it is too large Load diff

1094
po/no_NO.po Normal file

File diff suppressed because it is too large Load diff

1094
po/sk_SK.po Normal file

File diff suppressed because it is too large Load diff

1095
po/sv_SE.po Normal file

File diff suppressed because it is too large Load diff

33
print.c
View file

@ -1,3 +1,4 @@
#include <glib/gi18n.h>
#include <stdio.h> #include <stdio.h>
#include <string.h> #include <string.h>
#include <stdarg.h> #include <stdarg.h>
@ -63,7 +64,7 @@ static void show_dive_text(struct dive *dive, cairo_t *cr, double w,
*divenr = 0; *divenr = 0;
if (dive->number) if (dive->number)
snprintf(divenr, sizeof(divenr), "Dive #%d - ", dive->number); snprintf(divenr, sizeof(divenr), _("Dive #%d - "), dive->number);
utc_mkdate(dive->when, &tm); utc_mkdate(dive->when, &tm);
len = snprintf(buffer, sizeof(buffer), 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); depth = get_depth_units(dive->maxdepth.mm, &decimals, &unit);
snprintf(buffer, sizeof(buffer), snprintf(buffer, sizeof(buffer),
"Max depth: %.*f %s\n" _("Max depth: %.*f %s\nDuration: %d min\n%s"),
"Duration: %d min\n"
"%s",
decimals, depth, unit, decimals, depth, unit,
(dive->duration.seconds+59) / 60, (dive->duration.seconds+59) / 60,
people); people);
@ -152,8 +151,8 @@ static void show_table_header(cairo_t *cr, double w, double h,
int i; int i;
double maxwidth, maxheight, colwidth, curwidth; double maxwidth, maxheight, colwidth, curwidth;
PangoLayout *layout; PangoLayout *layout;
char headers[7][80]= { "Dive#", "Date", "Depth", "Time", "Master", char headers[7][80]= { N_("Dive#"), N_("Date"), N_("Depth"), N_("Time"), N_("Master"),
"Buddy", "Location" }; N_("Buddy"), N_("Location") };
maxwidth = w * PANGO_SCALE; maxwidth = w * PANGO_SCALE;
maxheight = h * PANGO_SCALE * 0.9; 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); pango_layout_set_width(layout, colwidth);
curwidth = curwidth + 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_layout_set_justify(layout, 1);
pango_cairo_show_layout(cr, layout); 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 // Col 4: Time
len = snprintf(buffer, sizeof(buffer), 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); cairo_move_to(cr, curwidth / PANGO_SCALE, 0);
pango_layout_set_width(layout, colwidth/ (double) 2); pango_layout_set_width(layout, colwidth/ (double) 2);
pango_layout_set_text(layout, buffer, len); 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; GtkWidget *vbox, *radio1, *radio2, *frame, *box;
int dives; 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); 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); gtk_box_pack_start(GTK_BOX(vbox), frame, FALSE, FALSE, 1);
box = gtk_hbox_new(FALSE, 2); box = gtk_hbox_new(FALSE, 2);
gtk_container_add(GTK_CONTAINER(frame), box); 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), gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(radio1),
print_options.type == PRETTY); print_options.type == PRETTY);
radio2 = gtk_radio_button_new_with_label_from_widget ( 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), gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(radio2),
print_options.type == TABLE); print_options.type == TABLE);
gtk_box_pack_start (GTK_BOX (box), radio1, TRUE, TRUE, 0); 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(); dives = nr_selected_dives();
print_options.print_selected = dives >= 1; print_options.print_selected = dives >= 1;
if (print_options.print_selected) { if (print_options.print_selected) {
frame = gtk_frame_new("Print selection"); frame = gtk_frame_new(_("Print selection"));
gtk_box_pack_start(GTK_BOX(vbox), frame, FALSE, FALSE, 1); gtk_box_pack_start(GTK_BOX(vbox), frame, FALSE, FALSE, 1);
box = gtk_hbox_new(FALSE, 1); box = gtk_hbox_new(FALSE, 1);
gtk_container_add(GTK_CONTAINER(frame), box); gtk_container_add(GTK_CONTAINER(frame), box);
GtkWidget *button; 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), gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(button),
print_options.print_selected); print_options.print_selected);
gtk_box_pack_start(GTK_BOX(box), button, FALSE, FALSE, 2); 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 /* creates all the necessary data for drawing the dive profile
* uses cairo to draw it * uses cairo to draw it
*/ */
#include <glib/gi18n.h>
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <stdarg.h> #include <stdarg.h>

View file

@ -8,6 +8,7 @@
* called from gtk-ui: * called from gtk-ui:
* GtkWidget *stats_widget(void) * GtkWidget *stats_widget(void)
*/ */
#include <glib/gi18n.h>
#include <stdio.h> #include <stdio.h>
#include <string.h> #include <string.h>
#include <stdlib.h> #include <stdlib.h>
@ -155,16 +156,31 @@ static void init_tree()
pango_font_description_free(font_desc); pango_font_description_free(font_desc);
renderer = gtk_cell_renderer_text_new (); renderer = gtk_cell_renderer_text_new ();
char *columns[] = { /* don't use empty strings "" - they confuse gettext */
"Year\n > Month", "#", "Duration\nTotal", "\nAverage", char *columnstop[] = { N_("Year"), N_("#"), N_("Duration"), " ", " ", " ", N_("Depth"), " ", " ", N_("SAC"), " ", " ", N_("Temperature"), " ", " " };
"\nShortest", "\nLongest", "Depth\nAverage", "\nMinimum", const char *columnsbot[15];
"\nMaximum", "SAC\nAverage", "\nMinimum", "\nMaximum", "Temperature\nAverage", columnsbot[0] = C_("Stats", " > Month");
"\nMinimum", "\nMaximum" }; columnsbot[1] = " ";
columnsbot[2] = C_("Duration","Total");
columnsbot[3] = C_("Duration","Average");
columnsbot[4] = C_("Duration","Shortest");
columnsbot[5] = C_("Duration","Longest");
columnsbot[6] = C_("Depth", "Average");
columnsbot[7] = C_("Depth","Minimum");
columnsbot[8] = C_("Depth","Maximum");
columnsbot[9] = C_("SAC","Average");
columnsbot[10]= C_("SAC","Minimum");
columnsbot[11]= C_("SAC","Maximum");
columnsbot[12]= C_("Temp","Average");
columnsbot[13]= C_("Temp","Minimum");
columnsbot[14]= C_("Temp","Maximum");
/* Add all the columns to the tree view */ /* Add all the columns to the tree view */
for (i = 0; i < N_COLUMNS; ++i) { for (i = 0; i < N_COLUMNS; ++i) {
char buf[80];
column = gtk_tree_view_column_new(); column = gtk_tree_view_column_new();
gtk_tree_view_column_set_title(column, columns[i]); snprintf(buf, sizeof(buf), "%s\n%s", _(columnstop[i]), columnsbot[i]);
gtk_tree_view_column_set_title(column, buf);
gtk_tree_view_append_column(GTK_TREE_VIEW(yearly_tree), column); gtk_tree_view_append_column(GTK_TREE_VIEW(yearly_tree), column);
renderer = gtk_cell_renderer_text_new(); renderer = gtk_cell_renderer_text_new();
gtk_tree_view_column_pack_start(column, renderer, TRUE); gtk_tree_view_column_pack_start(column, renderer, TRUE);
@ -341,7 +357,7 @@ void show_yearly_stats()
gtk_window_set_position(GTK_WINDOW(window), GTK_WIN_POS_CENTER); gtk_window_set_position(GTK_WINDOW(window), GTK_WIN_POS_CENTER);
gtk_window_set_default_size(GTK_WINDOW(window), 640, 480); 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_container_set_border_width(GTK_CONTAINER(window), 5);
GTK_WINDOW(window)->allow_shrink = TRUE; GTK_WINDOW(window)->allow_shrink = TRUE;
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (sw), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC); gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (sw), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
@ -474,15 +490,15 @@ static char * get_time_string(int seconds, int maxdays)
{ {
static char buf[80]; static char buf[80];
if (maxdays && seconds > 3600 * 24 * maxdays) 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 { else {
int days = seconds / 3600 / 24; int days = seconds / 3600 / 24;
int hours = (seconds - days * 3600 * 24) / 3600; int hours = (seconds - days * 3600 * 24) / 3600;
int minutes = (seconds - days * 3600 * 24 - hours * 3600) / 60; int minutes = (seconds - days * 3600 * 24 - hours * 3600) / 60;
if (days > 0) if (days > 0)
snprintf(buf, sizeof(buf), "%dd %dh %dmin", days, hours, minutes); snprintf(buf, sizeof(buf), _("%dd %dh %dmin"), days, hours, minutes);
else else
snprintf(buf, sizeof(buf), "%dh %dmin", hours, minutes); snprintf(buf, sizeof(buf), _("%dh %dmin"), hours, minutes);
} }
return buf; return buf;
} }
@ -508,12 +524,12 @@ static void show_single_dive_stats(struct dive *dive)
tm.tm_hour, tm.tm_min); tm.tm_hour, tm.tm_min);
set_label(single_w.date, buf); 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) if (prev_dive)
set_label(single_w.surf_intv, set_label(single_w.surf_intv,
get_time_string(dive->when - (prev_dive->when + prev_dive->duration.seconds), 4)); get_time_string(dive->when - (prev_dive->when + prev_dive->duration.seconds), 4));
else else
set_label(single_w.surf_intv, "unknown"); set_label(single_w.surf_intv, _("unknown"));
value = get_depth_units(dive->maxdepth.mm, &decimals, &unit); value = get_depth_units(dive->maxdepth.mm, &decimals, &unit);
set_label(single_w.max_depth, "%.*f %s", decimals, value, unit); set_label(single_w.max_depth, "%.*f %s", decimals, value, unit);
value = get_depth_units(dive->meandepth.mm, &decimals, &unit); value = get_depth_units(dive->meandepth.mm, &decimals, &unit);
@ -597,11 +613,11 @@ static void show_total_dive_stats(struct dive *dive)
value = get_depth_units(stats_ptr->avg_depth.mm, &decimals, &unit); value = get_depth_units(stats_ptr->avg_depth.mm, &decimals, &unit);
set_label(stats_w.avg_overall_depth, "%.*f %s", decimals, value, unit); set_label(stats_w.avg_overall_depth, "%.*f %s", decimals, value, unit);
value = get_volume_units(stats_ptr->max_sac.mliter, &decimals, &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); 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); 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) void show_dive_stats(struct dive *dive)
@ -636,7 +652,7 @@ GtkWidget *total_stats_widget(void)
vbox = gtk_vbox_new(FALSE, 3); 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); gtk_box_pack_start(GTK_BOX(vbox), statsframe, TRUE, FALSE, 3);
framebox = gtk_vbox_new(FALSE, 3); framebox = gtk_vbox_new(FALSE, 3);
gtk_container_add(GTK_CONTAINER(statsframe), framebox); gtk_container_add(GTK_CONTAINER(statsframe), framebox);
@ -644,35 +660,35 @@ GtkWidget *total_stats_widget(void)
/* first row */ /* first row */
hbox = gtk_hbox_new(FALSE, 3); hbox = gtk_hbox_new(FALSE, 3);
gtk_box_pack_start(GTK_BOX(framebox), hbox, TRUE, 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.selection_size = new_info_label_in_frame(hbox, _("Dives"));
stats_w.max_temp = new_info_label_in_frame(hbox, "Max Temp"); 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.min_temp = new_info_label_in_frame(hbox, _("Min Temp"));
stats_w.avg_temp = new_info_label_in_frame(hbox, "Avg Temp"); stats_w.avg_temp = new_info_label_in_frame(hbox, _("Avg Temp"));
/* second row */ /* second row */
hbox = gtk_hbox_new(FALSE, 3); hbox = gtk_hbox_new(FALSE, 3);
gtk_box_pack_start(GTK_BOX(framebox), hbox, TRUE, 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.total_time = new_info_label_in_frame(hbox, _("Total Time"));
stats_w.avg_time = new_info_label_in_frame(hbox, "Avg 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.longest_time = new_info_label_in_frame(hbox, _("Longest Dive"));
stats_w.shortest_time = new_info_label_in_frame(hbox, "Shortest Dive"); stats_w.shortest_time = new_info_label_in_frame(hbox, _("Shortest Dive"));
/* third row */ /* third row */
hbox = gtk_hbox_new(FALSE, 3); hbox = gtk_hbox_new(FALSE, 3);
gtk_box_pack_start(GTK_BOX(framebox), hbox, TRUE, 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.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.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.avg_overall_depth = new_info_label_in_frame(hbox, _("Avg Depth"));
/* fourth row */ /* fourth row */
hbox = gtk_hbox_new(FALSE, 3); hbox = gtk_hbox_new(FALSE, 3);
gtk_box_pack_start(GTK_BOX(framebox), hbox, TRUE, 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.max_sac = new_info_label_in_frame(hbox, _("Max SAC"));
stats_w.min_sac = new_info_label_in_frame(hbox, "Min 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.avg_sac = new_info_label_in_frame(hbox, _("Avg SAC"));
return vbox; return vbox;
} }
@ -683,7 +699,7 @@ GtkWidget *single_stats_widget(void)
vbox = gtk_vbox_new(FALSE, 3); 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); gtk_box_pack_start(GTK_BOX(vbox), infoframe, TRUE, FALSE, 3);
framebox = gtk_vbox_new(FALSE, 3); framebox = gtk_vbox_new(FALSE, 3);
gtk_container_add(GTK_CONTAINER(infoframe), framebox); gtk_container_add(GTK_CONTAINER(infoframe), framebox);
@ -692,26 +708,26 @@ GtkWidget *single_stats_widget(void)
hbox = gtk_hbox_new(FALSE, 3); hbox = gtk_hbox_new(FALSE, 3);
gtk_box_pack_start(GTK_BOX(framebox), hbox, TRUE, 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.date = new_info_label_in_frame(hbox, _("Date"));
single_w.dive_time = new_info_label_in_frame(hbox, "Dive Time"); 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.surf_intv = new_info_label_in_frame(hbox, _("Surf Intv"));
/* second row */ /* second row */
hbox = gtk_hbox_new(FALSE, 3); hbox = gtk_hbox_new(FALSE, 3);
gtk_box_pack_start(GTK_BOX(framebox), hbox, TRUE, 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.max_depth = new_info_label_in_frame(hbox, _("Max Depth"));
single_w.avg_depth = new_info_label_in_frame(hbox, "Avg 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.water_temp = new_info_label_in_frame(hbox, _("Water Temp"));
/* third row */ /* third row */
hbox = gtk_hbox_new(FALSE, 3); hbox = gtk_hbox_new(FALSE, 3);
gtk_box_pack_start(GTK_BOX(framebox), hbox, TRUE, 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.sac = new_info_label_in_frame(hbox, _("SAC"));
single_w.otu = new_info_label_in_frame(hbox, "OTU"); 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.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; return vbox;
} }

1
time.c
View file

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

View file

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

37
uemis.c
View file

@ -12,6 +12,7 @@
#include <string.h> #include <string.h>
#include <stdint.h> #include <stdint.h>
#include <stdlib.h> #include <stdlib.h>
#include <glib/gi18n.h>
#define __USE_XOPEN #define __USE_XOPEN
#include <time.h> #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; uint8_t *flags = u_sample->flags;
if (flags[1] & 0x01) 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) 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 WANT_CRAZY_WARNINGS
if (flags[1] & 0x06) /* both bits 1 and 2 are a warning */ 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) 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 #endif
if (flags[1] & 0x20) 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) 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[2] reflects the deco / time bar
* flags[3] reflects more display details on deco and pO2 */ * flags[3] reflects more display details on deco and pO2 */
if (flags[4] & 0x01) 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) 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) 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) 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) 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) 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) 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) 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) 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) 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) 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) 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 /* flags[7] reflects the little on screen icons that remind of previous
* warnings / alerts - not useful for events */ * warnings / alerts - not useful for events */
} }

View file

@ -151,6 +151,11 @@ const char *subsurface_default_filename()
} }
} }
const char *subsurface_gettext_domainpath()
{
return "./locale";
}
void subsurface_ui_setup(GtkSettings *settings, GtkWidget *menubar, void subsurface_ui_setup(GtkSettings *settings, GtkWidget *menubar,
GtkWidget *vbox, GtkUIManager *ui_manager) GtkWidget *vbox, GtkUIManager *ui_manager)
{ {