This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: Add support for glibc supported locales
Type: enhancement Stage: resolved
Components: Library (Lib) Versions: Python 3.4, Python 3.5, Python 2.7
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: serhiy.storchaka Nosy List: Arfrever, berker.peksag, lemburg, loewis, python-dev, serhiy.storchaka, vstinner
Priority: normal Keywords: patch

Created on 2013-12-27 10:12 by serhiy.storchaka, last changed 2022-04-11 14:57 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
locale_glibc_supported.patch serhiy.storchaka, 2013-12-27 10:12 review
Messages (18)
msg206987 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2013-12-27 10:12
Proposed patch adds to locale alias table the mappings for locales supported in recent glibc (v 2.18). It also modifies the makelocalealias.py script so that it parses the SUPPORTED file from glibc sources and supports command line options for source paths.
msg206988 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2013-12-27 10:14
Totally added 100 new mappings.
msg228058 - (view) Author: Marc-Andre Lemburg (lemburg) * (Python committer) Date: 2014-10-01 07:24
Thanks, Serhiy.

The patch looks good, except for one nit: the makelocalealias.py normaly also generates a list of changes and these are put at the top of the locale_alias dictionary.

Could you add that as well ?
msg228061 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2014-10-01 07:52
The makelocalealias.py generates only a list of removes and updates, not additions.

I recommend first apply issue20076, it will eliminate most additions.
msg228067 - (view) Author: Marc-Andre Lemburg (lemburg) * (Python committer) Date: 2014-10-01 10:11
On 01.10.2014 09:52, Serhiy Storchaka wrote:
> 
> The makelocalealias.py generates only a list of removes and updates, not additions.

Ah, ok.

> I recommend first apply issue20076, it will eliminate most additions.

Agreed. Please apply both patches.

Thanks,
-- 
Marc-Andre Lemburg
eGenix.com
msg228112 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2014-10-01 20:00
Oh, sorry, issue20076 doesn't eliminate additions in this issue, but vice verse this issue eliminates some additions of issue20076. So this patch should be applied first.
msg228117 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2014-10-01 20:51
New changeset 810542d07b4e by Serhiy Storchaka in branch 'default':
Issue #20079: Added locales supported in glibc 2.18 to locale alias table.
https://hg.python.org/cpython/rev/810542d07b4e

New changeset 00e4190b308f by Serhiy Storchaka in branch '3.4':
Issue #20079: Added locales supported in glibc 2.18 to locale alias table.
https://hg.python.org/cpython/rev/00e4190b308f

New changeset 3bc5edbbadae by Serhiy Storchaka in branch '2.7':
Issue #20079: Added locales supported in glibc 2.18 to locale alias table.
https://hg.python.org/cpython/rev/3bc5edbbadae
msg228125 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2014-10-01 21:17
Thank you for your review Marc-Andre.

See also related issue20087.
msg228178 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2014-10-02 07:53
New changeset 5502a82fb103 by Serhiy Storchaka in branch 'default':
Issue #20079: makelocalealias.py now supports installed SUPPORTED file,
https://hg.python.org/cpython/rev/5502a82fb103

New changeset 4a19ce6c6e0c by Serhiy Storchaka in branch '2.7':
Issue #20079: Updated alias mapping to glibc 2.19 SUPPORTED file.
https://hg.python.org/cpython/rev/4a19ce6c6e0c

New changeset e9aaefa3f2eb by Serhiy Storchaka in branch '3.4':
Issue #20079: Updated alias mapping to glibc 2.19 SUPPORTED file.
https://hg.python.org/cpython/rev/e9aaefa3f2eb

New changeset 994a694ab71c by Serhiy Storchaka in branch 'default':
Issue #20079: Updated alias mapping to glibc 2.19 SUPPORTED file.
https://hg.python.org/cpython/rev/994a694ab71c
msg228184 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2014-10-02 08:24
A lot of buildbot failed. Example:

http://buildbot.python.org/all/builders/AMD64%20FreeBSD%2010.0%203.x/builds/2692/steps/test/logs/stdio

