mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
Trying to switch to Qt translation
This compiles and looks about right, but it doesn't appear to work, yet. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
2c4ccc04bd
commit
4d3e74a236
24 changed files with 272 additions and 294 deletions
|
@ -2,13 +2,7 @@
|
|||
#include <unistd.h>
|
||||
#include <inttypes.h>
|
||||
#include <string.h>
|
||||
#if 0
|
||||
#include <glib/gi18n.h>
|
||||
#else
|
||||
#define _(arg) arg
|
||||
#define N_(arg) arg
|
||||
#endif
|
||||
|
||||
#include "gettext.h"
|
||||
#include "dive.h"
|
||||
#include "device.h"
|
||||
#include "divelist.h"
|
||||
|
@ -156,12 +150,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[] = {
|
||||
N_("none"), N_("deco stop"), N_("rbt"), N_("ascent"), N_("ceiling"), N_("workload"),
|
||||
N_("transmitter"), N_("violation"), N_("bookmark"), N_("surface"), N_("safety stop"),
|
||||
N_("gaschange"), N_("safety stop (voluntary)"), N_("safety stop (mandatory)"),
|
||||
N_("deepstop"), N_("ceiling (safety stop)"), N_("below floor"), N_("divetime"),
|
||||
N_("maxdepth"), N_("OLF"), N_("PO2"), N_("airtime"), N_("rgbm"), N_("heading"),
|
||||
N_("tissue level warning"), N_("gaschange"), N_("non stop time")
|
||||
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")
|
||||
};
|
||||
const int nr_events = sizeof(events) / sizeof(const char *);
|
||||
const char *name;
|
||||
|
@ -178,7 +172,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 = N_("invalid event number");
|
||||
name = QT_TR_NOOP("invalid event number");
|
||||
if (type < nr_events)
|
||||
name = events[type];
|
||||
|
||||
|
@ -411,13 +405,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, _("Unable to create parser for %s %s"), devdata->vendor, devdata->product);
|
||||
dev_info(devdata, tr("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, _("Error registering the data"));
|
||||
dev_info(devdata, tr("Error registering the data"));
|
||||
dc_parser_destroy(parser);
|
||||
return rc;
|
||||
}
|
||||
|
@ -426,7 +420,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, _("Error parsing the datetime"));
|
||||
dev_info(devdata, tr("Error parsing the datetime"));
|
||||
dc_parser_destroy(parser);
|
||||
return rc;
|
||||
}
|
||||
|
@ -443,12 +437,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, _("Dive %d: %s %d %04d"), import_dive_number,
|
||||
dev_info(devdata, tr("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, _("Error parsing the divetime"));
|
||||
dev_info(devdata, tr("Error parsing the divetime"));
|
||||
dc_parser_destroy(parser);
|
||||
return rc;
|
||||
}
|
||||
|
@ -458,7 +452,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, _("Error parsing the maxdepth"));
|
||||
dev_info(devdata, tr("Error parsing the maxdepth"));
|
||||
dc_parser_destroy(parser);
|
||||
return rc;
|
||||
}
|
||||
|
@ -468,7 +462,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, _("Error parsing the gas mix count"));
|
||||
dev_info(devdata, tr("Error parsing the gas mix count"));
|
||||
dc_parser_destroy(parser);
|
||||
return rc;
|
||||
}
|
||||
|
@ -481,7 +475,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, _("Error obtaining water salinity"));
|
||||
dev_info(devdata, tr("Error obtaining water salinity"));
|
||||
dc_parser_destroy(parser);
|
||||
return rc;
|
||||
}
|
||||
|
@ -490,7 +484,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, _("Error obtaining surface pressure"));
|
||||
dev_info(devdata, tr("Error obtaining surface pressure"));
|
||||
dc_parser_destroy(parser);
|
||||
return rc;
|
||||
}
|
||||
|
@ -499,7 +493,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, _("Error parsing the gas mix"));
|
||||
dev_info(devdata, tr("Error parsing the gas mix"));
|
||||
dc_parser_destroy(parser);
|
||||
return rc;
|
||||
}
|
||||
|
@ -507,7 +501,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, _("Error parsing the samples"));
|
||||
dev_info(devdata, tr("Error parsing the samples"));
|
||||
dc_parser_destroy(parser);
|
||||
return rc;
|
||||
}
|
||||
|
@ -634,7 +628,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, _("Event: waiting for user action"));
|
||||
dev_info(devdata, tr("Event: waiting for user action"));
|
||||
break;
|
||||
case DC_EVENT_PROGRESS:
|
||||
if (!progress->maximum)
|
||||
|
@ -642,7 +636,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, _("model=%u (0x%08x), firmware=%u (0x%08x), serial=%u (0x%08x)"),
|
||||
dev_info(devdata, tr("model=%u (0x%08x), firmware=%u (0x%08x), serial=%u (0x%08x)"),
|
||||
devinfo->model, devinfo->model,
|
||||
devinfo->firmware, devinfo->firmware,
|
||||
devinfo->serial, devinfo->serial);
|
||||
|
@ -657,7 +651,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, _("Event: systime=%"PRId64", devtime=%u\n"),
|
||||
dev_info(devdata, tr("Event: systime=%"PRId64", devtime=%u\n"),
|
||||
(uint64_t)clock->systime, clock->devtime);
|
||||
break;
|
||||
default:
|
||||
|
@ -684,16 +678,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 _("Error registering the event handler.");
|
||||
return tr("Error registering the event handler.");
|
||||
|
||||
// Register the cancellation handler.
|
||||
rc = dc_device_set_cancel(device, cancel_cb, data);
|
||||
if (rc != DC_STATUS_SUCCESS)
|
||||
return _("Error registering the cancellation handler.");
|
||||
return tr("Error registering the cancellation handler.");
|
||||
|
||||
rc = import_device_data(device, data);
|
||||
if (rc != DC_STATUS_SUCCESS)
|
||||
return _("Dive data import error");
|
||||
return tr("Dive data import error");
|
||||
|
||||
/* All good */
|
||||
return NULL;
|
||||
|
@ -711,9 +705,9 @@ const char *do_libdivecomputer_import(device_data_t *data)
|
|||
|
||||
rc = dc_context_new(&data->context);
|
||||
if (rc != DC_STATUS_SUCCESS)
|
||||
return _("Unable to create libdivecomputer context");
|
||||
return tr("Unable to create libdivecomputer context");
|
||||
|
||||
err = _("Unable to open %s %s (%s)");
|
||||
err = tr("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);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue