Translations, translations, translations

Dirk Hohndel dirk at
Sun Oct 21 09:53:11 PDT 2012

On Oct 21, 2012, at 6:11 AM, Miika Turkia wrote:

> I am looking into translations and I just can't figure out the
> following, what are the strings we are talking about?
> libdivecomputer.c:390
> err = _("Unable to open %s %s (%s)");

That's why the tools leave the file / line number reference. That way you can simply look
(and I'll admit right away that this was one of the rare somewhat complicated cases):

static const char *do_libdivecomputer_import(device_data_t *data)
        dc_status_t rc;
        const char *err;

        import_dive_number = 0;
        data->device = NULL;
        data->context = NULL;

        rc = dc_context_new(&data->context);
        if (rc != DC_STATUS_SUCCESS)
                return _("Unable to create libdivecomputer context");

        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);
        return err;

So this hands the string back to the calling function, and if you follow the
chain of calls you'll see that  this is what the pthread_wrapper ends up returning.

        if (pthread_join(pthread, &retval) < 0)
                retval = _("Odd pthread error return");
        if (retval)
                return error(retval, data->vendor, data->product, data->devname);

So this turns into an error "Unable to open <vendor> <product> (<devname>)"

Does that make more sense?


More information about the subsurface mailing list