Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

error locale.getlocale() with LANGUAGE=eu_ES #42101

Closed
zunbeltz mannequin opened this issue Jun 20, 2005 · 8 comments
Closed

error locale.getlocale() with LANGUAGE=eu_ES #42101

zunbeltz mannequin opened this issue Jun 20, 2005 · 8 comments
Assignees
Labels
stdlib Python modules in the Lib dir type-bug An unexpected behavior, bug, or error

Comments

@zunbeltz
Copy link
Mannequin

zunbeltz mannequin commented Jun 20, 2005

BPO 1223976
Nosy @malemburg, @loewis

Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

Show more details

GitHub fields:

assignee = 'https://github.com/malemburg'
closed_at = <Date 2010-08-26.17:24:36.458>
created_at = <Date 2005-06-20.08:40:04.000>
labels = ['type-bug', 'library']
title = 'error locale.getlocale() with LANGUAGE=eu_ES'
updated_at = <Date 2010-08-26.17:24:36.457>
user = 'https://bugs.python.org/zunbeltz'

bugs.python.org fields:

activity = <Date 2010-08-26.17:24:36.457>
actor = 'lemburg'
assignee = 'lemburg'
closed = True
closed_date = <Date 2010-08-26.17:24:36.458>
closer = 'lemburg'
components = ['Library (Lib)']
creation = <Date 2005-06-20.08:40:04.000>
creator = 'zunbeltz'
dependencies = []
files = []
hgrepos = []
issue_num = 1223976
keywords = []
message_count = 8.0
messages = ['60759', '60760', '60761', '60762', '60763', '60764', '114996', '115010']
nosy_count = 5.0
nosy_names = ['lemburg', 'loewis', 'zunbeltz', 'nkour', 'BreamoreBoy']
pr_nums = []
priority = 'normal'
resolution = 'fixed'
stage = 'test needed'
status = 'closed'
superseder = None
type = 'behavior'
url = 'https://bugs.python.org/issue1223976'
versions = ['Python 3.1', 'Python 2.7', 'Python 3.2']

@zunbeltz
Copy link
Mannequin Author

zunbeltz mannequin commented Jun 20, 2005

I had sumited this bug (id 1177674) and it has been
closed becouse my bad explanation.

My locale is set to LANGUAGE=eu_ES

This is what i get in the interpreter

Python 2.4.1 (#2, Mar 30 2005, 21:51:10)
[GCC 3.3.5 (Debian 1:3.3.5-8ubuntu2)] on linux2
Type "help", "copyright", "credits" or "license" for
more information.

>>> import locale
>>> locale.getlocale()
(None, None)
>>> locale.setlocale(locale.LC_ALL, '')
'eu_ES'
>>>
>>> locale.getlocale()
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
  File "/usr/lib/python2.4/locale.py", line 365, in
getlocale
    return _parse_localename(localename)
  File "/usr/lib/python2.4/locale.py", line 278, in
_parse_localename
    raise ValueError, 'unknown locale: %s' % localename
ValueError: unknown locale: eu_ES
>>>

@loewis
Copy link
Mannequin

loewis mannequin commented Jul 6, 2005

Logged In: YES
user_id=21627

What do you need locale.getlocale() for? If it is to
determine the encoding, I recommend to use
locale.getpreferredencoding() instead.

@nkour
Copy link
Mannequin

nkour mannequin commented Nov 13, 2005

Logged In: YES
user_id=865368

this bug is REAL and major IMO

any app that uses localization cannot be runned by a basque

python is not aware of eu_ES at all!

I don't know if this solves it (I'm not basque)

--- /usr/lib/python2.4/locale.py        2005-11-12
11:59:16.000000000 +0200
+++ /tmp/locale.py      2005-11-13 23:27:27.000000000 +0200
@@ -481,6 +481,7 @@
         'ar_aa':                         'ar_AA.ISO8859-6',
         'ar_sa':                         'ar_SA.ISO8859-6',
         'arabic':                        'ar_AA.ISO8859-6',
