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:
Dirk Hohndel 2013-10-06 08:55:58 -07:00
parent 2c4ccc04bd
commit 4d3e74a236
24 changed files with 272 additions and 294 deletions

29
dive.c
View file

@ -2,10 +2,7 @@
/* maintains the internal dive list structure */
#include <string.h>
#include <stdio.h>
#if 0
#include <glib/gi18n.h>
#endif
#include "gettext.h"
#include "dive.h"
void add_event(struct divecomputer *dc, int time, int type, int flags, int value, const char *name)
@ -43,15 +40,15 @@ int get_pressure_units(unsigned int mb, const char **units)
switch (units_p->pressure) {
case PASCAL:
pressure = mb * 100;
unit = _("pascal");
unit = tr("pascal");
break;
case BAR:
pressure = (mb + 500) / 1000;
unit = _("bar");
unit = tr("bar");
break;
case PSI:
pressure = mbar_to_PSI(mb);
unit = _("psi");
unit = tr("psi");
break;
}
if (units)
@ -87,12 +84,12 @@ double get_volume_units(unsigned int ml, int *frac, const char **units)
switch (units_p->volume) {
case LITER:
vol = ml / 1000.0;
unit = _("l");
unit = tr("l");
decimals = 1;
break;
case CUFT:
vol = ml_to_cuft(ml);
unit = _("cuft");
unit = tr("cuft");
decimals = 2;
break;
}
@ -113,12 +110,12 @@ double get_depth_units(unsigned int mm, int *frac, const char **units)
switch (units_p->length) {
case METERS:
d = mm / 1000.0;
unit = _("m");
unit = tr("m");
decimals = d < 20;
break;
case FEET:
d = mm_to_feet(mm);
unit = _("ft");
unit = tr("ft");
decimals = 0;
break;
}
@ -139,11 +136,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 = _((units_p->vertical_speed_time == MINUTES) ? "m/min" : "m/s");
unit = tr((units_p->vertical_speed_time == MINUTES) ? "m/min" : "m/s");
break;
case FEET:
d = mm_to_feet(mms) * time_factor;
unit = _((units_p->vertical_speed_time == MINUTES) ? "ft/min" : "ft/s");
unit = tr((units_p->vertical_speed_time == MINUTES) ? "ft/min" : "ft/s");
break;
}
if (frac)
@ -162,11 +159,11 @@ double get_weight_units(unsigned int grams, int *frac, const char **units)
if (units_p->weight == LBS) {
value = grams_to_lbs(grams);
unit = _("lbs");
unit = tr("lbs");
decimals = 0;
} else {
value = grams / 1000.0;
unit = _("kg");
unit = tr("kg");
decimals = 1;
}
if (frac)
@ -962,7 +959,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, _("(%s) or (%s)"), a, b);
sprintf(res, tr("(%s) or (%s)"), a, b);
return res;
}