Skip to content

Custom is_fahrenheit_country()? (and rant about forcing Fahrenheit as default) #2910

@wdoekes

Description

@wdoekes

In c95f96e code was added that switches to Fahrenheit based on a is_fahrenheit_country() function.

This addition led me to come here, because our monitoring suddenly thought that drives were overheating at 91 degrees instead of 33.
en_US.UTF-8 is a widespread and perfectly fine default, but using glazed donuts per bald eagle units is definitely not a default we can handle.
While I am not blameless for having this default, I'm also a bit disappointed in this non-optional change that affects many people who like their systems in English, but who are otherwise not one of the (at most) 350M people around the world using US imperial units.

As I write here #2456 (comment), extracting the country from the locale name and checking that against a list of countries is pretty non-standard and overly complicated (if I may say so).

Are there reasons not to use the _NL_MEASUREMENT_MEASUREMENT from locale(7)?

    const char *m = nl_langinfo(_NL_MEASUREMENT_MEASUREMENT);
    if (m && m[0] == 2) {
        printf("fahrenheit\n");
    } else {
        printf("celsius\n");
    }

That would clean up the code, and future proof things for the time when the Muricans switch to metric.

Thanks!
Walter Doekes
OSSO B.V.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions