[prev in list] [next in list] [prev in thread] [next in thread] 

List:       pykde
Subject:    Re: [PyQt] SystemLocaleShortDate omits the century on Linux
From:       Barry Scott <barry () barrys-emacs ! org>
Date:       2020-03-17 21:43:39
Message-ID: 1A864473-DA7E-4771-AF1B-A65FA1BCB7B0 () barrys-emacs ! org
[Download RAW message or body]

[Attachment #2 (multipart/alternative)]


> On 11 Mar 2020, at 19:47, Maurizio Berti <maurizio.berti@gmail.com> wrote:
> 
> Taken from QDate.toString (https://doc.qt.io/qt-5/qdate.html#toString-1 \
> <https://doc.qt.io/qt-5/qdate.html#toString-1>): 
> If the format is Qt::SystemLocaleShortDate or Qt::SystemLocaleLongDate, the string \
> format depends on the locale settings of the system.  
> It completely depends on how the system "tells" what is the date format.
> Apparently, Windows defaults to 4 digits for your localization, while it's set to 2 \
> for Linux. You can change them in both systems: in Windows it's on the regional \
> settings, while on Linux it depends on your distro/window manager/etc.

I think you will find it depends on glibc's localisation database.
I would be surprised if distro's patch that. Surprised not shocked.

If GUI tool kits have code to do this as well it is possible that
command line (Glibc) programs give different answer then GUI's.

Barry


> 
> Maurizio
> 
> Il giorno mer 11 mar 2020 alle ore 19:19 Sibylle Koczian <nulla.epistola@web.de \
> <mailto:nulla.epistola@web.de>> ha scritto: Hello,
> 
> on Windows SystemLocaleShortDate gives 'dd.MM.yyyy', quite correct for
> locale de-DE.
> 
> On Linux (at least on ArchLinux, I didn't try other distributions) it
> gives 'dd.MM.yy' with the same locale.
> 
> The documentation calls SystemLocaleShortDate "The short format used by
> the operating system". But the locale's date representation as given by
> "date +%x" in the Linux terminal shows the date as it should be,
> including the century.
> 
> Why the difference?
> 
> It is especially annoying with dates from this year in a QTableView: I
> always try to drag the date column wider which doesn't help.
> 
> Looking for explanations,
> Sibylle
> _______________________________________________
> PyQt mailing list    PyQt@riverbankcomputing.com \
> <mailto:PyQt@riverbankcomputing.com> \
> https://www.riverbankcomputing.com/mailman/listinfo/pyqt \
> <https://www.riverbankcomputing.com/mailman/listinfo/pyqt> 
> 
> -- 
> È difficile avere una convinzione precisa quando si parla delle ragioni del cuore. \
> - "Sostiene Pereira", Antonio Tabucchi http://www.jidesk.net \
> <http://www.jidesk.net/>_______________________________________________ PyQt \
> mailing list    PyQt@riverbankcomputing.com \
> https://www.riverbankcomputing.com/mailman/listinfo/pyqt


[Attachment #5 (unknown)]

<html><head><meta http-equiv="Content-Type" content="text/html; \
charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; \
line-break: after-white-space;" class=""><br class=""><div><br class=""><blockquote \
type="cite" class=""><div class="">On 11 Mar 2020, at 19:47, Maurizio Berti &lt;<a \
href="mailto:maurizio.berti@gmail.com" class="">maurizio.berti@gmail.com</a>&gt; \
wrote:</div><br class="Apple-interchange-newline"><div class=""><div dir="ltr" \
class=""><div dir="ltr" class=""><div class="">Taken from QDate.toString (<a \
href="https://doc.qt.io/qt-5/qdate.html#toString-1" \
class="">https://doc.qt.io/qt-5/qdate.html#toString-1</a>):</div><div dir="ltr" \
class=""><br class=""></div><blockquote class="gmail_quote" style="margin:0px 0px 0px \
0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">If the format is \
Qt::SystemLocaleShortDate or Qt::SystemLocaleLongDate, the string format depends on \
the locale settings of the system.&nbsp;</blockquote><div class=""><br \
class=""></div><div class="">It completely depends on how the system "tells" what is \
the date format.</div><div class="">Apparently, Windows defaults to 4 digits for your \
localization, while it's set to 2 for Linux.<br class="">You can change them in both \
systems: in Windows it's on the regional settings, while on Linux it depends on your \
distro/window manager/etc.</div></div></div></div></blockquote><div><br \
class=""></div><div>I think you will find it depends on glibc's localisation \
database.</div><div>I would be surprised if distro's patch that. Surprised not \
shocked.</div><div><br class=""></div><div>If GUI tool kits have code to do this as \
well it is possible that</div><div>command line (Glibc) programs give different \
answer then GUI's.</div><div><br class=""></div><div>Barry</div><div><br \
class=""></div><br class=""><blockquote type="cite" class=""><div class=""><div \
dir="ltr" class=""><div dir="ltr" class=""><div class=""><br class=""></div><div \
class="">Maurizio</div></div></div><br class=""><div class="gmail_quote"><div \
dir="ltr" class="gmail_attr">Il giorno mer 11 mar 2020 alle ore 19:19 Sibylle Koczian \
&lt;<a href="mailto:nulla.epistola@web.de" class="">nulla.epistola@web.de</a>&gt; ha \
scritto:<br class=""></div><blockquote class="gmail_quote" style="margin:0px 0px 0px \
0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Hello,<br class=""> \
<br class=""> on Windows SystemLocaleShortDate gives 'dd.MM.yyyy', quite correct \
for<br class=""> locale de-DE.<br class="">
<br class="">
On Linux (at least on ArchLinux, I didn't try other distributions) it<br class="">
gives 'dd.MM.yy' with the same locale.<br class="">
<br class="">
The documentation calls SystemLocaleShortDate "The short format used by<br class="">
the operating system". But the locale's date representation as given by<br class="">
"date +%x" in the Linux terminal shows the date as it should be,<br class="">
including the century.<br class="">
<br class="">
Why the difference?<br class="">
<br class="">
It is especially annoying with dates from this year in a QTableView: I<br class="">
always try to drag the date column wider which doesn't help.<br class="">
<br class="">
Looking for explanations,<br class="">
Sibylle<br class="">
_______________________________________________<br class="">
PyQt mailing list&nbsp; &nbsp; <a href="mailto:PyQt@riverbankcomputing.com" \
target="_blank" class="">PyQt@riverbankcomputing.com</a><br class=""> <a \
href="https://www.riverbankcomputing.com/mailman/listinfo/pyqt" rel="noreferrer" \
target="_blank" class="">https://www.riverbankcomputing.com/mailman/listinfo/pyqt</a><br \
class=""> </blockquote></div><br clear="all" class=""><div class=""><br \
class=""></div>-- <br class=""><div dir="ltr" class="gmail_signature">È difficile \
avere una convinzione precisa quando si parla delle ragioni del cuore. - "Sostiene \
Pereira", Antonio Tabucchi<br class=""><a href="http://www.jidesk.net/" \
target="_blank" class="">http://www.jidesk.net</a></div> \
_______________________________________________<br class="">PyQt mailing list \
&nbsp;&nbsp;&nbsp;<a href="mailto:PyQt@riverbankcomputing.com" \
class="">PyQt@riverbankcomputing.com</a><br class=""><a \
href="https://www.riverbankcomputing.com/mailman/listinfo/pyqt" \
class="">https://www.riverbankcomputing.com/mailman/listinfo/pyqt</a><br \
class=""></div></blockquote></div><br class=""></body></html>


[Attachment #6 (text/plain)]

_______________________________________________
PyQt mailing list    PyQt@riverbankcomputing.com
https://www.riverbankcomputing.com/mailman/listinfo/pyqt


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic