"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.
From Stefan Ram@21:1/5 to All on Sun Oct 1 14:04:48 2023
"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.
|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)?