Package Gnumed :: Package pycommon :: Module gmI18N
[frames] | no frames]

Source Code for Module Gnumed.pycommon.gmI18N

  1  """GNUmed client internationalization/localization. 
  2   
  3  All i18n/l10n issues should be handled through this modules. 
  4   
  5  Theory of operation: 
  6   
  7  To activate proper locale settings and translation services you need to 
  8   
  9  - import this module 
 10  - call activate_locale() 
 11  - call install_domain() 
 12   
 13  The translating method gettext.gettext() will then be 
 14  installed into the global (!) namespace as _(). Your own 
 15  modules thus need not do _anything_ (not even import gmI18N) 
 16  to have _() available to them for translating strings. You 
 17  need to make sure, however, that gmI18N is imported in your 
 18  main module before any of the modules using it. In order to 
 19  resolve circular references involving modules that 
 20  absolutely _have_ to be imported before this module you can 
 21  explicitly import gmI18N into them at the very beginning. 
 22   
 23  The text domain (i.e. the name of the message catalog file) 
 24  is derived from the name of the main executing script unless 
 25  explicitly passed to install_domain(). The language you 
 26  want to translate to is derived from environment variables 
 27  by the locale system unless explicitly passed to 
 28  install_domain(). 
 29   
 30  This module searches for message catalog files in 3 main locations: 
 31   
 32   - standard POSIX places (/usr/share/locale/ ...) 
 33   - below "${YOURAPPNAME_DIR}/locale/" 
 34   - below "<directory of binary of your app>/../locale/" 
 35   
 36  For DOS/Windows I don't know of standard places so probably 
 37  only the last option will work. I don't know a thing about 
 38  classic Mac behaviour. New Macs are POSIX, of course. 
 39   
 40  It will then try to install candidates and *verify* whether 
 41  the translation works by checking for the translation of a 
 42  tag within itself (this is similar to the self-compiling 
 43  compiler inserting a backdoor into its self-compiled 
 44  copies). 
 45   
 46  If none of this works it will fall back to making _() a noop. 
 47   
 48  @copyright: authors 
 49  """ 
 50  #=========================================================================== 
 51  # $Id: gmI18N.py,v 1.50 2010/02/02 13:51:50 ncq Exp $ 
 52  # $Source: /cvsroot/gnumed/gnumed/gnumed/client/pycommon/gmI18N.py,v $ 
 53  __version__ = "$Revision: 1.50 $" 
 54  __author__ = "H. Herb <hherb@gnumed.net>, I. Haywood <i.haywood@ugrad.unimelb.edu.au>, K. Hilbert <Karsten.Hilbert@gmx.net>" 
 55  __license__ = "GPL (details at http://www.gnu.org)" 
 56   
 57   
 58  # stdlib 
 59  import sys, os.path, os, re as regex, locale, gettext, logging, codecs 
 60   
 61   
 62  _log = logging.getLogger('gm.i18n') 
 63  _log.info(__version__) 
 64   
 65  system_locale = '' 
 66  system_locale_level = {} 
 67   
 68   
 69  _translate_original = lambda x:x 
 70   
 71  # ********************************************************** 
 72  # == do not remove this line =============================== 
 73  # it is needed to check for successful installation of 
 74  # the desired message catalog 
 75  # ********************************************************** 
 76  __orig_tag__ = u'Translate this or i18n will not work properly !' 
 77  # ********************************************************** 
 78  # ********************************************************** 
 79   
 80  # Q: I can't use non-ascii characters in labels and menus. 
 81  # A: This can happen if your Python's sytem encoding is ascii and 
 82  #    wxPython is non-unicode. Edit/create the file sitecustomize.py 
 83  #    (should be somewhere in your PYTHONPATH), and put these magic lines: 
 84  # 
 85  #       import sys 
 86  #       sys.setdefaultencoding('iso8859-1') # replace with encoding you want to be the default one 
 87   
 88  #=========================================================================== 