======================================================================
FAIL: test_valencia_modifier (test.test_locale.NormalizeTest)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/usr/home/buildbot/python/3.x.koobs-freebsd10/build/Lib/test/test_locale.py", line 428, in test_valencia_modifier
    self.check('ca_ES@valencia', 'ca_ES.ISO8859-1@valencia')
  File "/usr/home/buildbot/python/3.x.koobs-freebsd10/build/Lib/test/test_locale.py", line 370, in check
    self.assertEqual(locale.normalize(localename), expected, msg=localename)
AssertionError: 'ca_ES.ISO8859-15@valencia' != 'ca_ES.ISO8859-1@valencia'
- ca_ES.ISO8859-15@valencia
?                -
+ ca_ES.ISO8859-1@valencia
 : ca_ES@valencia
msg228186 - (view) Author: Marc-Andre Lemburg (lemburg) * (Python committer) Date: 2014-10-02 08:38
On 02.10.2014 10:24, STINNER Victor wrote:
> 
> STINNER Victor added the comment:
> 
> A lot of buildbot failed. Example:
> 
> http://buildbot.python.org/all/builders/AMD64%20FreeBSD%2010.0%203.x/builds/2692/steps/test/logs/stdio
> 
> ======================================================================
> FAIL: test_valencia_modifier (test.test_locale.NormalizeTest)
> ----------------------------------------------------------------------
> Traceback (most recent call last):
>   File "/usr/home/buildbot/python/3.x.koobs-freebsd10/build/Lib/test/test_locale.py", line 428, in test_valencia_modifier
>     self.check('ca_ES@valencia', 'ca_ES.ISO8859-1@valencia')
>   File "/usr/home/buildbot/python/3.x.koobs-freebsd10/build/Lib/test/test_locale.py", line 370, in check
>     self.assertEqual(locale.normalize(localename), expected, msg=localename)
> AssertionError: 'ca_ES.ISO8859-15@valencia' != 'ca_ES.ISO8859-1@valencia'
> - ca_ES.ISO8859-15@valencia
> ?                -
> + ca_ES.ISO8859-1@valencia
>  : ca_ES@valencia

I guess the test have to be adjusted as well :-)

What I don't understand is why the above case failed. That mapping
wasn't changed by the patch, AFAICT.
msg228187 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2014-10-02 08:38
New changeset 7ce459fc57b9 by Serhiy Storchaka in branch '2.7':
Issue #20079: Fixed tests.
https://hg.python.org/cpython/rev/7ce459fc57b9

New changeset 8c5555dea138 by Serhiy Storchaka in branch '3.4':
Issue #20079: Fixed tests.
https://hg.python.org/cpython/rev/8c5555dea138

New changeset 433048fd4206 by Serhiy Storchaka in branch 'default':
Issue #20079: Fixed tests.
https://hg.python.org/cpython/rev/433048fd4206
msg228188 - (view) Author: Marc-Andre Lemburg (lemburg) * (Python committer) Date: 2014-10-02 08:41
On 02.10.2014 10:38, Marc-Andre Lemburg wrote:
> 
> What I don't understand is why the above case failed. That mapping
> wasn't changed by the patch, AFAICT.

Ah, the change is in the second patch round you applied, which
is not on the ticket as separate patch file.

Reviewing that, I think this change need to be documented
(in the comment above the table) and also researched a bit:

-    'kk_kz':                                'kk_KZ.ptcp154',
+    'kk_kz':                                'kk_KZ.RK1048',
msg228189 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2014-10-02 08:45
Oh, sorry. I should be more careful.

Test failed due to mismatch between glibc and X11 locale.alias (issue20087). In X11 locale.alias ca_ES is mapped to ca_ES.ISO8859-1, and in glibc 2.19 it is mapped to ca_ES.ISO8859-15. ca_ES@valencia exists only in glibc SUPPORTED file and was added in the last commit (due to mismatch with ca_ES).
msg228190 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2014-10-02 08:49
> Reviewing that, I think this change need to be documented
> (in the comment above the table) and also researched a bit:

The 'kk_kz' was added just, in the first commit of this issue (which was based on glibc 2.18 data). No changes to previous Python versions, only addition.
msg228192 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2014-10-02 09:13
> Test failed due to mismatch between glibc and X11 locale.alias (issue20087).
> In X11 locale.alias ca_ES is mapped to ca_ES.ISO8859-1, and in glibc 2.19
> it is mapped to ca_ES.ISO8859-15. ca_ES@valencia exists only in glibc
> SUPPORTED file and was added in the last commit (due to mismatch with
> ca_ES).

