aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--dive.c24
-rw-r--r--divelist.c10
-rw-r--r--equipment.c10
-rw-r--r--file.c8
-rw-r--r--gettext.h4
-rw-r--r--libdivecomputer.c52
-rw-r--r--parse-xml.c14
-rw-r--r--planner.c30
-rw-r--r--profile.c62
-rw-r--r--qt-gui.cpp26
-rw-r--r--statistics.c32
-rw-r--r--subsurfacestartup.c10
-rw-r--r--uemis-downloader.c48
-rw-r--r--uemis.c36
14 files changed, 184 insertions, 182 deletions
diff --git a/dive.c b/dive.c
index 33a1c7e0e..c03d124a4 100644
--- a/dive.c
+++ b/dive.c
@@ -41,15 +41,15 @@ int get_pressure_units(unsigned int mb, const char **units)
switch (units_p->pressure) {
case PASCAL:
pressure = mb * 100;
- unit = tr("pascal");
+ unit = translate("gettextFromC","pascal");
break;
case BAR:
pressure = (mb + 500) / 1000;
- unit = tr("bar");
+ unit = translate("gettextFromC","bar");
break;
case PSI:
pressure = mbar_to_PSI(mb);
- unit = tr("psi");
+ unit = translate("gettextFromC","psi");
break;
}
if (units)
@@ -85,12 +85,12 @@ double get_volume_units(unsigned int ml, int *frac, const char **units)
switch (units_p->volume) {
case LITER:
vol = ml / 1000.0;
- unit = tr("l");
+ unit = translate("gettextFromC","l");
decimals = 1;
break;
case CUFT:
vol = ml_to_cuft(ml);
- unit = tr("cuft");
+ unit = translate("gettextFromC","cuft");
decimals = 2;
break;
}
@@ -111,12 +111,12 @@ double get_depth_units(unsigned int mm, int *frac, const char **units)
switch (units_p->length) {
case METERS:
d = mm / 1000.0;
- unit = tr("m");
+ unit = translate("gettextFromC","m");
decimals = d < 20;
break;
case FEET:
d = mm_to_feet(mm);
- unit = tr("ft");
+ unit = translate("gettextFromC","ft");
decimals = 0;
break;
}
@@ -137,11 +137,11 @@ double get_vertical_speed_units(unsigned int mms, int *frac, const char **units)
switch (units_p->length) {
case METERS:
d = mms / 1000.0 * time_factor;
- unit = tr((units_p->vertical_speed_time == MINUTES) ? "m/min" : "m/s");
+ unit = translate("gettextFromC",(units_p->vertical_speed_time == MINUTES) ? "m/min" : "m/s");
break;
case FEET:
d = mm_to_feet(mms) * time_factor;
- unit = tr((units_p->vertical_speed_time == MINUTES) ? "ft/min" : "ft/s");
+ unit = translate("gettextFromC",(units_p->vertical_speed_time == MINUTES) ? "ft/min" : "ft/s");
break;
}
if (frac)
@@ -160,11 +160,11 @@ double get_weight_units(unsigned int grams, int *frac, const char **units)
if (units_p->weight == LBS) {
value = grams_to_lbs(grams);
- unit = tr("lbs");
+ unit = translate("gettextFromC","lbs");
decimals = 0;
} else {
value = grams / 1000.0;
- unit = tr("kg");
+ unit = translate("gettextFromC","kg");
decimals = 1;
}
if (frac)
@@ -956,7 +956,7 @@ static char *merge_text(const char *a, const char *b)
res = malloc(strlen(a) + strlen(b) + 32);
if (!res)
return (char *)a;
- sprintf(res, tr("(%s) or (%s)"), a, b);
+ sprintf(res, translate("gettextFromC","(%s) or (%s)"), a, b);
return res;
}
diff --git a/divelist.c b/divelist.c
index 69393f2f6..6df961808 100644
--- a/divelist.c
+++ b/divelist.c
@@ -470,7 +470,7 @@ char *get_dive_date_string(timestamp_t when)
utc_mkdate(when, &tm);
snprintf(buffer, MAX_DATE_STRING,
/*++GETTEXT 60 char buffer weekday, monthname, day of month, year, hour:min */
- tr("%1$s, %2$s %3$d, %4$d %5$02d:%6$02d"),
+ translate("gettextFromC","%1$s, %2$s %3$d, %4$d %5$02d:%6$02d"),
weekday(tm.tm_wday),
monthname(tm.tm_mon),
tm.tm_mday, tm.tm_year + 1900,
@@ -487,7 +487,7 @@ char *get_short_dive_date_string(timestamp_t when)
utc_mkdate(when, &tm);
snprintf(buffer, MAX_DATE_STRING,
/*++GETTEXT 40 char buffer monthname, day of month, year, hour:min */
- tr("%1$s %2$d, %3$d\n%4$02d:%5$02d"),
+ translate("gettextFromC","%1$s %2$d, %3$d\n%4$02d:%5$02d"),
monthname(tm.tm_mon),
tm.tm_mday, tm.tm_year +1900,
tm.tm_hour, tm.tm_min);
@@ -509,14 +509,14 @@ char *get_trip_date_string(timestamp_t when, int nr)
ngettext("%1$s %2$d (%3$d dive)",
"%1$s %2$d (%3$d dives)", nr),
#else
- tr("%1$s %2$d (%3$d dives)"),
+ translate("gettextFromC","%1$s %2$d (%3$d dives)"),
#endif
monthname(tm.tm_mon),
tm.tm_year + 1900,
nr);
} else {
snprintf(buffer, MAX_DATE_STRING,
- tr("%1$s %2$d (1 dive)"),
+ translate("gettextFromC","%1$s %2$d (1 dive)"),
monthname(tm.tm_mon),
tm.tm_year + 1900);
}
@@ -547,7 +547,7 @@ char *get_nitrox_string(struct dive *dive)
else
snprintf(buffer, MAX_NITROX_STRING, "%d" UTF8_ELLIPSIS "%d", o2low, o2);
else
- strcpy(buffer, tr("air"));
+ strcpy(buffer, translate("gettextFromC","air"));
}
return buffer;
}
diff --git a/equipment.c b/equipment.c
index 8d113ed2b..240e92681 100644
--- a/equipment.c
+++ b/equipment.c
@@ -158,11 +158,11 @@ struct tank_info_t tank_info[100] = {
* This is a bit odd as the weight system types don't usually encode weight
*/
struct ws_info_t ws_info[100] = {
- { QT_TR_NOOP("integrated"), 0 },
- { QT_TR_NOOP("belt"), 0 },
- { QT_TR_NOOP("ankle"), 0 },
- { QT_TR_NOOP("backplate weight"), 0 },
- { QT_TR_NOOP("clip-on"), 0 },
+ { QT_TRANSLATE_NOOP("gettextFromC","integrated"), 0 },
+ { QT_TRANSLATE_NOOP("gettextFromC","belt"), 0 },
+ { QT_TRANSLATE_NOOP("gettextFromC","ankle"), 0 },
+ { QT_TRANSLATE_NOOP("gettextFromC","backplate weight"), 0 },
+ { QT_TRANSLATE_NOOP("gettextFromC","clip-on"), 0 },
};
void remove_cylinder(struct dive *dive, int idx)
diff --git a/file.c b/file.c
index 130568245..a4b90129a 100644
--- a/file.c
+++ b/file.c
@@ -103,9 +103,9 @@ static int try_to_xslt_open_csv(const char *filename, struct memblock *mem, char
if (readfile(filename, mem) < 0) {
if (error) {
- int len = strlen(tr("Failed to read '%s'")) + strlen(filename);
+ int len = strlen(translate("gettextFromC","Failed to read '%s'")) + strlen(filename);
*error = malloc(len);
- snprintf(*error, len, tr("Failed to read '%s'"), filename);
+ snprintf(*error, len, translate("gettextFromC","Failed to read '%s'"), filename);
}
return 1;
@@ -300,9 +300,9 @@ void parse_file(const char *filename, char **error)
return;
if (error) {
- int len = strlen(tr("Failed to read '%s'")) + strlen(filename);
+ int len = strlen(translate("gettextFromC","Failed to read '%s'")) + strlen(filename);
*error = malloc(len);
- snprintf(*error, len, tr("Failed to read '%s'"), filename);
+ snprintf(*error, len, translate("gettextFromC","Failed to read '%s'"), filename);
}
return;
diff --git a/gettext.h b/gettext.h
index d3283998d..5f987c1a4 100644
--- a/gettext.h
+++ b/gettext.h
@@ -3,7 +3,7 @@
/* this is for the Qt based translations */
extern const char *gettext(const char *);
-#define tr(arg) gettext(arg)
-#define QT_TR_NOOP(arg) arg
+#define translate(_context, arg) gettext(arg)
+#define QT_TRANSLATE_NOOP(_context, arg) arg
#endif // MYGETTEXT_H
diff --git a/libdivecomputer.c b/libdivecomputer.c
index 9f4500d03..7b91458e9 100644
--- a/libdivecomputer.c
+++ b/libdivecomputer.c
@@ -132,12 +132,12 @@ static void handle_event(struct divecomputer *dc, struct sample *sample, dc_samp
/* we mark these for translation here, but we store the untranslated strings
* and only translate them when they are displayed on screen */
static const char *events[] = {
- QT_TR_NOOP("none"), QT_TR_NOOP("deco stop"), QT_TR_NOOP("rbt"), QT_TR_NOOP("ascent"), QT_TR_NOOP("ceiling"), QT_TR_NOOP("workload"),
- QT_TR_NOOP("transmitter"), QT_TR_NOOP("violation"), QT_TR_NOOP("bookmark"), QT_TR_NOOP("surface"), QT_TR_NOOP("safety stop"),
- QT_TR_NOOP("gaschange"), QT_TR_NOOP("safety stop (voluntary)"), QT_TR_NOOP("safety stop (mandatory)"),
- QT_TR_NOOP("deepstop"), QT_TR_NOOP("ceiling (safety stop)"), QT_TR_NOOP("below floor"), QT_TR_NOOP("divetime"),
- QT_TR_NOOP("maxdepth"), QT_TR_NOOP("OLF"), QT_TR_NOOP("PO2"), QT_TR_NOOP("airtime"), QT_TR_NOOP("rgbm"), QT_TR_NOOP("heading"),
- QT_TR_NOOP("tissue level warning"), QT_TR_NOOP("gaschange"), QT_TR_NOOP("non stop time")
+ QT_TRANSLATE_NOOP("gettextFromC","none"), QT_TRANSLATE_NOOP("gettextFromC","deco stop"), QT_TRANSLATE_NOOP("gettextFromC","rbt"), QT_TRANSLATE_NOOP("gettextFromC","ascent"), QT_TRANSLATE_NOOP("gettextFromC","ceiling"), QT_TRANSLATE_NOOP("gettextFromC","workload"),
+ QT_TRANSLATE_NOOP("gettextFromC","transmitter"), QT_TRANSLATE_NOOP("gettextFromC","violation"), QT_TRANSLATE_NOOP("gettextFromC","bookmark"), QT_TRANSLATE_NOOP("gettextFromC","surface"), QT_TRANSLATE_NOOP("gettextFromC","safety stop"),
+ QT_TRANSLATE_NOOP("gettextFromC","gaschange"), QT_TRANSLATE_NOOP("gettextFromC","safety stop (voluntary)"), QT_TRANSLATE_NOOP("gettextFromC","safety stop (mandatory)"),
+ QT_TRANSLATE_NOOP("gettextFromC","deepstop"), QT_TRANSLATE_NOOP("gettextFromC","ceiling (safety stop)"), QT_TRANSLATE_NOOP("gettextFromC","below floor"), QT_TRANSLATE_NOOP("gettextFromC","divetime"),
+ QT_TRANSLATE_NOOP("gettextFromC","maxdepth"), QT_TRANSLATE_NOOP("gettextFromC","OLF"), QT_TRANSLATE_NOOP("gettextFromC","PO2"), QT_TRANSLATE_NOOP("gettextFromC","airtime"), QT_TRANSLATE_NOOP("gettextFromC","rgbm"), QT_TRANSLATE_NOOP("gettextFromC","heading"),
+ QT_TRANSLATE_NOOP("gettextFromC","tissue level warning"), QT_TRANSLATE_NOOP("gettextFromC","gaschange"), QT_TRANSLATE_NOOP("gettextFromC","non stop time")
};
const int nr_events = sizeof(events) / sizeof(const char *);
const char *name;
@@ -154,7 +154,7 @@ static void handle_event(struct divecomputer *dc, struct sample *sample, dc_samp
* Other evens might be more interesting, but for now we just print them out.
*/
type = value.event.type;
- name = QT_TR_NOOP("invalid event number");
+ name = QT_TRANSLATE_NOOP("gettextFromC","invalid event number");
if (type < nr_events)
name = events[type];
@@ -387,13 +387,13 @@ static int dive_cb(const unsigned char *data, unsigned int size,
rc = create_parser(devdata, &parser);
if (rc != DC_STATUS_SUCCESS) {
- dev_info(devdata, tr("Unable to create parser for %s %s"), devdata->vendor, devdata->product);
+ dev_info(devdata, translate("gettextFromC","Unable to create parser for %s %s"), devdata->vendor, devdata->product);
return rc;
}
rc = dc_parser_set_data(parser, data, size);
if (rc != DC_STATUS_SUCCESS) {
- dev_info(devdata, tr("Error registering the data"));
+ dev_info(devdata, translate("gettextFromC","Error registering the data"));
dc_parser_destroy(parser);
return rc;
}
@@ -402,7 +402,7 @@ static int dive_cb(const unsigned char *data, unsigned int size,
dive = alloc_dive();
rc = dc_parser_get_datetime(parser, &dt);
if (rc != DC_STATUS_SUCCESS && rc != DC_STATUS_UNSUPPORTED) {
- dev_info(devdata, tr("Error parsing the datetime"));
+ dev_info(devdata, translate("gettextFromC","Error parsing the datetime"));
dc_parser_destroy(parser);
return rc;
}
@@ -419,12 +419,12 @@ static int dive_cb(const unsigned char *data, unsigned int size,
dive->when = dive->dc.when = utc_mktime(&tm);
// Parse the divetime.
- dev_info(devdata, tr("Dive %d: %s %d %04d"), import_dive_number,
+ dev_info(devdata, translate("gettextFromC","Dive %d: %s %d %04d"), import_dive_number,
monthname(tm.tm_mon), tm.tm_mday, year(tm.tm_year));
unsigned int divetime = 0;
rc = dc_parser_get_field (parser, DC_FIELD_DIVETIME, 0, &divetime);
if (rc != DC_STATUS_SUCCESS && rc != DC_STATUS_UNSUPPORTED) {
- dev_info(devdata, tr("Error parsing the divetime"));
+ dev_info(devdata, translate("gettextFromC","Error parsing the divetime"));
dc_parser_destroy(parser);
return rc;
}
@@ -434,7 +434,7 @@ static int dive_cb(const unsigned char *data, unsigned int size,
double maxdepth = 0.0;
rc = dc_parser_get_field(parser, DC_FIELD_MAXDEPTH, 0, &maxdepth);
if (rc != DC_STATUS_SUCCESS && rc != DC_STATUS_UNSUPPORTED) {
- dev_info(devdata, tr("Error parsing the maxdepth"));
+ dev_info(devdata, translate("gettextFromC","Error parsing the maxdepth"));
dc_parser_destroy(parser);
return rc;
}
@@ -444,7 +444,7 @@ static int dive_cb(const unsigned char *data, unsigned int size,
unsigned int ngases = 0;
rc = dc_parser_get_field(parser, DC_FIELD_GASMIX_COUNT, 0, &ngases);
if (rc != DC_STATUS_SUCCESS && rc != DC_STATUS_UNSUPPORTED) {
- dev_info(devdata, tr("Error parsing the gas mix count"));
+ dev_info(devdata, translate("gettextFromC","Error parsing the gas mix count"));
dc_parser_destroy(parser);
return rc;
}
@@ -457,7 +457,7 @@ static int dive_cb(const unsigned char *data, unsigned int size,
};
rc = dc_parser_get_field(parser, DC_FIELD_SALINITY, 0, &salinity);
if (rc != DC_STATUS_SUCCESS && rc != DC_STATUS_UNSUPPORTED) {
- dev_info(devdata, tr("Error obtaining water salinity"));
+ dev_info(devdata, translate("gettextFromC","Error obtaining water salinity"));
dc_parser_destroy(parser);
return rc;
}
@@ -466,7 +466,7 @@ static int dive_cb(const unsigned char *data, unsigned int size,
double surface_pressure = 1.0;
rc = dc_parser_get_field(parser, DC_FIELD_ATMOSPHERIC, 0, &surface_pressure);
if (rc != DC_STATUS_SUCCESS && rc != DC_STATUS_UNSUPPORTED) {
- dev_info(devdata, tr("Error obtaining surface pressure"));
+ dev_info(devdata, translate("gettextFromC","Error obtaining surface pressure"));
dc_parser_destroy(parser);
return rc;
}
@@ -475,7 +475,7 @@ static int dive_cb(const unsigned char *data, unsigned int size,
rc = parse_gasmixes(devdata, dive, parser, ngases, data);
if (rc != DC_STATUS_SUCCESS) {
- dev_info(devdata, tr("Error parsing the gas mix"));
+ dev_info(devdata, translate("gettextFromC","Error parsing the gas mix"));
dc_parser_destroy(parser);
return rc;
}
@@ -483,7 +483,7 @@ static int dive_cb(const unsigned char *data, unsigned int size,
// Initialize the sample data.
rc = parse_samples(devdata, &dive->dc, parser);
if (rc != DC_STATUS_SUCCESS) {
- dev_info(devdata, tr("Error parsing the samples"));
+ dev_info(devdata, translate("gettextFromC","Error parsing the samples"));
dc_parser_destroy(parser);
return rc;
}
@@ -610,7 +610,7 @@ static void event_cb(dc_device_t *device, dc_event_type_t event, const void *dat
switch (event) {
case DC_EVENT_WAITING:
- dev_info(devdata, tr("Event: waiting for user action"));
+ dev_info(devdata, translate("gettextFromC","Event: waiting for user action"));
break;
case DC_EVENT_PROGRESS:
if (!progress->maximum)
@@ -618,7 +618,7 @@ static void event_cb(dc_device_t *device, dc_event_type_t event, const void *dat
progress_bar_fraction = (double) progress->current / (double) progress->maximum;
break;
case DC_EVENT_DEVINFO:
- dev_info(devdata, tr("model=%u (0x%08x), firmware=%u (0x%08x), serial=%u (0x%08x)"),
+ dev_info(devdata, translate("gettextFromC","model=%u (0x%08x), firmware=%u (0x%08x), serial=%u (0x%08x)"),
devinfo->model, devinfo->model,
devinfo->firmware, devinfo->firmware,
devinfo->serial, devinfo->serial);
@@ -633,7 +633,7 @@ static void event_cb(dc_device_t *device, dc_event_type_t event, const void *dat
break;
case DC_EVENT_CLOCK:
- dev_info(devdata, tr("Event: systime=%"PRId64", devtime=%u\n"),
+ dev_info(devdata, translate("gettextFromC","Event: systime=%"PRId64", devtime=%u\n"),
(uint64_t)clock->systime, clock->devtime);
break;
default:
@@ -660,16 +660,16 @@ static const char *do_device_import(device_data_t *data)
int events = DC_EVENT_WAITING | DC_EVENT_PROGRESS | DC_EVENT_DEVINFO | DC_EVENT_CLOCK;
rc = dc_device_set_events(device, events, event_cb, data);
if (rc != DC_STATUS_SUCCESS)
- return tr("Error registering the event handler.");
+ return translate("gettextFromC","Error registering the event handler.");
// Register the cancellation handler.
rc = dc_device_set_cancel(device, cancel_cb, data);
if (rc != DC_STATUS_SUCCESS)
- return tr("Error registering the cancellation handler.");
+ return translate("gettextFromC","Error registering the cancellation handler.");
rc = import_device_data(device, data);
if (rc != DC_STATUS_SUCCESS)
- return tr("Dive data import error");
+ return translate("gettextFromC","Dive data import error");
/* All good */
return NULL;
@@ -687,9 +687,9 @@ const char *do_libdivecomputer_import(device_data_t *data)
rc = dc_context_new(&data->context);
if (rc != DC_STATUS_SUCCESS)
- return tr("Unable to create libdivecomputer context");
+ return translate("gettextFromC","Unable to create libdivecomputer context");
- err = tr("Unable to open %s %s (%s)");
+ err = translate("gettextFromC","Unable to open %s %s (%s)");
rc = dc_device_open(&data->device, data->context, data->descriptor, data->devname);
if (rc == DC_STATUS_SUCCESS) {
err = do_device_import(data);
diff --git a/parse-xml.c b/parse-xml.c
index cd46064b8..fbe805a42 100644
--- a/parse-xml.c
+++ b/parse-xml.c
@@ -546,7 +546,7 @@ static void percent(char *buffer, void *_fraction)
break;
}
default:
- printf(tr("Strange percentage reading %s\n"), buffer);
+ printf(translate("gettextFromC","Strange percentage reading %s\n"), buffer);
break;
}
}
@@ -1692,8 +1692,8 @@ void parse_xml_buffer(const char *url, const char *buffer, int size,
free((char *)res);
if (!doc) {
- fprintf(stderr, tr("Failed to parse '%s'.\n"), url);
- parser_error(error, tr("Failed to parse '%s'"), url);
+ fprintf(stderr, translate("gettextFromC","Failed to parse '%s'.\n"), url);
+ parser_error(error, translate("gettextFromC","Failed to parse '%s'"), url);
return;
}
reset_all();
@@ -1891,7 +1891,7 @@ extern int dm4_dive(void *param, int columns, char **data, char **column)
snprintf(get_events, sizeof(get_events) - 1, get_events_template, cur_dive->number);
retval = sqlite3_exec(handle, get_events, &dm4_events, 0, &err);
if (retval != SQLITE_OK) {
- fprintf(stderr, tr("Database query get_events failed.\n"));
+ fprintf(stderr, translate("gettextFromC","Database query get_events failed.\n"));
return 1;
}
@@ -1926,14 +1926,14 @@ int parse_dm4_buffer(const char *url, const char *buffer, int size,
retval = sqlite3_open(url,&handle);
if(retval) {
- fprintf(stderr, tr("Database connection failed '%s'.\n"), url);
+ fprintf(stderr, translate("gettextFromC","Database connection failed '%s'.\n"), url);
return 1;
}
retval = sqlite3_exec(handle, get_dives, &dm4_dive, handle, &err);
if (retval != SQLITE_OK) {
- fprintf(stderr, tr("Database query failed '%s'.\n"), url);
+ fprintf(stderr, translate("gettextFromC","Database query failed '%s'.\n"), url);
return 1;
}
@@ -2045,7 +2045,7 @@ static xmlDoc *test_xslt_transforms(xmlDoc *doc, char **error)
xmlSubstituteEntitiesDefault(1);
xslt = get_stylesheet(info->file);
if (xslt == NULL) {
- parser_error(error, tr("Can't open stylesheet (%s)/%s"), xslt_path, info->file);
+ parser_error(error, translate("gettextFromC","Can't open stylesheet (%s)/%s"), xslt_path, info->file);
return doc;
}
diff --git a/planner.c b/planner.c
index ec00bda27..9e2390640 100644
--- a/planner.c
+++ b/planner.c
@@ -91,9 +91,9 @@ static int get_gasidx(struct dive *dive, int o2, int he)
void get_gas_string(int o2, int he, char *text, int len)
{
if (is_air(o2, he))
- snprintf(text, len, tr("air"));
+ snprintf(text, len, translate("gettextFromC","air"));
else if (he == 0)
- snprintf(text, len, tr("EAN%d"), (o2 + 5) / 10);
+ snprintf(text, len, translate("gettextFromC","EAN%d"), (o2 + 5) / 10);
else
snprintf(text, len, "(%d/%d)", (o2 + 5) / 10, (he + 5) / 10);
}
@@ -128,7 +128,7 @@ double tissue_at_end(struct dive *dive, char **cached_datap, const char **error_
t1 = sample->time.seconds;
get_gas_from_events(&dive->dc, t0, &o2, &he);
if ((gasidx = get_gasidx(dive, o2, he)) == -1) {
- snprintf(buf, sizeof(buf),tr("Can't find gas %d/%d"), (o2 + 5) / 10, (he + 5) / 10);
+ snprintf(buf, sizeof(buf),translate("gettextFromC","Can't find gas %d/%d"), (o2 + 5) / 10, (he + 5) / 10);
*error_string_p = buf;
gasidx = 0;
}
@@ -189,7 +189,7 @@ int add_gas(struct dive *dive, int o2, int he)
mix->he.permille = he;
/* since air is stored as 0/0 we need to set a name or an air cylinder
* would be seen as unset (by cylinder_nodata()) */
- cyl->type.description = strdup(tr("Cylinder for planning"));
+ cyl->type.description = strdup(translate("gettextFromC","Cylinder for planning"));
return i;
}
@@ -214,7 +214,7 @@ struct dive *create_dive_from_plan(struct diveplan *diveplan, const char **error
dive->when = diveplan->when;
dive->dc.surface_pressure.mbar = diveplan->surface_pressure;
dc = &dive->dc;
- dc->model = strdup(tr("Simulated Dive"));
+ dc->model = strdup(translate("gettextFromC","Simulated Dive"));
dp = diveplan->dp;
/* let's start with the gas given on the first segment */
@@ -291,7 +291,7 @@ struct dive *create_dive_from_plan(struct diveplan *diveplan, const char **error
gas_error_exit:
free(dive);
- *error_string = tr("Too many gas mixes");
+ *error_string = translate("gettextFromC","Too many gas mixes");
return NULL;
}
@@ -469,7 +469,7 @@ static void add_plan_to_notes(struct diveplan *diveplan, struct dive *dive)
if (!dp)
return;
- snprintf(buffer, sizeof(buffer), tr("%s\nSubsurface dive plan\nbased on GFlow = %.0f and GFhigh = %.0f\n\n"),
+ snprintf(buffer, sizeof(buffer), translate("gettextFromC","%s\nSubsurface dive plan\nbased on GFlow = %.0f and GFhigh = %.0f\n\n"),
disclaimer, plangflow * 100, plangfhigh * 100);
/* we start with gas 0, then check if that was changed */
o2 = dive->cylinder[0].gasmix.o2.permille;
@@ -510,7 +510,7 @@ static void add_plan_to_notes(struct diveplan *diveplan, struct dive *dive)
if (dp->depth != lastdepth) {
used = diveplan->bottomsac / 1000.0 * depth_to_mbar((dp->depth + lastdepth) / 2, dive) *
(dp->time - lasttime) / 60;
- snprintf(buffer + len, sizeof(buffer) - len, tr("Transition to %.*f %s in %d:%02d min - runtime %d:%02u on %s\n"),
+ snprintf(buffer + len, sizeof(buffer) - len, translate("gettextFromC","Transition to %.*f %s in %d:%02d min - runtime %d:%02u on %s\n"),
decimals, depthvalue, depth_unit,
FRACTION(dp->time - lasttime, 60),
FRACTION(dp->time, 60),
@@ -519,7 +519,7 @@ static void add_plan_to_notes(struct diveplan *diveplan, struct dive *dive)
/* we use deco SAC rate during the calculated deco stops, bottom SAC rate everywhere else */
int sac = dp->entered ? diveplan->bottomsac : diveplan->decosac;
used = sac / 1000.0 * depth_to_mbar(dp->depth, dive) * (dp->time - lasttime) / 60;
- snprintf(buffer + len, sizeof(buffer) - len, tr("Stay at %.*f %s for %d:%02d min - runtime %d:%02u on %s\n"),
+ snprintf(buffer + len, sizeof(buffer) - len, translate("gettextFromC","Stay at %.*f %s for %d:%02d min - runtime %d:%02u on %s\n"),
decimals, depthvalue, depth_unit,
FRACTION(dp->time - lasttime, 60),
FRACTION(dp->time, 60),
@@ -530,7 +530,7 @@ static void add_plan_to_notes(struct diveplan *diveplan, struct dive *dive)
get_gas_string(newo2, newhe, gas, sizeof(gas));
if (o2 != newo2 || he != newhe) {
len = strlen(buffer);
- snprintf(buffer + len, sizeof(buffer) - len, tr("Switch gas to %s\n"), gas);
+ snprintf(buffer + len, sizeof(buffer) - len, translate("gettextFromC","Switch gas to %s\n"), gas);
}
o2 = newo2;
he = newhe;
@@ -538,7 +538,7 @@ static void add_plan_to_notes(struct diveplan *diveplan, struct dive *dive)
lastdepth = dp->depth;
} while ((dp = dp->next) != NULL);
len = strlen(buffer);
- snprintf(buffer + len, sizeof(buffer) - len, tr("Gas consumption:\n"));
+ snprintf(buffer + len, sizeof(buffer) - len, translate("gettextFromC","Gas consumption:\n"));
for (gasidx = 0; gasidx < MAX_CYLINDERS; gasidx++) {
double volume;
const char *unit;
@@ -549,7 +549,7 @@ static void add_plan_to_notes(struct diveplan *diveplan, struct dive *dive)
volume = get_volume_units(consumption[gasidx], NULL, &unit);
get_gas_string(dive->cylinder[gasidx].gasmix.o2.permille,
dive->cylinder[gasidx].gasmix.he.permille, gas, sizeof(gas));
- snprintf(buffer + len, sizeof(buffer) - len, tr("%.0f%s of %s\n"), volume, unit, gas);
+ snprintf(buffer + len, sizeof(buffer) - len, translate("gettextFromC","%.0f%s of %s\n"), volume, unit, gas);
}
dive->notes = strdup(buffer);
}
@@ -745,9 +745,9 @@ int validate_gas(const char *text, int *o2_p, int *he_p)
if (!*text)
return 0;
- if (!strcasecmp(text, tr("air"))) {
- o2 = O2_IN_AIR; he = 0; text += strlen(tr("air"));
- } else if (!strncasecmp(text, tr("ean"), 3)) {
+ if (!strcasecmp(text, translate("gettextFromC","air"))) {
+ o2 = O2_IN_AIR; he = 0; text += strlen(translate("gettextFromC","air"));
+ } else if (!strncasecmp(text, translate("gettextFromC","ean"), 3)) {
o2 = get_permille(text+3, &text); he = 0;
} else {
o2 = get_permille(text, &text); he = 0;
diff --git a/profile.c b/profile.c
index 3e6820443..a12ca55b8 100644
--- a/profile.c
+++ b/profile.c
@@ -106,7 +106,7 @@ int evn_foreach(void (*callback)(const char *, bool *, void *), void *data)
for (i = 0; i < evn_used; i++) {
/* here we display an event name on screen - so translate */
- callback(tr(ev_namelist[i].ev_name), &ev_namelist[i].plot_ev, data);
+ callback(translate("gettextFromC",ev_namelist[i].ev_name), &ev_namelist[i].plot_ev, data);
}
return i;
}
@@ -1148,22 +1148,22 @@ static void plot_string(struct plot_data *entry, char *buf, int bufsize,
double depthvalue, tempvalue, speedvalue;
depthvalue = get_depth_units(depth, NULL, &depth_unit);
- snprintf(buf, bufsize, tr("D:%.1f %s"), depthvalue, depth_unit);
+ snprintf(buf, bufsize, translate("gettextFromC","D:%.1f %s"), depthvalue, depth_unit);
if (prefs.show_time) {
memcpy(buf2, buf, bufsize);
- snprintf(buf, bufsize, tr("%s\nT:%d:%02d"), buf2, FRACTION(entry->sec, 60));
+ snprintf(buf, bufsize, translate("gettextFromC","%s\nT:%d:%02d"), buf2, FRACTION(entry->sec, 60));
}
if (pressure) {
pressurevalue = get_pressure_units(pressure, &pressure_unit);
memcpy(buf2, buf, bufsize);
- snprintf(buf, bufsize, tr("%s\nP:%d %s"), buf2, pressurevalue, pressure_unit);
+ snprintf(buf, bufsize, translate("gettextFromC","%s\nP:%d %s"), buf2, pressurevalue, pressure_unit);
}
if (temp) {
tempvalue = get_temp_units(temp, &temp_unit);
memcpy(buf2, buf, bufsize);
- snprintf(buf, bufsize, tr("%s\nT:%.1f %s"), buf2, tempvalue, temp_unit);
+ snprintf(buf, bufsize, translate("gettextFromC","%s\nT:%.1f %s"), buf2, tempvalue, temp_unit);
}
speedvalue = get_vertical_speed_units(abs(entry->speed), NULL, &vertical_speed_unit);
@@ -1171,19 +1171,19 @@ static void plot_string(struct plot_data *entry, char *buf, int bufsize,
/* Ascending speeds are positive, descending are negative */
if (entry->speed > 0)
speedvalue *= -1;
- snprintf(buf, bufsize, tr("%s\nV:%.2f %s"), buf2, speedvalue, vertical_speed_unit);
+ snprintf(buf, bufsize, translate("gettextFromC","%s\nV:%.2f %s"), buf2, speedvalue, vertical_speed_unit);
if (entry->ceiling) {
depthvalue = get_depth_units(entry->ceiling, NULL, &depth_unit);
memcpy(buf2, buf, bufsize);
- snprintf(buf, bufsize, tr("%s\nCalculated ceiling %.0f %s"), buf2, depthvalue, depth_unit);
+ snprintf(buf, bufsize, translate("gettextFromC","%s\nCalculated ceiling %.0f %s"), buf2, depthvalue, depth_unit);
if (prefs.calc_all_tissues){
int k;
for (k=0; k<16; k++){
if (entry->ceilings[k]){
depthvalue = get_depth_units(entry->ceilings[k], NULL, &depth_unit);
memcpy(buf2, buf, bufsize);
- snprintf(buf, bufsize, tr("%s\nTissue %.0fmin: %.0f %s"), buf2, buehlmann_N2_t_halflife[k], depthvalue, depth_unit);
+ snprintf(buf, bufsize, translate("gettextFromC","%s\nTissue %.0fmin: %.0f %s"), buf2, buehlmann_N2_t_halflife[k], depthvalue, depth_unit);
}
}
}
@@ -1194,62 +1194,62 @@ static void plot_string(struct plot_data *entry, char *buf, int bufsize,
if (entry->ndl) {
/* this is a safety stop as we still have ndl */
if (entry->stoptime)
- snprintf(buf, bufsize, tr("%s\nSafetystop:%umin @ %.0f %s"), buf2, DIV_UP(entry->stoptime, 60),
+ snprintf(buf, bufsize, translate("gettextFromC","%s\nSafetystop:%umin @ %.0f %s"), buf2, DIV_UP(entry->stoptime, 60),
depthvalue, depth_unit);
else
- snprintf(buf, bufsize, tr("%s\nSafetystop:unkn time @ %.0f %s"), buf2,
+ snprintf(buf, bufsize, translate("gettextFromC","%s\nSafetystop:unkn time @ %.0f %s"), buf2,
depthvalue, depth_unit);
} else {
/* actual deco stop */
if (entry->stoptime)
- snprintf(buf, bufsize, tr("%s\nDeco:%umin @ %.0f %s"), buf2, DIV_UP(entry->stoptime, 60),
+ snprintf(buf, bufsize, translate("gettextFromC","%s\nDeco:%umin @ %.0f %s"), buf2, DIV_UP(entry->stoptime, 60),
depthvalue, depth_unit);
else
- snprintf(buf, bufsize, tr("%s\nDeco:unkn time @ %.0f %s"), buf2,
+ snprintf(buf, bufsize, translate("gettextFromC","%s\nDeco:unkn time @ %.0f %s"), buf2,
depthvalue, depth_unit);
}
} else if (entry->in_deco) {
/* this means we had in_deco set but don't have a stop depth */
memcpy(buf2, buf, bufsize);
- snprintf(buf, bufsize, tr("%s\nIn deco"), buf2);
+ snprintf(buf, bufsize, translate("gettextFromC","%s\nIn deco"), buf2);
} else if (has_ndl) {
memcpy(buf2, buf, bufsize);
if (entry->ndl == -1)
- snprintf(buf, bufsize, tr("%s\nNDL:-"), buf2);
+ snprintf(buf, bufsize, translate("gettextFromC","%s\nNDL:-"), buf2);
else
- snprintf(buf, bufsize, tr("%s\nNDL:%umin"), buf2, DIV_UP(entry->ndl, 60));
+ snprintf(buf, bufsize, translate("gettextFromC","%s\nNDL:%umin"), buf2, DIV_UP(entry->ndl, 60));
}
if (entry->tts) {
memcpy(buf2, buf, bufsize);
- snprintf(buf, bufsize, tr("%s\nTTS:%umin"), buf2, DIV_UP(entry->tts, 60));
+ snprintf(buf, bufsize, translate("gettextFromC","%s\nTTS:%umin"), buf2, DIV_UP(entry->tts, 60));
}
if (entry->cns) {
memcpy(buf2, buf, bufsize);
- snprintf(buf, bufsize, tr("%s\nCNS:%u%%"), buf2, entry->cns);
+ snprintf(buf, bufsize, translate("gettextFromC","%s\nCNS:%u%%"), buf2, entry->cns);
}
if (prefs.pp_graphs.po2) {
memcpy(buf2, buf, bufsize);
- snprintf(buf, bufsize, tr("%s\npO%s:%.2fbar"), buf2, UTF8_SUBSCRIPT_2, entry->po2);
+ snprintf(buf, bufsize, translate("gettextFromC","%s\npO%s:%.2fbar"), buf2, UTF8_SUBSCRIPT_2, entry->po2);
}
if (prefs.pp_graphs.pn2) {
memcpy(buf2, buf, bufsize);
- snprintf(buf, bufsize, tr("%s\npN%s:%.2fbar"), buf2, UTF8_SUBSCRIPT_2, entry->pn2);
+ snprintf(buf, bufsize, translate("gettextFromC","%s\npN%s:%.2fbar"), buf2, UTF8_SUBSCRIPT_2, entry->pn2);
}
if (prefs.pp_graphs.phe) {
memcpy(buf2, buf, bufsize);
- snprintf(buf, bufsize, tr("%s\npHe:%.2fbar"), buf2, entry->phe);
+ snprintf(buf, bufsize, translate("gettextFromC","%s\npHe:%.2fbar"), buf2, entry->phe);
}
if (prefs.mod) {
mod = (int)get_depth_units(entry->mod, NULL, &depth_unit);
memcpy(buf2, buf, bufsize);
- snprintf(buf, bufsize, tr("%s\nMOD:%d%s"), buf2, mod, depth_unit);
+ snprintf(buf, bufsize, translate("gettextFromC","%s\nMOD:%d%s"), buf2, mod, depth_unit);
}
if (prefs.ead) {
ead = (int)get_depth_units(entry->ead, NULL, &depth_unit);
end = (int)get_depth_units(entry->end, NULL, &depth_unit);
eadd = (int)get_depth_units(entry->eadd, NULL, &depth_unit);
memcpy(buf2, buf, bufsize);
- snprintf(buf, bufsize, tr("%s\nEAD:%d%s\nEND:%d%s\nEADD:%d%s"), buf2, ead, depth_unit, end, depth_unit, eadd, depth_unit);
+ snprintf(buf, bufsize, translate("gettextFromC","%s\nEAD:%d%s\nEND:%d%s\nEADD:%d%s"), buf2, ead, depth_unit, end, depth_unit, eadd, depth_unit);
}
free(buf2);
}
@@ -1348,42 +1348,42 @@ void compare_samples(struct plot_data *e1, struct plot_data *e2, char *buf, int
avg_depth /= stop->sec-start->sec;
avg_speed /= stop->sec-start->sec;
- snprintf(buf, bufsize, tr("%sT: %d:%02d min"), UTF8_DELTA, delta_time/60, delta_time%60);
+ snprintf(buf, bufsize, translate("gettextFromC","%sT: %d:%02d min"), UTF8_DELTA, delta_time/60, delta_time%60);
memcpy(buf2, buf, bufsize);
depthvalue = get_depth_units(delta_depth, NULL, &depth_unit);
- snprintf(buf, bufsize, tr("%s %sD:%.1f%s"), buf2, UTF8_DELTA, depthvalue, depth_unit);
+ snprintf(buf, bufsize, translate("gettextFromC","%s %sD:%.1f%s"), buf2, UTF8_DELTA, depthvalue, depth_unit);
memcpy(buf2, buf, bufsize);
depthvalue = get_depth_units(min_depth, NULL, &depth_unit);
- snprintf(buf, bufsize, tr("%s %sD:%.1f%s"), buf2, UTF8_DOWNWARDS_ARROW, depthvalue, depth_unit);
+ snprintf(buf, bufsize, translate("gettextFromC","%s %sD:%.1f%s"), buf2, UTF8_DOWNWARDS_ARROW, depthvalue, depth_unit);
memcpy(buf2, buf, bufsize);
depthvalue = get_depth_units(max_depth, NULL, &depth_unit);
- snprintf(buf, bufsize, tr("%s %sD:%.1f %s"), buf2, UTF8_UPWARDS_ARROW, depthvalue, depth_unit);
+ snprintf(buf, bufsize, translate("gettextFromC","%s %sD:%.1f %s"), buf2, UTF8_UPWARDS_ARROW, depthvalue, depth_unit);
memcpy(buf2, buf, bufsize);
depthvalue = get_depth_units(avg_depth, NULL, &depth_unit);
- snprintf(buf, bufsize, tr("%s %sD:%.1f%s\n"), buf2, UTF8_AVERAGE, depthvalue, depth_unit);
+ snprintf(buf, bufsize, translate("gettextFromC","%s %sD:%.1f%s\n"), buf2, UTF8_AVERAGE, depthvalue, depth_unit);
memcpy(buf2, buf, bufsize);
speedvalue = get_depth_units(min_speed, NULL, &depth_unit);
- snprintf(buf, bufsize, tr("%s%sV:%.2f%s/s"), buf2, UTF8_DOWNWARDS_ARROW, speedvalue, depth_unit);
+ snprintf(buf, bufsize, translate("gettextFromC","%s%sV:%.2f%s/s"), buf2, UTF8_DOWNWARDS_ARROW, speedvalue, depth_unit);
memcpy(buf2, buf, bufsize);
speedvalue = get_depth_units(max_speed, NULL, &depth_unit);
- snprintf(buf, bufsize, tr("%s %sV:%.2f%s/s"), buf2, UTF8_UPWARDS_ARROW, speedvalue, depth_unit);
+ snprintf(buf, bufsize, translate("gettextFromC","%s %sV:%.2f%s/s"), buf2, UTF8_UPWARDS_ARROW, speedvalue, depth_unit);
memcpy(buf2, buf, bufsize);
speedvalue = get_depth_units(avg_speed, NULL, &depth_unit);
- snprintf(buf, bufsize, tr("%s %sV:%.2f%s/s"), buf2, UTF8_AVERAGE, speedvalue, depth_unit);
+ snprintf(buf, bufsize, translate("gettextFromC","%s %sV:%.2f%s/s"), buf2, UTF8_AVERAGE, speedvalue, depth_unit);
memcpy(buf2, buf, bufsize);
/* Only print if gas has been used */
if (bar_used) {
pressurevalue = get_pressure_units(bar_used, &pressure_unit);
memcpy(buf2, buf, bufsize);
- snprintf(buf, bufsize, tr("%s %sP:%d %s"), buf2, UTF8_DELTA, pressurevalue, pressure_unit);
+ snprintf(buf, bufsize, translate("gettextFromC","%s %sP:%d %s"), buf2, UTF8_DELTA, pressurevalue, pressure_unit);
}
free(buf2);
diff --git a/qt-gui.cpp b/qt-gui.cpp
index 532d1b509..f361e34df 100644
--- a/qt-gui.cpp
+++ b/qt-gui.cpp
@@ -39,7 +39,9 @@
#include <QLibraryInfo>
#include <gettextfromc.h>
-#define tr(arg) gettextFromC::instance()->tr(arg)
+
+// this will create a warning when executing lupdate
+#define translate(_context, arg) gettextFromC::instance()->tr("gettextFromC",arg)
const char *default_dive_computer_vendor;
const char *default_dive_computer_product;
@@ -192,10 +194,10 @@ QString get_depth_string(int mm, bool showunit, bool showdecimal)
{
if (prefs.units.length == units::METERS) {
double meters = mm / 1000.0;
- return QString("%1%2").arg(meters, 0, 'f', (showdecimal && meters < 20.0) ? 1 : 0 ).arg(showunit ? tr("m") : "");
+ return QString("%1%2").arg(meters, 0, 'f', (showdecimal && meters < 20.0) ? 1 : 0 ).arg(showunit ? translate("gettextFromC","m") : "");
} else {
double feet = mm_to_feet(mm);
- return QString("%1%2").arg(feet, 0, 'f', showdecimal ? 1 : 0). arg(showunit ? tr("ft") : "");
+ return QString("%1%2").arg(feet, 0, 'f', showdecimal ? 1 : 0). arg(showunit ? translate("gettextFromC","ft") : "");
}
}
@@ -216,9 +218,9 @@ QString get_weight_string(weight_t weight, bool showunit)
{
QString str = weight_string (weight.grams);
if (get_units()->weight == units::KG) {
- str = QString ("%1%2").arg(str).arg(showunit ? tr("kg") : "");
+ str = QString ("%1%2").arg(str).arg(showunit ? translate("gettextFromC","kg") : "");
} else {
- str = QString ("%1%2").arg(str).arg(showunit ? tr("lbs") : "");
+ str = QString ("%1%2").arg(str).arg(showunit ? translate("gettextFromC","lbs") : "");
}
return (str);
}
@@ -258,7 +260,7 @@ QString get_cylinder_used_gas_string(cylinder_t *cyl, bool showunit)
gas_usage = get_pressure_units(gas_usage, &unit);
decimals = 0;
}
- // tr("%.*f %s"
+ // translate("gettextFromC","%.*f %s"
return QString("%1 %2").arg(gas_usage, 0, 'f', decimals).arg(showunit ? unit : "");
}
@@ -269,11 +271,11 @@ QString get_temperature_string(temperature_t temp, bool showunit)
} else if (prefs.units.temperature == units::CELSIUS) {
double celsius = mkelvin_to_C(temp.mkelvin);
return QString("%1%2%3").arg(celsius, 0, 'f', 1).arg(showunit ? (UTF8_DEGREE): "")
- .arg(showunit ? tr("C") : "");
+ .arg(showunit ? translate("gettextFromC","C") : "");
} else {
double fahrenheit = mkelvin_to_F(temp.mkelvin);
return QString("%1%2%3").arg(fahrenheit, 0, 'f', 1).arg(showunit ? (UTF8_DEGREE): "")
- .arg(showunit ? tr("F") : "");
+ .arg(showunit ? translate("gettextFromC","F") : "");
}
}
@@ -289,10 +291,10 @@ QString get_volume_string(volume_t volume, bool showunit)
{
if (prefs.units.volume == units::LITER) {
double liter = volume.mliter / 1000.0;
- return QString("%1%2").arg(liter, 0, 'f', liter >= 40.0 ? 0 : 1 ).arg(showunit ? tr("l") : "");
+ return QString("%1%2").arg(liter, 0, 'f', liter >= 40.0 ? 0 : 1 ).arg(showunit ? translate("gettextFromC","l") : "");
} else {
double cuft = ml_to_cuft(volume.mliter);
- return QString("%1%2").arg(cuft, 0, 'f', cuft >= 20.0 ? 0 : (cuft >= 2.0 ? 1 : 2)).arg(showunit ? tr("cuft") : "");
+ return QString("%1%2").arg(cuft, 0, 'f', cuft >= 20.0 ? 0 : (cuft >= 2.0 ? 1 : 2)).arg(showunit ? translate("gettextFromC","cuft") : "");
}
}
@@ -308,10 +310,10 @@ QString get_pressure_string(pressure_t pressure, bool showunit)
{
if (prefs.units.pressure == units::BAR) {
double bar = pressure.mbar / 1000.0;
- return QString("%1%2").arg(bar, 0, 'f', 1).arg(showunit ? tr("bar") : "");
+ return QString("%1%2").arg(bar, 0, 'f', 1).arg(showunit ? translate("gettextFromC","bar") : "");
} else {
double psi = mbar_to_PSI(pressure.mbar);
- return QString("%1%2").arg(psi, 0, 'f', 0).arg(showunit ? tr("psi") : "");
+ return QString("%1%2").arg(psi, 0, 'f', 0).arg(showunit ? translate("gettextFromC","psi") : "");
}
}
diff --git a/statistics.c b/statistics.c
index ce41df8a9..5f2916eff 100644
--- a/statistics.c
+++ b/statistics.c
@@ -18,10 +18,10 @@
/* mark for translation but don't translate here as these terms are used
* in save-xml.c */
char *dtag_names[DTAG_NR] = {
- QT_TR_NOOP("invalid"), QT_TR_NOOP("boat"), QT_TR_NOOP("shore"), QT_TR_NOOP("drift"), QT_TR_NOOP("deep"), QT_TR_NOOP("cavern"),
- QT_TR_NOOP("ice"), QT_TR_NOOP("wreck"), QT_TR_NOOP("cave"), QT_TR_NOOP("altitude"), QT_TR_NOOP("pool"), QT_TR_NOOP("lake"),
- QT_TR_NOOP("river"), QT_TR_NOOP("night"), QT_TR_NOOP("freshwater"), QT_TR_NOOP("training"), QT_TR_NOOP("teaching"),
- QT_TR_NOOP("photo"), QT_TR_NOOP("video"), QT_TR_NOOP("deco")
+ QT_TRANSLATE_NOOP("gettextFromC","invalid"), QT_TRANSLATE_NOOP("gettextFromC","boat"), QT_TRANSLATE_NOOP("gettextFromC","shore"), QT_TRANSLATE_NOOP("gettextFromC","drift"), QT_TRANSLATE_NOOP("gettextFromC","deep"), QT_TRANSLATE_NOOP("gettextFromC","cavern"),
+ QT_TRANSLATE_NOOP("gettextFromC","ice"), QT_TRANSLATE_NOOP("gettextFromC","wreck"), QT_TRANSLATE_NOOP("gettextFromC","cave"), QT_TRANSLATE_NOOP("gettextFromC","altitude"), QT_TRANSLATE_NOOP("gettextFromC","pool"), QT_TRANSLATE_NOOP("gettextFromC","lake"),
+ QT_TRANSLATE_NOOP("gettextFromC","river"), QT_TRANSLATE_NOOP("gettextFromC","night"), QT_TRANSLATE_NOOP("gettextFromC","freshwater"), QT_TRANSLATE_NOOP("gettextFromC","training"), QT_TRANSLATE_NOOP("gettextFromC","teaching"),
+ QT_TRANSLATE_NOOP("gettextFromC","photo"), QT_TRANSLATE_NOOP("gettextFromC","video"), QT_TRANSLATE_NOOP("gettextFromC","deco")
};
static stats_t stats;
@@ -196,15 +196,15 @@ char *get_time_string(int seconds, int maxdays)
{
static char buf[80];
if (maxdays && seconds > 3600 * 24 * maxdays) {
- snprintf(buf, sizeof(buf), tr("more than %d days"), maxdays);
+ snprintf(buf, sizeof(buf), translate("gettextFromC","more than %d days"), maxdays);
} else {
int days = seconds / 3600 / 24;
int hours = (seconds - days * 3600 * 24) / 3600;
int minutes = (seconds - days * 3600 * 24 - hours * 3600) / 60;
if (days > 0)
- snprintf(buf, sizeof(buf), tr("%dd %dh %dmin"), days, hours, minutes);
+ snprintf(buf, sizeof(buf), translate("gettextFromC","%dd %dh %dmin"), days, hours, minutes);
else
- snprintf(buf, sizeof(buf), tr("%dh %dmin"), hours, minutes);
+ snprintf(buf, sizeof(buf), translate("gettextFromC","%dh %dmin"), hours, minutes);
}
return buf;
}
@@ -215,14 +215,14 @@ static void get_ranges(char *buffer, int size)
int i, len;
int first, last = -1;
- snprintf(buffer, size, tr("for dives #"));
+ snprintf(buffer, size, translate("gettextFromC","for dives #"));
for (i = 0; i < dive_table.nr; i++) {
struct dive *dive = get_dive(i);
if (! dive->selected)
continue;
if (dive->number < 1) {
/* uhh - weird numbers - bail */
- snprintf(buffer, size, tr("for selected dives"));
+ snprintf(buffer, size, translate("gettextFromC","for selected dives"));
return;
}
len = strlen(buffer);
@@ -257,13 +257,13 @@ void get_selected_dives_text(char *buffer, int size)
{
if (amount_selected == 1) {
if (current_dive)
- snprintf(buffer, size, tr("for dive #%d"), current_dive->number);
+ snprintf(buffer, size, translate("gettextFromC","for dive #%d"), current_dive->number);
else
- snprintf(buffer, size, tr("for selected dive"));
+ snprintf(buffer, size, translate("gettextFromC","for selected dive"));
} else if (amount_selected == dive_table.nr) {
- snprintf(buffer, size, tr("for all dives"));
+ snprintf(buffer, size, translate("gettextFromC","for all dives"));
} else if (amount_selected == 0) {
- snprintf(buffer, size, tr("(no dives)"));
+ snprintf(buffer, size, translate("gettextFromC","(no dives)"));
} else {
get_ranges(buffer, size);
if (strlen(buffer) == size -1) {
@@ -357,10 +357,10 @@ char *get_gaslist(struct dive *dive)
o2 = get_o2(&cyl->gasmix);
he = get_he(&cyl->gasmix);
if (is_air(o2, he))
- snprintf(buf + offset, MAXBUF - offset, (offset > 0) ? ", %s" : "%s", tr("air"));
+ snprintf(buf + offset, MAXBUF - offset, (offset > 0) ? ", %s" : "%s", translate("gettextFromC","air"));
else
if (he == 0)
- snprintf(buf + offset, MAXBUF - offset, (offset > 0) ? tr(", EAN%d") : tr("EAN%d"),
+ snprintf(buf + offset, MAXBUF - offset, (offset > 0) ? translate("gettextFromC",", EAN%d") : translate("gettextFromC","EAN%d"),
(o2 + 5) / 10);
else
snprintf(buf + offset, MAXBUF - offset, (offset > 0) ? ", %d/%d" : "%d/%d",
@@ -368,6 +368,6 @@ char *get_gaslist(struct dive *dive)
offset = strlen(buf);
}
if (*buf == '\0')
- strncpy(buf, tr("air"), MAXBUF);
+ strncpy(buf, translate("gettextFromC","air"), MAXBUF);
return buf;
}
diff --git a/subsurfacestartup.c b/subsurfacestartup.c
index dd0f80899..9a03be6d7 100644
--- a/subsurfacestartup.c
+++ b/subsurfacestartup.c
@@ -55,19 +55,19 @@ const char *weekday(int wday)
{
static const char wday_array[7][7] = {
/*++GETTEXT: these are three letter days - we allow up to six code bytes */
- QT_TR_NOOP("Sun"), QT_TR_NOOP("Mon"), QT_TR_NOOP("Tue"), QT_TR_NOOP("Wed"), QT_TR_NOOP("Thu"), QT_TR_NOOP("Fri"), QT_TR_NOOP("Sat")
+ QT_TRANSLATE_NOOP("gettextFromC","Sun"), QT_TRANSLATE_NOOP("gettextFromC","Mon"), QT_TRANSLATE_NOOP("gettextFromC","Tue"), QT_TRANSLATE_NOOP("gettextFromC","Wed"), QT_TRANSLATE_NOOP("gettextFromC","Thu"), QT_TRANSLATE_NOOP("gettextFromC","Fri"), QT_TRANSLATE_NOOP("gettextFromC","Sat")
};
- return tr(wday_array[wday]);
+ return translate("gettextFromC",wday_array[wday]);
}
const char *monthname(int mon)
{
static const char month_array[12][7] = {
/*++GETTEXT: these are three letter months - we allow up to six code bytes*/
- QT_TR_NOOP("Jan"), QT_TR_NOOP("Feb"), QT_TR_NOOP("Mar"), QT_TR_NOOP("Apr"), QT_TR_NOOP("May"), QT_TR_NOOP("Jun"),
- QT_TR_NOOP("Jul"), QT_TR_NOOP("Aug"), QT_TR_NOOP("Sep"), QT_TR_NOOP("Oct"), QT_TR_NOOP("Nov"), QT_TR_NOOP("Dec"),
+ QT_TRANSLATE_NOOP("gettextFromC","Jan"), QT_TRANSLATE_NOOP("gettextFromC","Feb"), QT_TRANSLATE_NOOP("gettextFromC","Mar"), QT_TRANSLATE_NOOP("gettextFromC","Apr"), QT_TRANSLATE_NOOP("gettextFromC","May"), QT_TRANSLATE_NOOP("gettextFromC","Jun"),
+ QT_TRANSLATE_NOOP("gettextFromC","Jul"), QT_TRANSLATE_NOOP("gettextFromC","Aug"), QT_TRANSLATE_NOOP("gettextFromC","Sep"), QT_TRANSLATE_NOOP("gettextFromC","Oct"), QT_TRANSLATE_NOOP("gettextFromC","Nov"), QT_TRANSLATE_NOOP("gettextFromC","Dec"),
};
- return tr(month_array[mon]);
+ return translate("gettextFromC",month_array[mon]);
}
/*
diff --git a/uemis-downloader.c b/uemis-downloader.c
index eced216aa..37cadf349 100644
--- a/uemis-downloader.c
+++ b/uemis-downloader.c
@@ -21,9 +21,9 @@
#include "uemis.h"
#include "divelist.h"
-#define ERR_FS_ALMOST_FULL QT_TR_NOOP("Uemis Zurich: File System is almost full\nDisconnect/reconnect the dive computer\nand click \'Retry\'")
-#define ERR_FS_FULL QT_TR_NOOP("Uemis Zurich: File System is full\nDisconnect/reconnect the dive computer\nand try again")
-#define ERR_FS_SHORT_WRITE QT_TR_NOOP("Short write to req.txt file\nIs the Uemis Zurich plugged in correctly?")
+#define ERR_FS_ALMOST_FULL QT_TRANSLATE_NOOP("gettextFromC","Uemis Zurich: File System is almost full\nDisconnect/reconnect the dive computer\nand click \'Retry\'")
+#define ERR_FS_FULL QT_TRANSLATE_NOOP("gettextFromC","Uemis Zurich: File System is full\nDisconnect/reconnect the dive computer\nand try again")
+#define ERR_FS_SHORT_WRITE QT_TRANSLATE_NOOP("gettextFromC","Short write to req.txt file\nIs the Uemis Zurich plugged in correctly?")
#define BUFLEN 2048
#define NUM_PARAM_BUFS 10
@@ -103,7 +103,7 @@ static void uemis_get_weight(char *buffer, weightsystem_t *weight, int diveid)
{
weight->weight.grams = uemis_get_weight_unit(diveid) ?
lbs_to_grams(ascii_strtod(buffer, NULL)) : ascii_strtod(buffer, NULL) * 1000;
- weight->description = strdup(tr("unknown"));
+ weight->description = strdup(translate("gettextFromC","unknown"));
}
static struct dive *uemis_start_dive(uint32_t deviceid)
@@ -354,7 +354,7 @@ static void show_progress(char *buf, const char *what)
#if UEMIS_DEBUG & 2
fprintf(debugfile,"reading %s %s\n", what, val);
#endif
- uemis_info(tr("Reading %s %s"), what, val);
+ uemis_info(translate("gettextFromC","Reading %s %s"), what, val);
free(val);
}
}
@@ -374,7 +374,7 @@ static bool uemis_get_answer(const char *path, char *request, int n_param_in,
char sb[BUFLEN];
char fl[13];
char tmp[101];
- const char *what = tr("data");
+ const char *what = translate("gettextFromC","data");
bool searching = TRUE;
bool assembling_mbuf = FALSE;
bool ismulti = FALSE;
@@ -395,11 +395,11 @@ static bool uemis_get_answer(const char *path, char *request, int n_param_in,
answer_in_mbuf = TRUE;
str_append_with_delim(sb, "");
if (! strcmp(request, "getDivelogs"))
- what = tr("divelog entry id");
+ what = translate("gettextFromC","divelog entry id");
else if (!strcmp(request, "getDivespot"))
- what = tr("divespot data id");
+ what = translate("gettextFromC","divespot data id");
else if (!strcmp(request, "getDive"))
- what = tr("more data dive id");
+ what = translate("gettextFromC","more data dive id");
}
str_append_with_delim(sb, "");
file_length = strlen(sb);
@@ -409,11 +409,11 @@ static bool uemis_get_answer(const char *path, char *request, int n_param_in,
fprintf(debugfile,"::w req.txt \"%s\"\n", sb);
#endif
if (write(reqtxt_file, sb, strlen(sb)) != strlen(sb)) {
- *error_text = tr(ERR_FS_SHORT_WRITE);
+ *error_text = translate("gettextFromC",ERR_FS_SHORT_WRITE);
return FALSE;
}
if (! next_file(number_of_files)) {
- *error_text = tr(ERR_FS_FULL);
+ *error_text = translate("gettextFromC",ERR_FS_FULL);
more_files = FALSE;
}
trigger_response(reqtxt_file, "n", filenr, file_length);
@@ -451,7 +451,7 @@ static bool uemis_get_answer(const char *path, char *request, int n_param_in,
assembling_mbuf = FALSE;
if (assembling_mbuf) {
if (! next_file(number_of_files)) {
- *error_text = tr(ERR_FS_FULL);
+ *error_text = translate("gettextFromC",ERR_FS_FULL);
more_files = FALSE;
assembling_mbuf = FALSE;
}
@@ -460,7 +460,7 @@ static bool uemis_get_answer(const char *path, char *request, int n_param_in,
}
} else {
if (! next_file(number_of_files - 1)) {
- *error_text = tr(ERR_FS_FULL);
+ *error_text = translate("gettextFromC",ERR_FS_FULL);
more_files = FALSE;
assembling_mbuf = FALSE;
searching = FALSE;
@@ -579,9 +579,9 @@ static void track_divespot(char *val, int diveid, char **location, degrees_t *la
return;
}
-static char *suit[] = { "", QT_TR_NOOP("wetsuit"), QT_TR_NOOP("semidry"), QT_TR_NOOP("drysuit") };
-static char *suit_type[] = { "", QT_TR_NOOP("shorty"), QT_TR_NOOP("vest"), QT_TR_NOOP("long john"), QT_TR_NOOP("jacket"), QT_TR_NOOP("full suit"), QT_TR_NOOP("2 pcs full suit") };
-static char *suit_thickness[] = { "", "0.5-2mm", "2-3mm", "3-5mm", "5-7mm", "8mm+", QT_TR_NOOP("membrane") };
+static char *suit[] = { "", QT_TRANSLATE_NOOP("gettextFromC","wetsuit"), QT_TRANSLATE_NOOP("gettextFromC","semidry"), QT_TRANSLATE_NOOP("gettextFromC","drysuit") };
+static char *suit_type[] = { "", QT_TRANSLATE_NOOP("gettextFromC","shorty"), QT_TRANSLATE_NOOP("gettextFromC","vest"), QT_TRANSLATE_NOOP("gettextFromC","long john"), QT_TRANSLATE_NOOP("gettextFromC","jacket"), QT_TRANSLATE_NOOP("gettextFromC","full suit"), QT_TRANSLATE_NOOP("gettextFromC","2 pcs full suit") };
+static char *suit_thickness[] = { "", "0.5-2mm", "2-3mm", "3-5mm", "5-7mm", "8mm+", QT_TRANSLATE_NOOP("gettextFromC","membrane") };
static void parse_tag(struct dive *dive, char *tag, char *val)
{
@@ -603,13 +603,13 @@ static void parse_tag(struct dive *dive, char *tag, char *val)
uemis_add_string(val, &dive->notes);
} else if (!strcmp(tag, "u8DiveSuit")) {
if (*suit[atoi(val)])
- uemis_add_string(tr(suit[atoi(val)]), &dive->suit);
+ uemis_add_string(translate("gettextFromC",suit[atoi(val)]), &dive->suit);
} else if (!strcmp(tag, "u8DiveSuitType")) {
if (*suit_type[atoi(val)])
- uemis_add_string(tr(suit_type[atoi(val)]), &dive->suit);
+ uemis_add_string(translate("gettextFromC",suit_type[atoi(val)]), &dive->suit);
} else if (!strcmp(tag, "u8SuitThickness")) {
if (*suit_thickness[atoi(val)])
- uemis_add_string(tr(suit_thickness[atoi(val)]), &dive->suit);
+ uemis_add_string(translate("gettextFromC",suit_thickness[atoi(val)]), &dive->suit);
}
}
@@ -758,9 +758,9 @@ const char *do_uemis_import(const char *mountpath, short force_download)
if (dive_table.nr == 0)
keep_number = TRUE;
- uemis_info(tr("Init Communication"));
+ uemis_info(translate("gettextFromC","Init Communication"));
if (! uemis_init(mountpath))
- return tr("Uemis init failed");
+ return translate("gettextFromC","Uemis init failed");
if (! uemis_get_answer(mountpath, "getDeviceId", 0, 1, &result))
goto bail;
deviceid = strdup(param_buff[0]);
@@ -771,7 +771,7 @@ const char *do_uemis_import(const char *mountpath, short force_download)
/* param_buff[0] is still valid */
if (! uemis_get_answer(mountpath, "initSession", 1, 6, &result))
goto bail;
- uemis_info(tr("Start download"));
+ uemis_info(translate("gettextFromC","Start download"));
if (! uemis_get_answer(mountpath, "processSync", 0, 2, &result))
goto bail;
/* before starting the long download, check if user pressed cancel */
@@ -807,7 +807,7 @@ const char *do_uemis_import(const char *mountpath, short force_download)
break;
/* finally, if the memory is getting too full, maybe we better stop, too */
if (progress_bar_fraction > 0.85) {
- result = tr(ERR_FS_ALMOST_FULL);
+ result = translate("gettextFromC",ERR_FS_ALMOST_FULL);
break;
}
/* clean up mbuf */
@@ -865,7 +865,7 @@ bail:
(void) uemis_get_answer(mountpath, "terminateSync", 0, 3, &result);
if (! strcmp(param_buff[0], "error")) {
if (! strcmp(param_buff[2],"Out of Memory"))
- result = tr(ERR_FS_FULL);
+ result = translate("gettextFromC",ERR_FS_FULL);
else
result = param_buff[2];
}
diff --git a/uemis.c b/uemis.c
index 7b0e3fbc4..f3ef27ddb 100644
--- a/uemis.c
+++ b/uemis.c
@@ -191,45 +191,45 @@ static void uemis_event(struct dive *dive, struct divecomputer *dc, struct sampl
static int lastndl;
if (flags[1] & 0x01)
- add_event(dc, sample->time.seconds, 0, 0, 0, QT_TR_NOOP("Safety Stop Violation"));
+ add_event(dc, sample->time.seconds, 0, 0, 0, QT_TRANSLATE_NOOP("gettextFromC","Safety Stop Violation"));
if (flags[1] & 0x08)
- add_event(dc, sample->time.seconds, 0, 0, 0, QT_TR_NOOP("Speed Alarm"));
+ add_event(dc, sample->time.seconds, 0, 0, 0, QT_TRANSLATE_NOOP("gettextFromC","Speed Alarm"));
#if WANT_CRAZY_WARNINGS
if (flags[1] & 0x06) /* both bits 1 and 2 are a warning */
- add_event(dc, sample->time.seconds, 0, 0, 0, QT_TR_NOOP("Speed Warning"));
+ add_event(dc, sample->time.seconds, 0, 0, 0, QT_TRANSLATE_NOOP("gettextFromC","Speed Warning"));
if (flags[1] & 0x10)
- add_event(dc, sample->time.seconds, 0, 0, 0, QT_TR_NOOP("PO2 Green Warning"));
+ add_event(dc, sample->time.seconds, 0, 0, 0, QT_TRANSLATE_NOOP("gettextFromC","PO2 Green Warning"));
#endif
if (flags[1] & 0x20)
- add_event(dc, sample->time.seconds, 0, 0, 0, QT_TR_NOOP("PO2 Ascend Warning"));
+ add_event(dc, sample->time.seconds, 0, 0, 0, QT_TRANSLATE_NOOP("gettextFromC","PO2 Ascend Warning"));
if (flags[1] & 0x40)
- add_event(dc, sample->time.seconds, 0, 0, 0, QT_TR_NOOP("PO2 Ascend Alarm"));
+ add_event(dc, sample->time.seconds, 0, 0, 0, QT_TRANSLATE_NOOP("gettextFromC","PO2 Ascend Alarm"));
/* flags[2] reflects the deco / time bar
* flags[3] reflects more display details on deco and pO2 */
if (flags[4] & 0x01)
- add_event(dc, sample->time.seconds, 0, 0, 0, QT_TR_NOOP("Tank Pressure Info"));
+ add_event(dc, sample->time.seconds, 0, 0, 0, QT_TRANSLATE_NOOP("gettextFromC","Tank Pressure Info"));
if (flags[4] & 0x04)
- add_event(dc, sample->time.seconds, 0, 0, 0, QT_TR_NOOP("RGT Warning"));
+ add_event(dc, sample->time.seconds, 0, 0, 0, QT_TRANSLATE_NOOP("gettextFromC","RGT Warning"));
if (flags[4] & 0x08)
- add_event(dc, sample->time.seconds, 0, 0, 0, QT_TR_NOOP("RGT Alert"));
+ add_event(dc, sample->time.seconds, 0, 0, 0, QT_TRANSLATE_NOOP("gettextFromC","RGT Alert"));
if (flags[4] & 0x40)
- add_event(dc, sample->time.seconds, 0, 0, 0, QT_TR_NOOP("Tank Change Suggested"));
+ add_event(dc, sample->time.seconds, 0, 0, 0, QT_TRANSLATE_NOOP("gettextFromC","Tank Change Suggested"));
if (flags[4] & 0x80)
- add_event(dc, sample->time.seconds, 0, 0, 0, QT_TR_NOOP("Depth Limit Exceeded"));
+ add_event(dc, sample->time.seconds, 0, 0, 0, QT_TRANSLATE_NOOP("gettextFromC","Depth Limit Exceeded"));
if (flags[5] & 0x01)
- add_event(dc, sample->time.seconds, 0, 0, 0, QT_TR_NOOP("Max Deco Time Warning"));
+ add_event(dc, sample->time.seconds, 0, 0, 0, QT_TRANSLATE_NOOP("gettextFromC","Max Deco Time Warning"));
if (flags[5] & 0x04)
- add_event(dc, sample->time.seconds, 0, 0, 0, QT_TR_NOOP("Dive Time Info"));
+ add_event(dc, sample->time.seconds, 0, 0, 0, QT_TRANSLATE_NOOP("gettextFromC","Dive Time Info"));
if (flags[5] & 0x08)
- add_event(dc, sample->time.seconds, 0, 0, 0, QT_TR_NOOP("Dive Time Alert"));
+ add_event(dc, sample->time.seconds, 0, 0, 0, QT_TRANSLATE_NOOP("gettextFromC","Dive Time Alert"));
if (flags[5] & 0x10)
- add_event(dc, sample->time.seconds, 0, 0, 0, QT_TR_NOOP("Marker"));
+ add_event(dc, sample->time.seconds, 0, 0, 0, QT_TRANSLATE_NOOP("gettextFromC","Marker"));
if (flags[6] & 0x02)
- add_event(dc, sample->time.seconds, 0, 0, 0, QT_TR_NOOP("No Tank Data"));
+ add_event(dc, sample->time.seconds, 0, 0, 0, QT_TRANSLATE_NOOP("gettextFromC","No Tank Data"));
if (flags[6] & 0x04)
- add_event(dc, sample->time.seconds, 0, 0, 0, QT_TR_NOOP("Low Battery Warning"));
+ add_event(dc, sample->time.seconds, 0, 0, 0, QT_TRANSLATE_NOOP("gettextFromC","Low Battery Warning"));
if (flags[6] & 0x08)
- add_event(dc, sample->time.seconds, 0, 0, 0, QT_TR_NOOP("Low Battery Alert"));
+ add_event(dc, sample->time.seconds, 0, 0, 0, QT_TRANSLATE_NOOP("gettextFromC","Low Battery Alert"));
/* flags[7] reflects the little on screen icons that remind of previous
* warnings / alerts - not useful for events */