summaryrefslogtreecommitdiffstats
path: root/dive.c
diff options
context:
space:
mode:
authorGravatar Dirk Hohndel <dirk@hohndel.org>2013-10-09 22:48:35 -0700
committerGravatar Dirk Hohndel <dirk@hohndel.org>2013-10-09 22:51:59 -0700
commit193d20c479d597db307ac5e206b74b26c2f97ba9 (patch)
treeb9f55e5acbacb4d397edb022cf8a37ef4654efbf /dive.c
parent2d69d4a5ef5f2d3e777d77380732c333151fe949 (diff)
downloadsubsurface-193d20c479d597db307ac5e206b74b26c2f97ba9.tar.gz
Next step towards working translations
This may seem like a really odd change - but with this change the Qt tools can correctly parse the C files (and qt-gui.cpp) and get the context for the translatable strings right. It's not super-pretty (I'll admit that _("string literal") is much easier on the eye than translate("gettextFromC", "string literal") ) but I think this will be the price of success. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'dive.c')
-rw-r--r--dive.c24
1 files changed, 12 insertions, 12 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;
}