Hi, have a problem with localized date representation. Dates are in the following format:
2012-05-01
My system is using the it_IT locale as QLocale::system().name() confirms. But
date.toString(Qt::SystemLocaleShortDate)
date.toString(Qt::SystemLocaleShortDate)
To copy to clipboard, switch view to plain text mode
returns the english string "1 May 2012" instead of the italian "1 Mag 2012"
Seems that the only option to have an italian localization is to use:
QLocale::setDefault(locale.
name());
locale.
toString(date,
QLocale::ShortFormat)
QLocale locale;
QLocale::setDefault(locale.name());
locale.toString(date, QLocale::ShortFormat)
To copy to clipboard, switch view to plain text mode
But the returned string is "01/05/2012", while if using QLocale::LongFormat I got "martedì 1 maggio 2012" that is correct, but too long.
With locale.toString(date, "dd MMMM yyyy") I obtain the desired format but since I will release the code I would prefer a more clean solution.
Thanks.
Bookmarks