%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /proc/227033/root/opt/alt/python27/lib/python2.7/site-packages/babel/messages/
Upload File :
Create Path :
Current File : //proc/227033/root/opt/alt/python27/lib/python2.7/site-packages/babel/messages/mofile.pyo

�
��Qc@sidZddlZddlZddlmZmZddlmZdZdZ	d�Z
ed�ZdS(	s�
    babel.messages.mofile
    ~~~~~~~~~~~~~~~~~~~~~

    Writing of files in the ``gettext`` MO (machine object) format.

    :copyright: (c) 2013 by the Babel Team.
    :license: BSD, see LICENSE for more details.
i����N(tCatalogtMessage(t
range_typeI��I��cCs]t�}i}t|dd�}|j�}t|�}tj}|d|d �d}|tkr�|d|dd!�\}}	}
}d}nI|tkr�|d	|dd!�\}}	}
}d
}ntdd|��xnt	d|	�D]]}
||||
|
d!�\}}||}|||||d!�\}}||}||krx||krx|||!}|||!}ntdd
|��|dkr<d}}x�|j�D]�}|j�}|s�q�nd|kr|j
dd�\}}|j�j�}}|j�||<q�|r�||cd|7<q�q�Wnd|kr`|j
d�\}}nd}d|kr�|j
d�}|j
d�}|jrg|D]}|j|j�^q�}g|D]}|j|j�^q�}qn0|jr|j|j�}|j|j�}nt||d|�||<|
d7}
|d7}q�W|j�|_|S(saRead a binary MO file from the given file-like object and return a
    corresponding `Catalog` object.

    :param fileobj: the file-like object to read the MO file from

    :note: The implementation of this function is heavily based on the
           ``GNUTranslations._parse`` method of the ``gettext`` module in the
           standard library.
    tnamets<Iiis<4Iis<IIs>4Is>IIsBad magic numberisFile is corruptt:is
sttcontextN(RtgetattrtreadtlentstructtunpacktLE_MAGICtBE_MAGICtIOErrorRtNonet
splitlineststriptsplittlowertcharsettdecodeRtitemstmime_headers(tfileobjtcatalogtheaderstfilenametbuftbuflenRtmagictversiontmsgcounttorigidxttransidxtiititmlentmofftmendttlenttoffttendtmsgttmsgtlastkeytkeytitemtvaluetctxttx((sF/opt/alt/python27/lib/python2.7/site-packages/babel/messages/mofile.pytread_mosh
		"	"	 
 


	%+	
c
Cs�t|�}|s?g|dD]}|js|^q|d)n|j�d}}g}x�|D]�}|jr0djg|jD]}	|	j|j�^q�}	g}
xVt|j	�D]E\}}|s�|
j
|jtt|�d��q�|
j
|�q�Wdjg|
D]}
|
j|j�^q�}
nK|jj|j�}	|j	sf|jj|j�}
n|j	j|j�}
|j
r�dj|j
j|j�|	g�}	n|j
t|�t|	�t|�t|
�f�||	d7}||
d7}q`Wd
dt|�}|t|�}g}g}xB|D]:\}}}}||||g7}||||g7}q3W||}|jtjdtd	t|�ddt|�d
d	d	�tjd|�j�||�dS(sWrite a catalog to the specified file-like object using the GNU MO file
    format.

    >>> from babel.messages import Catalog
    >>> from gettext import GNUTranslations
    >>> from StringIO import StringIO

    >>> catalog = Catalog(locale='en_US')
    >>> catalog.add('foo', 'Voh')
    <Message ...>
    >>> catalog.add((u'bar', u'baz'), (u'Bahr', u'Batz'))
    <Message ...>
    >>> catalog.add('fuz', 'Futz', flags=['fuzzy'])
    <Message ...>
    >>> catalog.add('Fizz', '')
    <Message ...>
    >>> catalog.add(('Fuzz', 'Fuzzes'), ('', ''))
    <Message ...>
    >>> buf = StringIO()

    >>> write_mo(buf, catalog)
    >>> buf.seek(0)
    >>> translations = GNUTranslations(fp=buf)
    >>> translations.ugettext('foo')
    u'Voh'
    >>> translations.ungettext('bar', 'baz', 1)
    u'Bahr'
    >>> translations.ungettext('bar', 'baz', 2)
    u'Batz'
    >>> translations.ugettext('fuz')
    u'fuz'
    >>> translations.ugettext('Fizz')
    u'Fizz'
    >>> translations.ugettext('Fuzz')
    u'Fuzz'
    >>> translations.ugettext('Fuzzes')
    u'Fuzzes'

    :param fileobj: the file-like object to write to
    :param catalog: the `Catalog` instance
    :param use_fuzzy: whether translations marked as "fuzzy" should be included
                      in the output
    iRRsiiitIiiiiiiiiR%Niii(tlisttfuzzytsorttpluralizabletjointidtencodeRt	enumeratetstringtappendtmintintRR
twriteRtpackR
tarrayttostring(RRt	use_fuzzytmessagestmtidststrstoffsetstmessagetmsgidtmsgstrstidxR>tmsgstrtkeystartt
valuestarttkoffsetstvoffsetsto1tl1to2tl2((sF/opt/alt/python27/lib/python2.7/site-packages/babel/messages/mofile.pytwrite_moksJ,-


	+&+		1
(
t__doc__RDRtbabel.messages.catalogRRt
babel._compatRR
RR4tFalseRY(((sF/opt/alt/python27/lib/python2.7/site-packages/babel/messages/mofile.pyt<module>
s	T

Zerion Mini Shell 1.0