Lichen

Change of lib/locale.py

414:4ef5d5e656c0
lib/locale.py
     1.1 --- a/lib/locale.py	Thu Dec 15 23:25:10 2016 +0100
     1.2 +++ b/lib/locale.py	Thu Dec 15 23:25:48 2016 +0100
     1.3 @@ -30,6 +30,32 @@
     1.4  LC_MESSAGES = 5
     1.5  LC_ALL = 6
     1.6  
     1.7 +def getlocale(category=LC_CTYPE):
     1.8 +
     1.9 +    "Return the locale value for 'category'."
    1.10 +
    1.11 +    check_int(category)
    1.12 +    return _getlocale(category)
    1.13 +
    1.14 +def getpreferredencoding():
    1.15 +
    1.16 +    "Return the encoding from the environment's locale."
    1.17 +
    1.18 +    s = getlocale()
    1.19 +
    1.20 +    try:
    1.21 +        dot = s.index(".")
    1.22 +        return s[dot+1:]
    1.23 +    except ValueError:
    1.24 +        return None
    1.25 +
    1.26 +def initlocale(category=LC_CTYPE):
    1.27 +
    1.28 +    "Initialise the locale for 'category' from the environment."
    1.29 +
    1.30 +    check_int(category)
    1.31 +    return _setlocale(category, "")
    1.32 +
    1.33  def setlocale(category, value):
    1.34  
    1.35      "Set the locale for 'category' to 'value'."
    1.36 @@ -38,18 +64,4 @@
    1.37      check_string(value)
    1.38      return _setlocale(category, value)
    1.39  
    1.40 -def getlocale(category=LC_CTYPE):
    1.41 -
    1.42 -    "Return the locale value for 'category'."
    1.43 -
    1.44 -    check_int(category)
    1.45 -    return _getlocale(category)
    1.46 -
    1.47 -def initlocale(category=LC_CTYPE):
    1.48 -
    1.49 -    "Initialise the locale for 'category' from the environment."
    1.50 -
    1.51 -    check_int(category)
    1.52 -    return _setlocale(category, "")
    1.53 -
    1.54  # vim: tabstop=4 expandtab shiftwidth=4