Opened 7 years ago

Last modified 7 years ago

#5381 new Bug

Uploaded and downloaded totals are not localized

Reported by: federicobt Owned by: jordan
Priority: Normal Milestone: None Set
Component: GTK+ Client Version: 2.77
Severity: Minor Keywords:
Cc:

Description

In the bottom bar where the uploaded and downloaded totals, the session ratio and the overall ratio are displayed, numeric values don't respect the system's locale settings. Numbers appear formatted in English (using . as decimal separator) when Gnome and every other application used the preferred separator (comma).

Attachments (1)

Transmission 2.77 (14031).png (59.9 KB) - added by federicobt 7 years ago.
Screenshot showing Nautilus honoring locale and Transmission not honoring it when displaying numbers.

Download all attachments as: .zip

Change History (2)

Changed 7 years ago by federicobt

Screenshot showing Nautilus honoring locale and Transmission not honoring it when displaying numbers.

comment:1 Changed 7 years ago by federicobt

IMHO just setting the locale to the system's default should fix this bug. As g_snprintf is used to format the numbers and it does honour the locale if it is set. So as soon as the app starts this should be executed

setlocale(LC_ALL, "");

(#include <locale.h> must be there, too).

So after that all calls to g_snprintf use the locale decimal separator.

Example: #include<stdlib.h> #include<stdio.h> #include <locale.h> #include <glib.h> #include <glib/gprintf.h> int main(int argc, char* argv[]){

setlocale(LC_ALL, ""); double x = 10023.14159d; char buf[64]; g_snprintf (buf, sizeof(buf), "%'f", x); printf("%s\n", buf); return EXIT_SUCCESS;

}

It prints 10.023,141590

My locale command prints

LANG=es_AR.UTF-8 LANGUAGE=es_AR:es LC_CTYPE="es_AR.UTF-8" LC_NUMERIC="es_AR.UTF-8" LC_TIME="es_AR.UTF-8" LC_COLLATE="es_AR.UTF-8" LC_MONETARY="es_AR.UTF-8" LC_MESSAGES="es_AR.UTF-8" LC_PAPER="es_AR.UTF-8" LC_NAME="es_AR.UTF-8" LC_ADDRESS="es_AR.UTF-8" LC_TELEPHONE="es_AR.UTF-8" LC_MEASUREMENT="es_AR.UTF-8" LC_IDENTIFICATION="es_AR.UTF-8" LC_ALL=

Note: See TracTickets for help on using tickets.