Your IP : 216.73.216.213


Current Path : /opt/alt/python35/lib64/python3.5/Tools/i18n/__pycache__/
Upload File :
Current File : //opt/alt/python35/lib64/python3.5/Tools/i18n/__pycache__/msgfmt.cpython-35.opt-1.pyc



��Yf��@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=ttdtj�|r,t|dtj�tj|�dS)N�file)�print�__doc__�sys�stderr�exit)�code�msg�r�6/opt/alt/python35/lib64/python3.5/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	Csyttj��}g}d}}xc|D][}|jt|�t|�t|�tt|�f�||d7}|t|d7}q)Wd}ddt|�}|t|�}g}g}	xB|D]:\}
}}}
|||
|g7}|	|
||g7}	q�W||	}tjddd	t|�d
dt|�d
d	d	�}|tjd|�j�7}||7}||7}|S)zReturn the generated output.�sr���ZIiiiiiil�*r��i�rr)	�sortedr�keys�append�len�structZpack�arrayZtostring)rZoffsetsZidsZstrsr�outputZkeystartZ
valuestartZkoffsetsZvoffsetsZo1�l1Zo2�l2rrr
�generate9s6

5
		

r$cCsRd}d}|jd�r$|}n
|d}|dkrTtjj|�dd}yt|d�j�}WnEtk
r�}z%t|dtj	�tj
d�WYdd}~XnXd}d}d}	d}
x|D]�}|j|	�}|
d7}
|dd	kr+||kr+t||
|�d}d}|dd�d
krSd|krSd}|dd	krfq�|j
d�r|j
d
�r||kr�t||
|�|s�t�}|j|
j|	��j�}|r�|}	|}|dd�}d}}
d}n%|j
d
�rk||krHtd||
fdtj	�tj
d�|dd�}|d7}d}n�|j
d�r(|}|j
d�r�|s�td||
fdtj	�tj
d�|jdd�d}|
r(|
d7}
n@|rtd||
fdtj	�tj
d�|dd�}|j�}|s=q�tj|�}||krn||j|	�7}q�||kr�|
|j|	�7}
q�td||
fddtj	�t|dtj	�tj
d�q�W||kr�t||
|�t�}yt|d�j|�Wn8tk
rM}zt|dtj	�WYdd}~XnXdS)N��z.porz.mo�rbrzlatin-1�#z#,r�msgidZmsgid_plural�rFz+msgid_plural not preceded by msgid on %s:%d�sT�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�linesrZsectionr�encodingZlno�lr)r,�p�charsetZ	is_pluralr!rrr
�makecs�	
 

"	
	


	




	rEcCs0y5tjtjdd�ddddg�\}}Wn5tjk
rl}ztd|�WYdd}~XnXd}xh|D]`\}}|dkr�td�qz|dkr�tdt�tjd�qz|dkrz|}qzW|stddtj�tddtj�dSx|D]}t	||�qWdS)Nr%zhVo:�help�versionzoutput-file=�-h�--helpr�-V�	--versionz	msgfmt.py�-o�
--output-filezNo input file givenrz)Try `msgfmt --help' for more information.)rHrI)rJrK)rLrM)
�getoptr�argv�errorrr�__version__r	rrE)Zopts�argsrr?Zopt�argr>rrr
�main�s( 



rT�__main__)rr1rr;rNrr Zemail.parserrrQrrrr$rErT�__name__rrrr
�<module>s *m