[Patches] [ python-Patches-1118341 ] unknown locale: lt_LT (patch)

SourceForge.net noreply at sourceforge.net
Wed Mar 16 05:16:58 CET 2005


Patches item #1118341, was opened at 2005-02-08 13:39
Message generated for change (Comment added) made by anthonybaxter
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=305470&aid=1118341&group_id=5470

Category: Library (Lib)
Group: None
Status: Open
Resolution: None
>Priority: 5
Submitted By: Nerijus Baliunas (nerijus)
Assigned to: Nobody/Anonymous (nobody)
Summary: unknown locale: lt_LT (patch)

Initial Comment:
When running wxPython app I get:
...
    from wx._core import *
  File
"/usr/lib/python2.3/site-packages/wx-2.5.4-gtk2-ansi/wx/_core.py",
line 11035, in ?
    default = locale.getdefaultlocale()[1]
  File "/usr/lib/python2.3/locale.py", line 346, in
getdefaultlocale
    return _parse_localename(localename)
  File "/usr/lib/python2.3/locale.py", line 280, in
_parse_localename
    raise ValueError, 'unknown locale: %s' % localename
ValueError: unknown locale: lt_LT

Attached patch helps.
I also changed Latvian, as ISO8859-13 is an official
standard in both Latvia and Lithuania, and Estonian, as
they use ISO8859-15 now. Also added Windows language
identifiers for all 3 languages.

It can be applied to both 2.3 and 2.4.

----------------------------------------------------------------------

>Comment By: Anthony Baxter (anthonybaxter)
Date: 2005-03-16 15:16

Message:
Logged In: YES 
user_id=29957

Please don't mess with the priority settings in the tracker.


----------------------------------------------------------------------

Comment By: Serge Orlov (sorlov)
Date: 2005-03-11 05:52

Message:
Logged In: YES 
user_id=1235914

That's strange, it works for me, as you see there is no
exception for lt_LT.iso8859-13. I've been using this "fix"
in Linux and Solaris for many years. I'm for applying this
patch to 2.3 and 2.4 but without changing charset as it's
unknown if there are users that depend on the current value. 

Python 2.3.3 (#1, Jun 30 2004, 21:13:17)
[GCC 3.3.3 (SuSE Linux)] on linux2

>>> os.environ['LANG']='lt_LT'
>>> locale.getdefaultlocale()
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
  File "/usr/lib64/python2.3/locale.py", line 346, in
getdefaultlocale
    return _parse_localename(localename)
  File "/usr/lib64/python2.3/locale.py", line 280, in
_parse_localename
    raise ValueError, 'unknown locale: %s' % localename
ValueError: unknown locale: lt_LT
>>> os.environ['LANG']='lt_LT.iso8859-13'
>>> locale.getdefaultlocale()
['lt_LT', 'iso8859-13']


----------------------------------------------------------------------

Comment By: Serge Orlov (sorlov)
Date: 2005-03-11 00:33

Message:
Logged In: YES 
user_id=1235914

That's strange, it works for me, as you see there is no
exception for lt_LT.iso8859-13. I've been using this "fix"
in Linux and Solaris for many years. I'm for applying this
patch to 2.3 and 2.4 but without changing charset as it's
unknown if there are users that depend on the current value. 

Python 2.3.3 (#1, Jun 30 2004, 21:13:17)
[GCC 3.3.3 (SuSE Linux)] on linux2

>>> os.environ['LANG']='lt_LT'
>>> locale.getdefaultlocale()
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
  File "/usr/lib64/python2.3/locale.py", line 346, in
getdefaultlocale
    return _parse_localename(localename)
  File "/usr/lib64/python2.3/locale.py", line 280, in
_parse_localename
    raise ValueError, 'unknown locale: %s' % localename
ValueError: unknown locale: lt_LT
>>> os.environ['LANG']='lt_LT.iso8859-13'
>>> locale.getdefaultlocale()
['lt_LT', 'iso8859-13']


----------------------------------------------------------------------

Comment By: Nerijus Baliunas (nerijus)
Date: 2005-03-10 10:47

Message:
Logged In: YES 
user_id=3416

$ set|grep LANG
LANG=lt_LT.ISO8859-13
My LANG is already as you suggest.

OK, I'll ask wxPython developer, as with earlier wxPython
versions I didn't have such problem. But my patch should be
safe anyway.

----------------------------------------------------------------------

Comment By: Serge Orlov (sorlov)
Date: 2005-03-10 05:31

Message:
Logged In: YES 
user_id=1235914

I don't think the values in locale_alias should be changed
in minor releases (They have been changed in 2.5 as in your
patch)  Please apply changes that only add lt_lt and lv_lv
aliases. I suspect the whole alias thing has wrong values
for many countries (not only in Python). At least it has
wrong values for Russian in Solaris and Linux for more than
ten years. I know that many Russian users have given up
relying on it. They just set charset explicitly: 
LANG=ru_RU.koi8-r or LANG=ru_RU.utf-8. Nerijus,
LANG=lt_LT.ISO8859-13 should work for you. Besides OpenDict
should catch the exception, print a warning and fall back to
C locale if the locale set by the user is not available.

The windows language identifiers are OK to add.

----------------------------------------------------------------------

Comment By: Nerijus Baliunas (nerijus)
Date: 2005-02-28 09:14

Message:
Logged In: YES 
user_id=3416

I'm increasing priority, as I have real world application
(OpenDict using wxPython) not starting w/o this patch:
$ opendict 
...
ValueError: unknown locale: lt_LT

It's really a very simple patch, please apply it to both 2.3
and 2.4.

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=305470&aid=1118341&group_id=5470


More information about the Patches mailing list