Python Forum

Full Version: What are the possible values for LC_COLLATE ?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hi

To collate ancien greek words, I tried, without any success, to set LC_COLLATE.
Here is an exemple of my tries
>>> import locale
>>> for l in ('en_US', 'de_DE', 'fr_FR', 'el_GR', 'gr_GR'):
...     try:
...             locale.setlocale(locale.LC_COLLATE, '.'.join([l, 'UTF-8']))
...     except:
...             print("«"+'.'.join([l, 'UTF-8']) + "» n'est pas une valeur reconnue")
... 
'en_US.UTF-8'
«de_DE.UTF-8» n'est pas une valeur reconnue
'fr_FR.UTF-8'
«el_GR.UTF-8» n'est pas une valeur reconnue
«gr_GR.UTF-8» n'est pas une valeur reconnue
It is reasonable to assume that «de_DE.UTF-8», «el_GR.UTF-8», «gr_GR.UTF-8» are unknown in my Ubuntu system, and that this question is not quite related to Python. But, hopefully, one of you may advice me on how to create this collating sequences. The one I'm really looking for is «el_GR.UTF-8», as I believe «gr_GR.UTF-8» refers to modern greek.

Arbiel
LC_COLLATE is string sort order
documentation from interactive python:
>>> import sys
>>> sys.stdout = open('locale_LC_COLLATE.txt', 'w')
>>> import locale
>>> help(locale.LC_COLLATE)
>>> quit()
yields:
see attachment:
[attachment=839]
Hi Larz60+

Thank you for your help.

Unfortunately neither the attachment nor your script gives any information on LC_COLLATE, but on the contrary on the int objects.

However, your script shows how to redirect output from the console to a file.

Arbiel