[PATCH] dive.c: set some of units for localization

Dirk Hohndel dirk at hohndel.org
Wed Oct 17 11:23:15 PDT 2012


I thought these were SI units (well, mostly) - are these actually
localized in different languages?

If I were doing the German translation for them, I think they would all
be 1:1 the samt (you could argue that Germans would be more likely to
write ft³ that cuft - but since the unit isn't used by any sane person
outside a few backwaters, I don't think it really matters...)

So I'm not sure I want to apply this patch...

/D

"Lubomir I. Ivanov" <neolit123 at gmail.com> writes:

> From: "Lubomir I. Ivanov" <neolit123 at gmail.com>
>
> get_pressure_units() and get_volume_units() should
> return localized strings.
>
> Signed-off-by: Lubomir I. Ivanov <neolit123 at gmail.com>
> ---
>  dive.c | 18 +++++++++---------
>  1 file changed, 9 insertions(+), 9 deletions(-)
>
> diff --git a/dive.c b/dive.c
> index 85b2f3b..7e47c1e 100644
> --- a/dive.c
> +++ b/dive.c
> @@ -38,15 +38,15 @@ int get_pressure_units(unsigned int mb, const char **units)
>  	switch (output_units.pressure) {
>  	case PASCAL:
>  		pressure = mb * 100;
> -		unit = "pascal";
> +		unit = N_("pascal");
>  		break;
>  	case BAR:
>  		pressure = (mb + 500) / 1000;
> -		unit = "bar";
> +		unit = N_("bar");
>  		break;
>  	case PSI:
>  		pressure = mbar_to_PSI(mb);
> -		unit = "psi";
> +		unit = N_("psi");
>  		break;
>  	}
>  	if (units)
> @@ -80,12 +80,12 @@ double get_volume_units(unsigned int ml, int *frac, const char **units)
>  	switch (output_units.volume) {
>  	case LITER:
>  		vol = ml / 1000.0;
> -		unit = "l";
> +		unit = N_("l");
>  		decimals = 1;
>  		break;
>  	case CUFT:
>  		vol = ml_to_cuft(ml);
> -		unit = "cuft";
> +		unit = N_("CuFt");
>  		decimals = 2;
>  		break;
>  	}
> @@ -105,12 +105,12 @@ double get_depth_units(unsigned int mm, int *frac, const char **units)
>  	switch (output_units.length) {
>  	case METERS:
>  		d = mm / 1000.0;
> -		unit = "m";
> +		unit = N_("m");
>  		decimals = d < 20;
>  		break;
>  	case FEET:
>  		d = mm_to_feet(mm);
> -		unit = "ft";
> +		unit = N_("ft");
>  		decimals = 0;
>  		break;
>  	}
> @@ -129,11 +129,11 @@ double get_weight_units(unsigned int grams, int *frac, const char **units)
>
>  	if (output_units.weight == LBS) {
>  		value = grams_to_lbs(grams);
> -		unit = "lbs";
> +		unit = N_("lbs");
>  		decimals = 0;
>  	} else {
>  		value = grams / 1000.0;
> -		unit = "kg";
> +		unit = N_("kg");
>  		decimals = 1;
>  	}
>  	if (frac)
> --
> 1.7.11.msysgit.0
>
> _______________________________________________
> subsurface mailing list
> subsurface at hohndel.org
> http://lists.hohndel.org/cgi-bin/mailman/listinfo/subsurface

-- 
Dirk Hohndel
Intel Open Source Technology Center


More information about the subsurface mailing list