problem in our file format

Miika Turkia miika.turkia at gmail.com
Wed Feb 22 02:28:13 PST 2017


On Wed, Feb 22, 2017 at 12:03 PM, Dirk Hohndel <dirk at hohndel.org> wrote:
> So this isn't really a "problem" problem, but it still is wrong. I'm just
> not sure what to do about it. This is something that I committed a little
> over to years ago:
>
>
> commit c2e23914932cdfa254e817c06af064992888d377
> Author: Dirk Hohndel <dirk at hohndel.org>
> Date:   Mon Feb 9 13:40:17 2015 -0800
>
>     Prevent a tank from looking undefined by mistake
>
>     If we have no default cylidner set and get no data about an air tank from
>     libdivecomputer, our cylinder will look completely empty by mistake.
>     Always setting some kind of description fixes that.
>
>     Signed-off-by: Dirk Hohndel <dirk at hohndel.org>
>
> diff --git a/libdivecomputer.c b/libdivecomputer.c
> index 6a16eb12db74..942b1ec149b2 100644
> --- a/libdivecomputer.c
> +++ b/libdivecomputer.c
> @@ -107,6 +107,9 @@ static int parse_gasmixes(device_data_t *devdata, struct dive *dive, dc_parser_t
>                          * dive computer, fill in the default tank information (if set) */
>                         fill_default_cylinder(&dive->cylinder[i]);
>                 }
> +               /* whatever happens, make sure there is a name for the cylidner */
> +               if (same_string(dive->cylinder[i].type.description, ""))
> +                       dive->cylinder[i].type.description = strdup(translate("gettextFromC", "unknown"));
>         }
>         return DC_STATUS_SUCCESS;
>  }
>
>
>
> Yeah OOPS, that description goes into the XML file / git storage. So we
> now have a localized string that has "meaning". Because of that we can't
> simply say "oh, we are merging two dives, they have the same cylinder, but
> in one of the two dives we have a 'better' description" (let's say one
> gets you the correct "AL80", the other one has the same volume / working
> pressure, but description "unknown").
>
> But because I foolishly decided to translate that string, we no longer can
> do that...
>
> Is this worth fixing? I.e., store "unknown" in this case as literal and
> instead translate "unknown" when it is encountered in the UI as tank
> description? I think that's the right thing to do, but I figured it was
> worth asking for feedback.

Yeah, we should only translate stuff when it is being displayed.
Internally we use metric (and English). It is only going to cause
trouble to store the translated string. I have seen it before with
another software...

miika


More information about the subsurface mailing list