-
D<c       s  d  Z  d k Z d k Z d Z e d a h  Z d   Z d   Z g  Z xl d d d d	 f D]X Z	 e i
 i e	  o? e i e i
 e	 d
  Z e e e  Z e d   e  Z Pn qY Wd e j o e i d  n e e  d Z x< e d j o. e e e e  j o e e =n e d Z q W[ d Z d   Z d   Z d   Z d f  d     YZ e a h  Z t d  Z d   Z d   Z e Z d   Z d   Z e  d j o e   n d S(   s  This module allows python programs to use GNU gettext message catalogs.

Author: James Henstridge <james@daa.com.au>
(This is loosely based on gettext.pl in the GNU gettext distribution)

The best way to use it is like so:
    import gettext
    gettext.bindtextdomain(PACKAGE, LOCALEDIR)
    gettext.textdomain(PACKAGE)
    _ = gettext.gettext
    print _('Hello World')

where PACKAGE is the domain for this package, and LOCALEDIR is usually
'$prefix/share/locale' where $prefix is the install prefix.

If you have more than one catalog to use, you can directly create catalog
objects.  These objects are created as so:
    import gettext
    cat = gettext.Catalog(PACKAGE, localedir=LOCALEDIR)
    _ = cat.gettext
    print _('Hello World')

The catalog object can also be accessed as a dictionary (ie cat['hello']).

There are also some experimental features.  You can add to the catalog, just
as you would with a normal dictionary.  When you are finished, you can call
its save method, which will create a new .mo file containing all the
translations:
    import gettext
    cat = Catalog()
    cat['Hello'] = 'konichiwa'
    cat.save('./tmp.mo')

Once you have written an internationalized program, you can create a .po file
for it with "xgettext --keyword=_ fillename ...".  Then do the translation and
compile it into a .mo file, ready for use with this module.  Note that you
will have to use C style strings (ie. use double quotes) for proper string
extraction.
Ns
   /usr/locals   /share/localec    s  t  o x d d d d g D] } y t | d  } | i   } x | o t i |  } | o | d d j oQ t i |  } t
 |  d j o t  i | d  o | d	 t  | d <n n | i   } qB WWn n Xq Wn x t  i |   o t  |  }  q W|  Sd  S(
   Ns   /usr/share/locale/locale.aliass$   /usr/local/share/locale/locale.aliass    /usr/lib/X11/locale/locale.aliass$   /usr/openwin/lib/locale/locale.aliass   ri    s   #i   i   (   s   _aliasess   files   opens   fps   readlines   lines   strings   strips   splits   ps   lens   has_keys   lang(   s   langs   fps   files   ps   line(    (    s+   /usr/lib/python2.2/site-packages/gettext.pys   _unalias_lang. s(      ( c    s  t  |   }  d d >} d d >} d d >}	 d } t i |  d  } | d j o" |  | } |  |  }  | |	 B} n d } t i |  d  } | d j o" |  | } |  |  }  | | B} n d } t i |  d  } | d j o" |  | } |  |  }  | | B} n d } |  } g  } x t | d  D]x } | | @oe | }
 | | @o |
 | }
 n | | @o |
 | }
 n | |	 @o |
 | }
 n | i d |
  n q"W| Sd  S(   Ni   i    i   s   @s    s   .s   _(   s   _unalias_langs   locales   COMPONENT_CODESETs   COMPONENT_TERRITORYs   COMPONENT_MODIFIERs   masks   strings   finds   poss   modifiers   codesets	   territorys   languages   rets   ranges   is   vals   insert(   s   locales   modifiers   languages   COMPONENT_TERRITORYs   is   masks   poss   rets   COMPONENT_CODESETs   COMPONENT_MODIFIERs   vals   codesets	   territory(    (    s+   /usr/lib/python2.2/site-packages/gettext.pys   _expand_langD sJ    








    s   LANGUAGEs   LC_ALLs   LC_MESSAGESs   LANGs   :c    s   |  | S(   N(   s   as   b(   s   as   b(    (    s+   /usr/lib/python2.2/site-packages/gettext.pys   <lambda>q s    s   Ci   i    s   gettext.errorc    sH   t  |  d  t  |  d  d >t  |  d  d >t  |  d  d >Sd  S(   Ni    i   i   i   i   i   i   (   s   ords   str(   s   str(    (    s+   /usr/lib/python2.2/site-packages/gettext.pys   _lsbStrToInt s    c    sH   t  |  d  d >t  |  d  d >t  |  d  d >t  |  d  Sd  S(   Ni    i   i   i   i   i   i   (   s   ords   str(   s   str(    (    s+   /usr/lib/python2.2/site-packages/gettext.pys   _msbStrToInt s    c    sH   t  |  d @ t  |  d ?d @ t  |  d ?d @ t  |  d ?d @ Sd  S(   Ni   i   i   i   (   s   chrs   int(   s   int(    (    s+   /usr/lib/python2.2/site-packages/gettext.pys   _intToLsbStr s    s   Catalogc      s8   e  e d  Z d   Z e Z e Z d   Z d   Z RS(   Nc    s  | |  _  | |  _ h  |  _ | o d  Sn x| t D]p |  _ |  i d j o d  Sn d | |  i | f } y# t | d  } | i   } ~ PWn t
 j
 o n Xq2 Wd  St } | | d   d j o5 t } | | d   d j o t d | f  n n | | d d ! |  _ | | d d ! }	 | | d d	 ! } | | d	 d
 ! } x t |	  D] } | | | | d ! } | | | d | d ! } | d } | | | | !}
 | | | | d ! } | | | d | d ! } | d } | | | | !} | |  i |
 <qXWd  S(   Ns   Cs   %s/%s/LC_MESSAGES/%s.mos   rbi   is   Bad magic number in %si   i   i   i   (   s   domains   selfs	   localedirs   cats   langs   catalogs   opens   fs   reads   buffers   IOErrors   _lsbStrToInts   strToInts   _msbStrToInts   errors   revisions   nstringss   origTabOffsets   transTabOffsets   ranges   is
   origLengths
   origOffsets   origStrs   transLengths   transOffsets   transStr(   s   selfs   domains	   localedirs
   origOffsets   transLengths   buffers   transTabOffsets   catalogs   transStrs   nstringss   origStrs   origTabOffsets   fs   is   strToInts   transOffsets
   origLength(    (    s+   /usr/lib/python2.2/site-packages/gettext.pys   __init__ sL    			  		 

c    s*   |  i i |  o |  i | Sn | Sd S(   s%   Get the translation of a given stringN(   s   selfs   cats   has_keys   string(   s   selfs   string(    (    s+   /usr/lib/python2.2/site-packages/gettext.pys   gettext s     c    s   | |  i | <d S(   s%   Set the translation of a given stringN(   s   transs   selfs   cats   string(   s   selfs   strings   trans(    (    s+   /usr/lib/python2.2/site-packages/gettext.pys   __setitem__ s     c    s  y t  | d  } Wn$ t j
 o t d | d  n X| i t d   | i t d   | i t t |  i	    g  }	 d } g  } d } xw |  i	 i   D]f \ } } |	 i t |  t |  f  | | d } | i t |  t |  f  | | d } q Wd } | d	 t |	  } | d	 t |  }
 |
 t |  } | i t |   | i t |   x> |	 D]6 \ } } | i t |   | i t | |
   qyWx> | D]6 \ } } | i t |   | i t | |   qW| i |  | i |  d
 S(   s'   Create a .mo file from a Catalog objects   wbs   can't open s    for writingii    s    s    i   i   N(   s   opens   files   fs   IOErrors   errors   writes   _intToLsbStrs   lens   selfs   cats   oIndexs   oDatas   tIndexs   tDatas   itemss   origs   transs   appends	   oIndexOfss	   tIndexOfss   oDataOfss   tDataOfss   lengths   offset(   s   selfs   files	   tIndexOfss   tDatas   fs	   oIndexOfss   offsets   lengths   tDataOfss   oIndexs   oDataOfss   transs   oDatas   tIndexs   orig(    (    s+   /usr/lib/python2.2/site-packages/gettext.pys   save s@        (   s   Nones	   localedirs   __init__s   gettexts   __getitem__s   __call__s   __setitem__s   save(    (    (    s+   /usr/lib/python2.2/site-packages/gettext.pys   Catalog s    /		c    sB   t  i |   o t |  |  t  |  <n t o t  |  a n d  S(   N(   s   _catss   has_keys   domains   Catalogs	   localedirs   _cat(   s   domains	   localedir(    (    s+   /usr/lib/python2.2/site-packages/gettext.pys   bindtextdomain s
      c    s3   t  i |   o t |   t  |  <n t  |  a d  S(   N(   s   _catss   has_keys   domains   Catalogs   _cat(   s   domain(    (    s+   /usr/lib/python2.2/site-packages/gettext.pys
   textdomain s     c    s+   t  t j o t d  n t  i |   Sd  S(   Ns   No catalog loaded(   s   _cats   Nones   errors   gettexts   string(   s   string(    (    s+   /usr/lib/python2.2/site-packages/gettext.pys   gettext s     c    sO   |  t j o t |  Sn t i |   o t |   n t |  i |  Sd  S(   N(   s   domains   Nones   gettexts   strings   _catss   has_keys   bindtextdomain(   s   domains   string(    (    s+   /usr/lib/python2.2/site-packages/gettext.pys   dgettexts
    c     s   d  k  }  t |  i  d d f j o$ d |  i d f GH|  i d  n |  i d } t |  i  d j o t | |  i d  n t |  t d  } | o d | t	 i
 f GH| GHn d GHd  S(	   Ni   i   s   Usage: %s DOMAIN [LOCALEDIR]i    i   s    s   Info for domain %s, lang %s.s   No info given in mo file.(   s   syss   lens   argvs   exits   domains   bindtextdomains
   textdomains   gettexts   infos   _cats   lang(   s   syss   infos   domain(    (    s+   /usr/lib/python2.2/site-packages/gettext.pys   test
s    	 
	s   __main__(!   s   __doc__s   oss   strings   prefixs	   localedirs   _aliasess   _unalias_langs   _expand_langs   langs   envs   environs   has_keys   splits   maps   reduces   appends   lens   is   errors   _lsbStrToInts   _msbStrToInts   _intToLsbStrs   Catalogs   Nones   _cats   _catss   bindtextdomains
   textdomains   gettexts   _s   dgettexts   tests   __name__(   s   strings   _intToLsbStrs   _lsbStrToInts   prefixs   _unalias_langs   _aliasess   _catss   bindtextdomains   _s   langs   _msbStrToInts   _expand_langs   is   Catalogs   gettexts
   textdomains   envs   errors   tests   oss   dgettext(    (    s+   /usr/lib/python2.2/site-packages/gettext.pys   ?' sL   
		( 	 			^				