Show
Ignore:
Timestamp:
11/12/06 17:16:49 (18 years ago)
Author:
jerome
Message:

Simplified i18n and l10n stuff by removing code used with Python<2.3 => not supported anymore.
Fixed it for working in CGI scripts as expected (better with Python 2.4 and higher).

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • pykota/trunk/pykota/cgifuncs.py

    r2622 r3055  
    2020# 
    2121 
     22import sys 
    2223import os 
    2324 
     
    2627    languages = os.environ.get("HTTP_ACCEPT_LANGUAGE", "") 
    2728    langs = [l.strip().split(';')[0] for l in languages.split(",")] 
    28     return "%s_%s" % (langs[0], langs[0].upper()) 
     29    sys.stderr.write("Languages preferences : %s\n" % langs) 
     30    return langs[0].replace("-", "_") 
    2931     
    3032def getCharsetPreference() : 
     
    3234    charsets = os.environ.get("HTTP_ACCEPT_CHARSET", "UTF-8") 
    3335    charsets = [l.strip().split(';')[0] for l in charsets.split(",")] 
     36    sys.stderr.write("Charsets preferences : %s\n" % charsets) 
    3437    return charsets[0]