89 -def __split_locale_into_levels():
90 """Split locale into language, country and variant parts. 91 92 - we have observed the following formats in the wild: 93 - de_DE@euro 94 - ec_CA.UTF-8 95 - en_US:en 96 - German_Germany.1252 97 """ 98 _log.debug('splitting canonical locale [%s] into levels', system_locale) 99 100 global system_locale_level 101 system_locale_level['full'] = system_locale 102 # trim '@<variant>' part 103 system_locale_level['country'] = regex.split('@|:|\.', system_locale, 1)[0] 104 # trim '_<COUNTRY>@<variant>' part 105 system_locale_level['language'] = system_locale.split('_', 1)[0] 106 107 _log.debug('system locale levels: %s', system_locale_level)
108 #---------------------------------------------------------------------------
109 -def __log_locale_settings(message=None):
110 _setlocale_categories = {} 111 for category in 'LC_ALL LC_CTYPE LC_COLLATE LC_TIME LC_MONETARY LC_MESSAGES LC_NUMERIC'.split(): 112 try: 113 _setlocale_categories[category] = getattr(locale, category) 114 except: 115 _log.warning('this OS does not have locale.%s', category) 116 117 _getlocale_categories = {} 118 for category in 'LC_CTYPE LC_COLLATE LC_TIME LC_MONETARY LC_MESSAGES LC_NUMERIC'.split(): 119 try: 120 _getlocale_categories[category] = getattr(locale, category) 121 except: 122 pass 123 124 if message is not None: 125 _log.debug(message) 126 127 _log.debug('current locale settings:') 128 _log.debug('locale.get_locale(): %s' % str(locale.getlocale())) 129 for category in _getlocale_categories.keys(): 130 _log.debug('locale.get_locale(%s): %s' % (category, locale.getlocale(_getlocale_categories[category]))) 131 132 for category in _setlocale_categories.keys(): 133 _log.debug('(locale.set_locale(%s): %s)' % (category, locale.setlocale(_setlocale_categories[category]))) 134 135 try: 136 _log.debug('locale.getdefaultlocale() - default (user) locale: %s' % str(locale.getdefaultlocale())) 137 except ValueError: 138 _log.exception('the OS locale setup seems faulty') 139 140 _log.debug('encoding sanity check (also check "locale.nl_langinfo(CODESET)" below):') 141 pref_loc_enc = locale.getpreferredencoding(do_setlocale=False) 142 loc_enc = locale.getlocale()[1] 143 py_str_enc = sys.getdefaultencoding() 144 sys_fs_enc = sys.getfilesystemencoding() 145 _log.debug('sys.getdefaultencoding(): [%s]' % py_str_enc) 146 _log.debug('locale.getpreferredencoding(): [%s]' % pref_loc_enc) 147 _log.debug('locale.getlocale()[1]: [%s]' % loc_enc) 148 _log.debug('sys.getfilesystemencoding(): [%s]' % sys_fs_enc) 149 if loc_enc is not None: 150 loc_enc = loc_enc.upper() 151 loc_enc_compare = loc_enc.replace(u'-', u'') 152 else: 153 loc_enc_compare = loc_enc 154 if pref_loc_enc.upper().replace(u'-', u'') != loc_enc_compare: 155 _log.warning('encoding suggested by locale (%s) does not match encoding currently set in locale (%s)' % (pref_loc_enc, loc_enc)) 156 _log.warning('this might lead to encoding errors') 157 for enc in [pref_loc_enc, loc_enc, py_str_enc, sys_fs_enc]: 158 if enc is not None: 159 try: 160 codecs.lookup(enc) 161 _log.debug('<codecs> module CAN handle encoding [%s]' % enc) 162 except LookupError: 163 _log.warning('<codecs> module can NOT handle encoding [%s]' % enc) 164 _log.debug('on Linux you can determine a likely candidate for the encoding by running "locale charmap"') 165 166 _log.debug('locale related environment variables (${LANG} is typically used):') 167 for var in 'LANGUAGE LC_ALL LC_CTYPE LANG'.split(): 168 try: 169 _log.debug('${%s}=%s' % (var, os.environ[var])) 170 except KeyError: 171 _log.debug('${%s} not set' % (var)) 172 173 _log.debug('database of locale conventions:') 174 data = locale.localeconv() 175 for key in data.keys(): 176 if loc_enc is None: 177 _log.debug(u'locale.localeconv(%s): %s', key, data[key]) 178 else: 179 try: 180 _log.debug(u'locale.localeconv(%s): %s', key, unicode(data[key])) 181 except UnicodeDecodeError: 182 _log.debug(u'locale.localeconv(%s): %s', key, unicode(data[key], loc_enc)) 183 _nl_langinfo_categories = {} 184 for category in 'CODESET D_T_FMT D_FMT T_FMT T_FMT_AMPM RADIXCHAR THOUSEP YESEXPR NOEXPR CRNCYSTR ERA ERA_D_T_FMT ERA_D_FMT ALT_DIGITS'.split(): 185 try: 186 _nl_langinfo_categories[category] = getattr(locale, category) 187 except: 188 _log.warning('this OS does not support nl_langinfo category locale.%s' % category) 189 try: 190 for category in _nl_langinfo_categories.keys(): 191 if loc_enc is None: 192 _log.debug('locale.nl_langinfo(%s): %s' % (category, locale.nl_langinfo(_nl_langinfo_categories[category]))) 193 else: 194 try: 195 _log.debug(u'locale.nl_langinfo(%s): %s', category, unicode(locale.nl_langinfo(_nl_langinfo_categories[category]))) 196 except UnicodeDecodeError: 197 _log.debug(u'locale.nl_langinfo(%s): %s', category, unicode(locale.nl_langinfo(_nl_langinfo_categories[category]), loc_enc)) 198 except: 199 _log.exception('this OS does not support nl_langinfo')
200 #---------------------------------------------------------------------------
201 -def _translate_protected(term):
202 """This wraps _(). 203 204 It protects against translation errors such as different number of %s. 205 """ 206 translation = _translate_original(term) 207 208 if translation.count(u'%s') == term.count(u'%s'): 209 return translation 210 211 _log.error('mismatch in translation of [%s]' % term) 212 return term
213 #--------------------------------------------------------------------------- 214 # external API 215 #---------------------------------------------------------------------------
216 -def activate_locale():
217 """Get system locale from environment.""" 218 global system_locale 219 220 # logging state of affairs 221 __log_locale_settings('unmodified startup locale settings (should be [C])') 222 223 # activate user-preferred locale 224 loc, enc = None, None 225 try: 226 # check whether already set 227 loc, loc_enc = locale.getlocale() 228 if loc is None: 229 loc = locale.setlocale(locale.LC_ALL, '') 230 _log.debug("activating user-default locale with <locale.setlocale(locale.LC_ALL, '')> returns: [%s]" % loc) 231 else: 232 _log.info('user-default locale already activated') 233 loc, loc_enc = locale.getlocale() 234 except AttributeError: 235 _log.exception('Windows does not support locale.LC_ALL') 236 except: 237 _log.exception('error activating user-default locale') 238 239 # logging state of affairs 240 __log_locale_settings('locale settings after activating user-default locale') 241 242 # did we find any locale setting ? assume en_EN if not 243 if loc in [None, 'C']: 244 _log.error('the current system locale is still [None] or [C], assuming [en_EN]') 245 system_locale = "en_EN" 246 else: 247 system_locale = loc 248 249 # generate system locale levels 250 __split_locale_into_levels() 251 252 return True
253 #---------------------------------------------------------------------------
254 -def install_domain(domain=None, language=None, prefer_local_catalog=False):
255 """Install a text domain suitable for the main script.""" 256 257 # text domain directly specified ? 258 if domain is None: 259 _log.info('domain not specified, deriving from script name') 260 # get text domain from name of script 261 domain = os.path.splitext(os.path.basename(sys.argv[0]))[0] 262 _log.info('text domain is [%s]' % domain) 263 264 # http://www.opengroup.org/onlinepubs/009695399/basedefs/xbd_chap08.html 265 _log.debug('searching message catalog file for system locale [%s]' % system_locale) 266 267 for env_var in ['LANGUAGE', 'LC_ALL', 'LC_MESSAGES', 'LANG']: 268 tmp = os.getenv(env_var) 269 if env_var is None: 270 _log.debug('${%s} not set' % env_var) 271 else: 272 _log.debug('${%s} = [%s]' % (env_var, tmp)) 273 274 if language is not None: 275 _log.info('explicit setting of ${LANG} requested: [%s]' % language) 276 _log.info('this will override the system locale language setting') 277 os.environ['LANG'] = language 278 279 # search for message catalog 280 candidates = [] 281 282 # - locally 283 if prefer_local_catalog: 284 _log.debug('preferring local message catalog') 285 # - one level above path to binary 286 # last resort for inferior operating systems such as DOS/Windows 287 # strip one directory level 288 # this is a rather neat trick :-) 289 loc_dir = os.path.abspath(os.path.join(os.path.dirname(sys.argv[0]), '..', 'locale')) 290 _log.debug('looking above binary install directory [%s]' % loc_dir) 291 candidates.append(loc_dir) 292 # - in path to binary 293 loc_dir = os.path.abspath(os.path.join(os.path.dirname(sys.argv[0]), 'locale' )) 294 _log.debug('looking in binary install directory [%s]' % loc_dir) 295 candidates.append(loc_dir) 296 297 # - standard places 298 if os.name == 'posix': 299 _log.debug('system is POSIX, looking in standard locations (see Python Manual)') 300 # if this is reported to segfault/fail/except on some 301 # systems we may have to assume "sys.prefix/share/locale/" 302 candidates.append(gettext.bindtextdomain(domain)) 303 else: 304 _log.debug('No use looking in standard POSIX locations - not a POSIX system.') 305 306 # - $(<script-name>_DIR)/ 307 env_key = "%s_DIR" % os.path.splitext(os.path.basename(sys.argv[0]))[0].upper() 308 _log.debug('looking at ${%s}' % env_key) 309 if os.environ.has_key(env_key): 310 loc_dir = os.path.abspath(os.path.join(os.environ[env_key], 'locale')) 311 _log.debug('${%s} = "%s" -> [%s]' % (env_key, os.environ[env_key], loc_dir)) 312 candidates.append(loc_dir) 313 else: 314 _log.info("${%s} not set" % env_key) 315 316 # - locally 317 if not prefer_local_catalog: 318 # - one level above path to binary 319 # last resort for inferior operating systems such as DOS/Windows 320 # strip one directory level 321 # this is a rather neat trick :-) 322 loc_dir = os.path.abspath(os.path.join(os.path.dirname(sys.argv[0]), '..', 'locale')) 323 _log.debug('looking above binary install directory [%s]' % loc_dir) 324 candidates.append(loc_dir) 325 # - in path to binary 326 loc_dir = os.path.abspath(os.path.join(os.path.dirname(sys.argv[0]), 'locale' )) 327 _log.debug('looking in binary install directory [%s]' % loc_dir) 328 candidates.append(loc_dir) 329 330 # now try to actually install it 331 for candidate in candidates: 332 _log.debug('trying [%s](/%s/LC_MESSAGES/%s.mo)', candidate, system_locale, domain) 333 if not os.path.exists(candidate): 334 continue 335 try: 336 gettext.install(domain, candidate, unicode=1) 337 except: 338 _log.exception('installing text domain [%s] failed from [%s]', domain, candidate) 339 continue 340 global _ 341 # does it translate ? 342 if _(__orig_tag__) == __orig_tag__: 343 _log.debug('does not translate: [%s] => [%s]', __orig_tag__, _(__orig_tag__)) 344 continue 345 else: 346 _log.debug('found msg catalog: [%s] => [%s]', __orig_tag__, _(__orig_tag__)) 347 import __builtin__ 348 global _translate_original 349 _translate_original = __builtin__._ 350 __builtin__._ = _translate_protected 351 return True 352 353 # 5) install a dummy translation class 354 _log.warning("falling back to NullTranslations() class") 355 # this shouldn't fail 356 dummy = gettext.NullTranslations() 357 dummy.install() 358 return True
359 #=========================================================================== 360 _encoding_mismatch_already_logged = False 361
362 -def get_encoding():
363 """Try to get a sane encoding. 364 365 On MaxOSX locale.setlocale(locale.LC_ALL, '') does not 366 have the desired effect, so that locale.getlocale()[1] 367 still returns None. So in that case try to fallback to 368 locale.getpreferredencoding(). 369 370 <sys.getdefaultencoding()> 371 - what Python itself uses to convert string <-> unicode 372 when no other encoding was specified 373 - ascii by default 374 - can be set in site.py and sitecustomize.py 375 <locale.getpreferredencoding()> 376 - what the current locale would *recommend* using 377 as the encoding for text conversion 378 <locale.getlocale()[1]> 379 - what the current locale is *actually* using 380 as the encoding for text conversion 381 """ 382 enc = sys.getdefaultencoding() 383 if enc != 'ascii': 384 return enc 385 enc = locale.getlocale()[1] 386 if enc is not None: 387 return enc 388 global _encoding_mismatch_already_logged 389 if not _encoding_mismatch_already_logged: 390 _log.debug('*actual* encoding of locale is None, using encoding *recommended* by locale') 391 _encoding_mismatch_already_logged = True 392 return locale.getpreferredencoding(do_setlocale=False)
393 #=========================================================================== 394 # Main 395 #--------------------------------------------------------------------------- 396 if __name__ == "__main__": 397 398 if len(sys.argv) == 1: 399 sys.exit() 400 401 if sys.argv[1] != u'test': 402 sys.exit() 403 404 logging.basicConfig(level = logging.DEBUG) 405 406 print "======================================================================" 407 print "GNUmed i18n" 408 print "" 409 print "authors:", __author__ 410 print "license:", __license__, "; version:", __version__ 411 print "======================================================================" 412 413 activate_locale() 414 print "system locale: ", system_locale, "; levels:", system_locale_level 415 print "likely encoding:", get_encoding() 416 417 if len(sys.argv) > 1: 418 install_domain(domain = sys.argv[2]) 419 else: 420 install_domain() 421 # ******************************************************** 422 # == do not remove this line ============================= 423 # it is needed to check for successful installation of 424 # the desired message catalog 425 # ******************************************************** 426 tmp = _('Translate this or i18n will not work properly !') 427 # ******************************************************** 428 # ******************************************************** 429 430 #===================================================================== 431 # $Log: gmI18N.py,v $ 432 # Revision 1.50 2010/02/02 13:51:50 ncq 433 # - improved logging and testing 434 # 435 # Revision 1.49 2010/01/31 16:37:21 ncq 436 # slightly better logging 437 # 438 # Revision 1.48 2009/12/21 15:02:17 ncq 439 # - fix typo 440 # 441 # Revision 1.47 2009/07/09 16:42:49 ncq 442 # - honor prefer_local_catalog 443 # 444 # Revision 1.46 2009/04/13 10:34:17 ncq 445 # - start preferring local catalogs when needed 446 # 447 # Revision 1.45 2009/03/10 14:19:08 ncq 448 # - protect against translation errors 449 # 450 # Revision 1.44 2008/08/01 10:46:14 ncq 451 # - add URL 452 # 453 # Revision 1.43 2008/06/11 19:11:26 ncq 454 # - slight cleanup 455 # - ignore - in encoding for comparison 456 # 457 # Revision 1.42 2008/06/09 15:28:00 ncq 458 # - better logging 459 # 460 # Revision 1.41 2008/05/13 14:08:44 ncq 461 # - get_encoding: log encoding mismatch only once 462 # 463 # Revision 1.40 2008/01/14 20:26:35 ncq 464 # - cleanup 465 # 466 # Revision 1.39 2008/01/13 01:14:48 ncq 467 # - remove *really* excessive logging 468 # 469 # Revision 1.38 2007/12/23 11:57:59 ncq 470 # - better docs 471 # - better get_encoding() 472 # 473 # Revision 1.37 2007/12/20 13:09:13 ncq 474 # - improved docs and variable naming 475 # 476 # Revision 1.36 2007/12/12 16:18:31 ncq 477 # - cleanup 478 # - need to be careful about logging locale settings since 479 # they come in the active locale ... 480 # 481 # Revision 1.35 2007/12/11 15:36:18 ncq 482 # - no more gmLog2.py importing 483 # 484 # Revision 1.34 2007/12/11 14:27:02 ncq 485 # - use std logging 486 # 487 # Revision 1.33 2007/07/10 20:34:37 ncq 488 # - in install_domain(): rename text_domain arg to domain 489 # 490 # Revision 1.32 2007/04/01 15:20:52 ncq 491 # - add get_encoding() 492 # - fix test suite 493 # 494 # Revision 1.31 2006/09/01 14:41:22 ncq 495 # - always use UNICODE gettext 496 # 497 # Revision 1.30 2006/07/10 21:44:23 ncq 498 # - slightly better logging 499 # 500 # Revision 1.29 2006/07/04 14:11:29 ncq 501 # - downgrade some errors to warnings and show them once, only 502 # 503 # Revision 1.28 2006/07/01 13:12:14 ncq 504 # - better logging 505 # 506 # Revision 1.27 2006/07/01 11:23:50 ncq 507 # - one more hint added 508 # 509 # Revision 1.26 2006/07/01 09:42:30 ncq 510 # - ever better logging and handling of encoding 511 # 512 # Revision 1.25 2006/06/30 14:15:39 ncq 513 # - remove dependancy on gmCLI 514 # - set unicode_flag, text_domain and language explicitely in install_domain() 515 # 516 # Revision 1.24 2006/06/26 21:35:57 ncq 517 # - improved logging 518 # 519 # Revision 1.23 2006/06/20 09:37:33 ncq 520 # - variable naming error 521 # 522 # Revision 1.22 2006/06/19 07:12:05 ncq 523 # - getlocale() does not support LC_ALL 524 # 525 # Revision 1.21 2006/06/19 07:06:13 ncq 526 # - arch linux cannot locale.get_locale(locale.LC_ALL) :-( 527 # 528 # Revision 1.20 2006/06/17 12:36:40 ncq 529 # - remove testing cruft 530 # 531 # Revision 1.19 2006/06/17 12:25:22 ncq 532 # - for some extremly strange reason "AttributeError" is not accepted as 533 # an exception name in "except AttributeError:" 534 # 535 # Revision 1.18 2006/06/17 11:49:26 ncq 536 # - make locale.LC_* robust against platform diffs 537 # 538 # Revision 1.17 2006/06/15 07:55:35 ncq 539 # - ever better logging of affairs 540 # 541 # Revision 1.16 2006/06/14 15:53:17 ncq 542 # - attempt setting Python string encoding if appears to not be set 543 # 544 # Revision 1.15 2006/06/13 20:34:40 ncq 545 # - now has *explicit* activate_locale() and install_domain() 546 # - much improved logging 547 # 548 # Revision 1.14 2006/06/12 21:41:46 ncq 549 # - improved locale setting logging 550 # 551 # Revision 1.13 2005/10/30 15:50:01 ncq 552 # - only try to activate user preferred locale if it does not appear 553 # to be activated yet, also catch one more exception to make failing 554 # locale stuff non-fatal 555 # 556 # Revision 1.12 2005/08/18 18:41:48 ncq 557 # - Windows does not know proper i18n 558 # 559 # Revision 1.11 2005/08/18 18:30:57 ncq 560 # - allow explicit setting of $LANG by --lang-gettext 561 # 562 # Revision 1.10 2005/08/18 18:10:52 ncq 563 # - explicitely dump l10n related env vars as Windows 564 # is dumb and needs to be debugged 565 # 566 # Revision 1.9 2005/08/06 16:26:50 ncq 567 # - read locale for messages from LC_MESSAGES, not LC_ALL 568 # 569 # Revision 1.8 2005/07/18 09:12:12 ncq 570 # - make __install_domain more robust 571 # 572 # Revision 1.7 2005/04/24 15:48:47 ncq 573 # - change unicode_flag default to 0 574 # - add comment on proper fix involving sitecustomize.py 575 # 576 # Revision 1.6 2005/03/30 22:08:57 ncq 577 # - properly handle 0/1 in --unicode-gettext 578 # 579 # Revision 1.5 2005/03/29 07:25:39 ncq 580 # - improve docs 581 # - add unicode CLI switch to toggle unicode gettext use 582 # - use std lib locale modules to get system locale 583 # 584 # Revision 1.4 2004/06/26 23:06:00 ncq 585 # - cleanup 586 # - I checked it, no matter where we import (function-/class-/method- 587 # local or globally) it will always only be done once so we can 588 # get rid of the semaphore 589 # 590 # Revision 1.3 2004/06/25 12:29:13 ncq 591 # - cleanup 592 # 593 # Revision 1.2 2004/06/25 07:11:15 ncq 594 # - make gmI18N self-aware (eg. remember installing _()) 595 # so we should be able to safely import gmI18N anywhere 596 # 597 # Revision 1.1 2004/02/25 09:30:13 ncq 598 # - moved here from python-common 599 # 600 # Revision 1.29 2003/11/17 10:56:36 sjtan 601 # 602 # synced and commiting. 603 # 604 # Revision 1.1 2003/10/23 06:02:39 sjtan 605 # 606 # manual edit areas modelled after r.terry's specs. 607 # 608 # Revision 1.28 2003/06/26 21:34:03 ncq 609 # - fatal->verbose 610 # 611 # Revision 1.27 2003/04/25 08:48:47 ncq 612 # - refactored, now also take into account different delimiters (see __split_locale*) 613 # 614 # Revision 1.26 2003/04/18 09:00:02 ncq 615 # - assume en_EN for locale if none found 616 # 617 # Revision 1.25 2003/03/24 16:52:27 ncq 618 # - calculate system locale levels at startup 619 # 620 # Revision 1.24 2003/02/05 21:27:05 ncq 621 # - more aptly names a variable 622 # 623 # Revision 1.23 2003/02/01 02:42:46 ncq 624 # - log -> _log to prevent namespace pollution on import 625 # 626 # Revision 1.22 2003/02/01 02:39:53 ncq 627 # - get and remember user's locale 628 # 629 # Revision 1.21 2002/12/09 23:39:50 ncq 630 # - only try standard message catalog locations on true POSIX systems 631 # as windows will choke on it 632 # 633 # Revision 1.20 2002/11/18 09:41:25 ncq 634 # - removed magic #! interpreter incantation line to make Debian happy 635 # 636 # Revision 1.19 2002/11/17 20:09:10 ncq 637 # - always display __doc__ when called standalone 638 # 639 # Revision 1.18 2002/09/26 13:16:52 ncq 640 # - log version 641 # 642 # Revision 1.17 2002/09/23 02:23:16 ncq 643 # - comment on why it fails on some version of Windows 644 # 645 # Revision 1.16 2002/09/22 18:38:58 ncq 646 # - added big comment on gmTimeFormat 647 # 648 # Revision 1.15 2002/09/10 07:52:29 ncq 649 # - increased log level of gmTimeFormat 650 # 651 # Revision 1.14 2002/09/08 15:57:42 ncq 652 # - added log cvs keyword 653 # 654