Your IP : 216.73.216.213


Current Path : /opt/alt/python36/lib64/python3.6/Tools/i18n/__pycache__/
Upload File :
Current File : //opt/alt/python36/lib64/python3.6/Tools/i18n/__pycache__/msgfmt.cpython-36.pyc

3

� f��@s�dZddlZddlZddlZddlZddlZddlZddlmZdZ	ia
ddd�Zdd	�Zd
d�Z
dd
�Zdd�Zedkr�e�dS)a�Generate binary message catalog from textual translation description.

This program converts a textual Uniforum-style message catalog (.po file) into
a binary GNU catalog (.mo file).  This is essentially the same function as the
GNU msgfmt program, however, it is a simpler implementation.

Usage: msgfmt.py [OPTIONS] filename.po

Options:
    -o file
    --output-file=file
        Specify the output file to write to.  If omitted, output will go to a
        file named filename.mo (based off the input file name).

    -h
    --help
        Print this message and exit.

    -V
    --version
        Display version information and exit.
�N)�HeaderParserz1.1�cCs.tttjd�|r t|tjd�tj|�dS)N)�file)�print�__doc__�sys�stderr�exit)�code�msg�r�6/opt/alt/python36/lib64/python3.6/Tools/i18n/msgfmt.py�usage)srcCs|r|r|t|<dS)z.Add a non-fuzzy translation to the dictionary.N)�MESSAGES)�id�str�fuzzyrrr
�add1s
rc	Csttj��}g}d}}xN|D]F}|jt|�t|�t|�tt|�f�||d7}|t|d7}qWd}ddt|�}|t|�}g}g}	x4|D],\}
}}}
|||
|g7}|	|
||g7}	q�W||	}tjddd	t|�d
dt|�d
d	d	�}|tjd|�j�7}||7}||7}|S)zReturn the generated output.��r���ZIiiiiiil�*r��i�rr)	�sortedr�keys�append�len�structZpack�array�tobytes)rZoffsetsZidsZstrsr�outputZkeystartZ
valuestartZkoffsetsZvoffsetsZo1�l1Zo2�l2rrr
�generate9s6
&r&cCsxd}d}|jd�r|}n|d}|dkr<tjj|�dd}y"t|d��}|j�}WdQRXWn:tk
r�}zt|tj	d�tj
d�WYdd}~XnXd}d}	d}
d}�xR|D�]H}|j|
�}|d7}|dd	kr�||kr�t|
||	�d}d}	|dd�d
k�rd|k�rd}	|dd	k�r"q�|j
d��r�|j
d
��r�||k�r|t|
||	�|
�s|t�}|j|j|
��j�}|�r||}
|}|dd�}d}
}d}n�|j
d
��r�||k�r�td||ftj	d�tj
d�|dd�}|
d7}
d}n�|j
d��r~|}|j
d��rL|�s,td||ftj	d�tj
d�|jdd�d}|�r~|d7}n2|�rrtd||ftj	d�tj
d�|dd�}|j�}|�s�q�tj|�}||k�r�|
|j|
�7}
q�||k�r�||j|
�7}q�td||fdtj	d�t|tj	d�tj
d�q�W||k�rt|
||	�t�}y$t|d��}|j|�WdQRXWn2tk
�rr}zt|tj	d�WYdd}~XnXdS)N��z.porz.mo�rb)rzlatin-1�#z#,r�msgidZmsgid_plural�rFz+msgid_plural not preceded by msgid on %s:%d�rT�msgstrzmsgstr[z$plural without msgid_plural on %s:%d�]z,indexed msgstr required for plural on  %s:%d�zSyntax error on %s:%dzbefore:�wb)�endswith�os�path�splitext�open�	readlines�IOErrorrrrr	�decoder�
startswithrZparsestrZget_content_charset�split�strip�astZliteral_eval�encoder&�write)�filename�outfileZIDZSTRZinfile�f�linesrZsectionr�encodingZlno�lr+r.�p�charsetZ	is_pluralr#rrr
�makecs�














rHcCs�y&tjtjdd�ddddg�\}}Wn.tjk
rT}ztd|�WYdd}~XnXd}xL|D]D\}}|dkrztd�q`|dkr�tdt�tjd�q`|dkr`|}q`W|s�tdtjd�tdtjd�dSx|D]}t	||�q�WdS)Nr'zhVo:�help�versionzoutput-file=�-h�--helpr�-V�	--versionz	msgfmt.py�-o�
--output-filezNo input file given)rz)Try `msgfmt --help' for more information.)rKrL)rMrN)rOrP)
�getoptr�argv�errorrr�__version__r	rrH)Zopts�argsrrAZopt�argr@rrr
�main�s(


rW�__main__)r)rr3rr=rQr r!Zemail.parserrrTrrrr&rHrW�__name__rrrr
�<module>s 
*o