Rocksolid Light

Welcome to novaBBS (click a section below)

mail  files  register  newsreader  groups  login

Message-ID:  

"From there to here, from here to there, funny things are everywhere." -- Dr. Seuss


devel / comp.lang.python / "getdefaultlocale"

SubjectAuthor
* "getdefaultlocale"Stefan Ram
`- Re: "getdefaultlocale"Stefan Ram

1
"getdefaultlocale"

<getdefaultlocale-20231001145557@ram.dialup.fu-berlin.de>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=24089&group=comp.lang.python#24089

  copy link   Newsgroups: comp.lang.python
Path: i2pn2.org!i2pn.org!weretis.net!feeder8.news.weretis.net!fu-berlin.de!uni-berlin.de!not-for-mail
From: ram...@zedat.fu-berlin.de (Stefan Ram)
Newsgroups: comp.lang.python
Subject: "getdefaultlocale"
Date: 1 Oct 2023 14:04:48 GMT
Organization: Stefan Ram
Lines: 32
Expires: 1 Sep 2024 11:59:58 GMT
Message-ID: <getdefaultlocale-20231001145557@ram.dialup.fu-berlin.de>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-Trace: news.uni-berlin.de 0NoPiingWrCe//k5dKtIXw4S6n97uytLrinAS/peJWSBEO
Cancel-Lock: sha1:0NvBGsDNwXBTG2TCrKWDVT+07HE= sha256:ojirlpwHH9Egi1E0LVJx+1TwvqpPvTsHUuaqsJdosfE=
X-Copyright: (C) Copyright 2023 Stefan Ram. All rights reserved.
Distribution through any means other than regular usenet
channels is forbidden. It is forbidden to publish this
article in the Web, to change URIs of this article into links,
and to transfer the body without this notice, but quotations
of parts in other Usenet posts are allowed.
X-No-Archive: Yes
Archive: no
X-No-Archive-Readme: "X-No-Archive" is set, because this prevents some
services to mirror the article in the web. But the article may
be kept on a Usenet archive server with only NNTP access.
X-No-Html: yes
Content-Language: en-US
Accept-Language: de-DE-1901, en-US, it, fr-FR
 by: Stefan Ram - Sun, 1 Oct 2023 14:04 UTC

"getdefaultlocale" is deprecated. "getlocale" is suggested as
a replacement. But "getlocale" does not seem to return RFC 1766
language codes as promised in the documentation.

main.py

import locale

print( locale.getdefaultlocale() )
print( locale.getlocale() )

output

('en_US', 'cp1252')
('English_United States', '1252')

From the documentation

|locale.getlocale(category=LC_CTYPE)
| |Returns the current setting for the given locale category as
|sequence containing language code, encoding. category may be
|one of the LC_* values except LC_ALL. It defaults to LC_CTYPE.
| |Except for the code 'C', the language code corresponds to
|RFC 1766. language code and encoding may be None if their
|values cannot be determined.

How can I now convert "English_United States" into "en-US"
(and for other languages and countries too)?

Re: "getdefaultlocale"

<Windows-20231001151304@ram.dialup.fu-berlin.de>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=24090&group=comp.lang.python#24090

  copy link   Newsgroups: comp.lang.python
Path: i2pn2.org!i2pn.org!weretis.net!feeder8.news.weretis.net!fu-berlin.de!uni-berlin.de!not-for-mail
From: ram...@zedat.fu-berlin.de (Stefan Ram)
Newsgroups: comp.lang.python
Subject: Re: "getdefaultlocale"
Date: 1 Oct 2023 14:13:25 GMT
Organization: Stefan Ram
Lines: 8
Expires: 1 Sep 2024 11:59:58 GMT
Message-ID: <Windows-20231001151304@ram.dialup.fu-berlin.de>
References: <getdefaultlocale-20231001145557@ram.dialup.fu-berlin.de>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-Trace: news.uni-berlin.de TP5hEhrYVHgeCdynWkUEQAn2HnK4dDilIlfQz8aHLPDsDf
Cancel-Lock: sha1:ZVVFcMfbKiIGTcAt0ps+OlbQi3I= sha256:MWihtJuJJF5XG3eeS15vigDvq2sWZVsXEUi5VyJFwZM=
X-Copyright: (C) Copyright 2023 Stefan Ram. All rights reserved.
Distribution through any means other than regular usenet
channels is forbidden. It is forbidden to publish this
article in the Web, to change URIs of this article into links,
and to transfer the body without this notice, but quotations
of parts in other Usenet posts are allowed.
X-No-Archive: Yes
Archive: no
X-No-Archive-Readme: "X-No-Archive" is set, because this prevents some
services to mirror the article in the web. But the article may
be kept on a Usenet archive server with only NNTP access.
X-No-Html: yes
Content-Language: en-US
Accept-Language: de-DE-1901, en-US, it, fr-FR
 by: Stefan Ram - Sun, 1 Oct 2023 14:13 UTC

ram@zedat.fu-berlin.de (Stefan Ram) writes:
>"getdefaultlocale" is deprecated. "getlocale" is suggested as
>a replacement. But "getlocale" does not seem to return RFC 1766
>language codes as promised in the documentation.

on Windows

1
server_pubkey.txt

rocksolid light 0.9.81
clearnet tor