# shellcheck shell=dash

___x_cmd_locale_info(){
    if ___x_cmd_is_stdout2tty; then
        ___x_cmd_locale_info___tty
    else
        ___x_cmd_locale_info___pipe
    fi
}

___x_cmd_locale_info___pipe(){
    printf "%s=%s\n"            LANG            "$LANG"
    printf "%s=%s\n"            LC_COLLATE      "$LC_COLLATE"
    printf "%s=%s\n"            LC_CTYPE        "$LC_CTYPE"
    printf "%s=%s\n"            LC_MESSAGES     "$LC_MESSAGES"
    printf "%s=%s\n"            LC_MONETARY     "$LC_MONETARY"
    printf "%s=%s\n"            LC_NUMERIC      "$LC_NUMERIC"
    printf "%s=%s\n"            LC_TIME         "$LC_TIME"
    printf "%s=%s\n"            LC_ALL          "$LC_ALL"
}

___x_cmd_locale_info___tty(){
    printf "%-12s: \t%5s\n"      LANG            "$LANG"
    printf "%-12s: \t%5s\n"      LC_COLLATE      "$LC_COLLATE"
    printf "%-12s: \t%5s\n"      LC_CTYPE        "$LC_CTYPE"
    printf "%-12s: \t%5s\n"      LC_MESSAGES     "$LC_MESSAGES"
    printf "%-12s: \t%5s\n"      LC_MONETARY     "$LC_MONETARY"
    printf "%-12s: \t%5s\n"      LC_NUMERIC      "$LC_NUMERIC"
    printf "%-12s: \t%5s\n"      LC_TIME         "$LC_TIME"
    printf "%-12s: \t%5s\n"      LC_ALL          "$LC_ALL"
}

