diff options
author | Dirk Hohndel <dirk@hohndel.org> | 2012-10-20 14:21:07 -0700 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2012-10-20 14:46:30 -0700 |
commit | f01bfc11a97a404516dd56fac5f5f755958fe649 (patch) | |
tree | d92526d988c7641a228f4c7e9775c8869874a891 /libdivecomputer.c | |
parent | 6e0878292c0c14816ebab7135d1e5c61f404f683 (diff) | |
download | subsurface-f01bfc11a97a404516dd56fac5f5f755958fe649.tar.gz |
Added missing localization macros to libdivecomputer.c
Somehow no one noticed that this file had been skipped in the localization
effort.
Fixes #6
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'libdivecomputer.c')
-rw-r--r-- | libdivecomputer.c | 53 |
1 files changed, 27 insertions, 26 deletions
diff --git a/libdivecomputer.c b/libdivecomputer.c index 51d0a8c1d..713ee7599 100644 --- a/libdivecomputer.c +++ b/libdivecomputer.c @@ -75,11 +75,12 @@ static void handle_event(struct dive *dive, struct sample *sample, dc_sample_val { int type, time; static const char *events[] = { - "none", "deco", "rbt", "ascent", "ceiling", "workload", "transmitter", - "violation", "bookmark", "surface", "safety stop", "gaschange", - "safety stop (voluntary)", "safety stop (mandatory)", "deepstop", - "ceiling (safety stop)", "unknown", "divetime", "maxdepth", - "OLF", "PO2", "airtime", "rgbm", "heading", "tissue level warning" + N_("none"), N_("deco"), 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_("unknown"), N_("divetime"), + N_("maxdepth"), N_("OLF"), N_("PO2"), N_("airtime"), N_("rgbm"), N_("heading"), + N_("tissue level warning") }; const int nr_events = sizeof(events) / sizeof(const char *); const char *name; @@ -97,9 +98,9 @@ static void handle_event(struct dive *dive, struct sample *sample, dc_sample_val * Other evens might be more interesting, but for now we just print them out. */ type = value.event.type; - name = "invalid event number"; + name = _("invalid event number"); if (type < nr_events) - name = events[type]; + name = _(events[type]); time = value.event.time; if (sample) @@ -163,7 +164,7 @@ sample_cb(dc_sample_type_t type, dc_sample_value_t value, void *userdata) static void dev_info(device_data_t *devdata, const char *fmt, ...) { - static char buffer[32]; + static char buffer[256]; va_list ap; va_start(ap, fmt); @@ -219,13 +220,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, _("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, _("Error registering the data")); dc_parser_destroy(parser); return rc; } @@ -234,7 +235,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, _("Error parsing the datetime")); dc_parser_destroy(parser); return rc; } @@ -248,12 +249,12 @@ static int dive_cb(const unsigned char *data, unsigned int size, dive->when = utc_mktime(&tm); // Parse the divetime. - dev_info(devdata, "Dive %d: %s %d %04d", import_dive_number, + dev_info(devdata, _("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, _("Error parsing the divetime")); dc_parser_destroy(parser); return rc; } @@ -263,7 +264,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, _("Error parsing the maxdepth")); dc_parser_destroy(parser); return rc; } @@ -273,14 +274,14 @@ 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, _("Error parsing the gas mix count")); dc_parser_destroy(parser); return rc; } rc = parse_gasmixes(devdata, dive, parser, ngases); if (rc != DC_STATUS_SUCCESS) { - dev_info(devdata, "Error parsing the gas mix"); + dev_info(devdata, _("Error parsing the gas mix")); dc_parser_destroy(parser); return rc; } @@ -288,7 +289,7 @@ static int dive_cb(const unsigned char *data, unsigned int size, // Initialize the sample data. rc = parse_samples(devdata, &dive, parser); if (rc != DC_STATUS_SUCCESS) { - dev_info(devdata, "Error parsing the samples"); + dev_info(devdata, _("Error parsing the samples")); dc_parser_destroy(parser); return rc; } @@ -319,7 +320,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, _("Event: waiting for user action")); break; case DC_EVENT_PROGRESS: if (!progress->maximum) @@ -327,13 +328,13 @@ 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, _("model=%u (0x%08x), firmware=%u (0x%08x), serial=%u (0x%08x)"), devinfo->model, devinfo->model, devinfo->firmware, devinfo->firmware, devinfo->serial, devinfo->serial); break; case DC_EVENT_CLOCK: - dev_info(devdata, "Event: systime=%"PRId64", devtime=%u\n", + dev_info(devdata, _("Event: systime=%"PRId64", devtime=%u\n"), (uint64_t)clock->systime, clock->devtime); break; default: @@ -358,16 +359,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 _("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 _("Error registering the cancellation handler."); rc = import_device_data(device, data); if (rc != DC_STATUS_SUCCESS) - return "Dive data import error"; + return _("Dive data import error"); /* All good */ return NULL; @@ -384,9 +385,9 @@ static 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 _("Unable to create libdivecomputer context"); - err = "Unable to open %s %s (%s)"; + err = _("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); @@ -421,7 +422,7 @@ GError *do_import(device_data_t *data) usleep(100000); } if (pthread_join(pthread, &retval) < 0) - retval = "Odd pthread error return"; + retval = _("Odd pthread error return"); if (retval) return error(retval, data->vendor, data->product, data->devname); return NULL; |