VirtualMailManager/__init__.py
branchv0.6.x
changeset 457 2019aa415dcd
parent 366 d6573da35b5f
child 568 14abdd04ddf5
equal deleted inserted replaced
456:7847f949d0a2 457:2019aa415dcd
     8     VirtualMailManager package initialization code
     8     VirtualMailManager package initialization code
     9 """
     9 """
    10 
    10 
    11 import gettext
    11 import gettext
    12 import locale
    12 import locale
       
    13 import sys
    13 
    14 
    14 from VirtualMailManager.constants import __author__, __date__, __version__
    15 from VirtualMailManager.constants import __author__, __date__, __version__
    15 
    16 
    16 __all__ = [
    17 __all__ = [
    17     # version information from VERSION
    18     # version information from VERSION
    24 # Try to set all of the locales according to the current
    25 # Try to set all of the locales according to the current
    25 # environment variables and get the character encoding.
    26 # environment variables and get the character encoding.
    26 try:
    27 try:
    27     locale.setlocale(locale.LC_ALL, '')
    28     locale.setlocale(locale.LC_ALL, '')
    28 except locale.Error:
    29 except locale.Error:
       
    30     sys.stderr.write('warning: unsupported locale setting - '
       
    31                      'that may cause encoding problems.\n\n')
    29     locale.setlocale(locale.LC_ALL, 'C')
    32     locale.setlocale(locale.LC_ALL, 'C')
    30 ENCODING = locale.nl_langinfo(locale.CODESET)
    33 ENCODING = locale.nl_langinfo(locale.CODESET)
    31 
    34 
    32 gettext.install('vmm', '/usr/local/share/locale', unicode=1)
    35 gettext.install('vmm', '/usr/local/share/locale', unicode=1)