+        'basque':                        'eu_ES.ISO8859-1',
         'bg':                            'bg_BG.ISO8859-5',
         'bg_bg':                         'bg_BG.ISO8859-5',
         'bulgarian':                     'bg_BG.ISO8859-5',
@@ -540,6 +541,7 @@
         'es_ve':                         'es_VE.ISO8859-1',
         'et':                            'et_EE.ISO8859-4',
         'et_ee':                         'et_EE.ISO8859-4',
+        'eu_ES':                         'eu_ES.ISO8859-1',
         'fi':                            'fi_FI.ISO8859-1',
         'fi_fi':                         'fi_FI.ISO8859-1',
         'finnish':                       'fi_FI.ISO8859-1',

btw for this not to happen again (sad to see py242 not
fixing this) http://www.mpi-sb.mpg.de/~pesca/locales.html

Zunbeltz Izaola is a courageous man, and please loweis think
a bit more before replying why do you need that and this

@loewis
Copy link
Mannequin

loewis mannequin commented Nov 13, 2005

Logged In: YES
user_id=21627

It was a candid question: why do you need getlocale()? This
function is inherently broken, not just for basque, and
there is no way to fix it for good. So it would be best to
remove the function entirely.

Before such a step can be taken, I need to know why people
use it in the first place.

@nkour
Copy link
Mannequin

nkour mannequin commented Nov 13, 2005

Logged In: YES
user_id=865368

python itself uses this func,

I don't even ask getlocale()!

I just do:

time.strptime(tim, '%Y%m%dT%H:%M:%S')

somewhere and enjoy:

time.strptime(tim, '%Y%m%dT%H:%M:%S')
  File "/usr/lib/python2.4/_strptime.py", line 269, in ?
    _TimeRE_cache = TimeRE()
  File "/usr/lib/python2.4/_strptime.py", line 188, in __init__
    self.locale_time = LocaleTime()
  File "/usr/lib/python2.4/_strptime.py", line 73, in __init__
    self.lang = _getlang()
  File "/usr/lib/python2.4/_strptime.py", line 32, in _getlang
    return locale.getlocale(locale.LC_TIME)
  File "/usr/lib/python2.4/locale.py", line 363, in getlocale
    return _parse_localename(localename)
  File "/usr/lib/python2.4/locale.py", line 278, in
_parse_localename
    raise ValueError, 'unknown locale: %s' % localename
ValueError: unknown locale: eu_ES

so basque feels like he's ATIA here

@malemburg
Copy link
Member

Logged In: YES
user_id=38388

Not so fast, Martin. I know that you don't like the
function, but there's no reason to remove it.

Note that this bug is fixed in CVS:

I updated the locale database with the most recent X.org
data last December. It does include the eu_es mapping, but
doesn't have the basque mapping.

@devdanzin devdanzin mannequin added type-bug An unexpected behavior, bug, or error labels Mar 20, 2009
@BreamoreBoy
Copy link
Mannequin

BreamoreBoy mannequin commented Aug 26, 2010

From msg60764 "Note that this bug is fixed in CVS:". I'd test myself, but the last time I tried soemthing like this it took me ages to persuade Windows Calendar that I wasn't Dutch.

@BreamoreBoy BreamoreBoy mannequin added stdlib Python modules in the Lib dir labels Aug 26, 2010
@malemburg
Copy link
Member

Closing the report: eu_es has been Python for quite a while (at least since Python 2.5).

If you also feel that 'basque' should be added as alias, please provide proof that this alias is really in use and open a new bug report.

@malemburg malemburg self-assigned this Aug 26, 2010
@malemburg malemburg self-assigned this Aug 26, 2010
@ezio-melotti ezio-melotti transferred this issue from another repository Apr 9, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
stdlib Python modules in the Lib dir type-bug An unexpected behavior, bug, or error
Projects
None yet
Development

No branches or pull requests

1 participant