Hmm, no, both aliases are from glibc SUPPORTED file:

ca_ES.UTF-8 UTF-8
ca_ES ISO-8859-1
ca_ES@euro ISO-8859-15
ca_ES.UTF-8@valencia UTF-8
ca_ES@valencia ISO-8859-15
msg228194 - (view) Author: Marc-Andre Lemburg (lemburg) * (Python committer) Date: 2014-10-02 09:44
On 02.10.2014 11:13, Serhiy Storchaka wrote:
> 
> Serhiy Storchaka added the comment:
> 
>> Test failed due to mismatch between glibc and X11 locale.alias (issue20087).
>> In X11 locale.alias ca_ES is mapped to ca_ES.ISO8859-1, and in glibc 2.19
>> it is mapped to ca_ES.ISO8859-15. ca_ES@valencia exists only in glibc
>> SUPPORTED file and was added in the last commit (due to mismatch with
>> ca_ES).
> 
> Hmm, no, both aliases are from glibc SUPPORTED file:
> 
> ca_ES.UTF-8 UTF-8
> ca_ES ISO-8859-1
> ca_ES@euro ISO-8859-15
> ca_ES.UTF-8@valencia UTF-8
> ca_ES@valencia ISO-8859-15

See the comment in
https://sourceware.org/bugzilla/attachment.cgi?id=966
"The point of having
% a separate locale is only for PO translations, which have a lot of social
% support and are very appreciated by the Valencian-speaking community."

Since it's a new locale, they simply used the Latin-1 version with Euro
symbol to start with, which is a good move. Most of Europe is stuck
with having ISO-8859-1 as default, which does not include the Euro
symbol. Then again: most Unix installations use UTF-8 nowadays anyway.
msg229242 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2014-10-13 12:32
I think there is nothing more to do here and the issue can be closed.
History
Date User Action Args
2022-04-11 14:57:55adminsetgithub: 64278
2014-10-19 21:06:13serhiy.storchakasetstatus: open -> closed
resolution: fixed
2014-10-13 12:32:44serhiy.storchakasetmessages: + msg229242
2014-10-02 09:44:40lemburgsetmessages: + msg228194
2014-10-02 09:13:04serhiy.storchakasetmessages: + msg228192
2014-10-02 08:49:41serhiy.storchakasetmessages: + msg228190
2014-10-02 08:45:26serhiy.storchakasetmessages: + msg228189
2014-10-02 08:41:50lemburgsetmessages: + msg228188
2014-10-02 08:38:52python-devsetmessages: + msg228187
2014-10-02 08:38:00lemburgsetmessages: + msg228186
2014-10-02 08:24:35vstinnersetstatus: closed -> open

nosy: + vstinner
messages: + msg228184

resolution: fixed -> (no value)
2014-10-02 07:53:00python-devsetmessages: + msg228178
2014-10-01 21:18:07serhiy.storchakasetstatus: open -> closed
resolution: fixed
stage: patch review -> resolved
2014-10-01 21:17:44serhiy.storchakasetmessages: + msg228125
2014-10-01 20:51:15python-devsetnosy: + python-dev
messages: + msg228117
2014-10-01 20:00:47serhiy.storchakasetassignee: serhiy.storchaka
messages: + msg228112
2014-10-01 10:11:47lemburgsetmessages: + msg228067
2014-10-01 07:52:03serhiy.storchakasetmessages: + msg228061
2014-10-01 07:24:50lemburgsetmessages: + msg228058
2014-09-30 15:45:48serhiy.storchakasetversions: + Python 3.5, - Python 3.3
2014-09-30 15:42:29serhiy.storchakalinkissue16555 superseder
2013-12-29 08:03:10berker.peksagsetnosy: + berker.peksag
2013-12-28 21:13:21Arfreversetnosy: + Arfrever
2013-12-27 10:14:05serhiy.storchakasetmessages: + msg206988
2013-12-27 10:12:27serhiy.storchakacreate