dive.c: set some of units for localization

get_pressure_units() and get_volume_units() should
return localized strings.

[Dirk Hohndel: updated to use the correct macro]

Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
Lubomir I. Ivanov 2012-10-17 20:42:31 +03:00 committed by Dirk Hohndel
parent 777c27d675
commit 90c9b0e311

18
dive.c
View file

@ -38,15 +38,15 @@ int get_pressure_units(unsigned int mb, const char **units)
switch (output_units.pressure) { switch (output_units.pressure) {
case PASCAL: case PASCAL:
pressure = mb * 100; pressure = mb * 100;
unit = "pascal"; unit = _("pascal");
break; break;
case BAR: case BAR:
pressure = (mb + 500) / 1000; pressure = (mb + 500) / 1000;
unit = "bar"; unit = _("bar");
break; break;
case PSI: case PSI:
pressure = mbar_to_PSI(mb); pressure = mbar_to_PSI(mb);
unit = "psi"; unit = _("psi");
break; break;
} }
if (units) if (units)
@ -80,12 +80,12 @@ double get_volume_units(unsigned int ml, int *frac, const char **units)
switch (output_units.volume) { switch (output_units.volume) {
case LITER: case LITER:
vol = ml / 1000.0; vol = ml / 1000.0;
unit = "l"; unit = _("l");
decimals = 1; decimals = 1;
break; break;
case CUFT: case CUFT:
vol = ml_to_cuft(ml); vol = ml_to_cuft(ml);
unit = "cuft"; unit = _("cuft");
decimals = 2; decimals = 2;
break; break;
} }
@ -105,12 +105,12 @@ double get_depth_units(unsigned int mm, int *frac, const char **units)
switch (output_units.length) { switch (output_units.length) {
case METERS: case METERS:
d = mm / 1000.0; d = mm / 1000.0;
unit = "m"; unit = _("m");
decimals = d < 20; decimals = d < 20;
break; break;
case FEET: case FEET:
d = mm_to_feet(mm); d = mm_to_feet(mm);
unit = "ft"; unit = _("ft");
decimals = 0; decimals = 0;
break; break;
} }
@ -129,11 +129,11 @@ double get_weight_units(unsigned int grams, int *frac, const char **units)
if (output_units.weight == LBS) { if (output_units.weight == LBS) {
value = grams_to_lbs(grams); value = grams_to_lbs(grams);
unit = "lbs"; unit = _("lbs");
decimals = 0; decimals = 0;
} else { } else {
value = grams / 1000.0; value = grams / 1000.0;
unit = "kg"; unit = _("kg");
decimals = 1; decimals = 1;
} }
if (frac) if (frac)