Your IP : 216.73.216.213


Current Path : /opt/alt/python34/lib64/python3.4/Tools/i18n/__pycache__/
Upload File :
Current File : //opt/alt/python34/lib64/python3.4/Tools/i18n/__pycache__/msgfmt.cpython-34.pyc

�
e f��@s�dZddlZddlZddlZddlZddlZddlZddlmZdZ	ia
ddd�Zdd	�Zd
d�Z
dd
�Zdd�Zedkr�e�ndS)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�ntj|�dS)N�file)�print�__doc__�sys�stderr�exit)�code�msg�r�6/opt/alt/python34/lib64/python3.4/Tools/i18n/msgfmt.py�usage)srcCs|r|r|t|<ndS)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$cCs|d}d}|jd�r$|}n
|d}|dkrWtjj|�dd}nyt|d�j�}WnEtk
r�}z%t|dtj	�tj
d�WYdd}~XnXd}d}d}	d}
x(|D] }|j|	�}|
d7}
|dd	kr1||kr1t||
|�d}d}n|dd�d
kr\d|kr\d}n|dd	krrq�n|j
d�r|j
d
�r||kr�t||
|�|s�t�}|j|
j|	��j�}|r�|}	q�q�n|}|dd�}d}}
d}n4|j
d
�r�||kr`td||
fdtj	�tj
d�n|dd�}|d7}d}n�|j
d�rL|}|j
d�r|s�td||
fdtj	�tj
d�n|jdd�d}|
rI|
d7}
qIqL|r9td||
fdtj	�tj
d�n|dd�}n|j�}|sdq�ntj|�}||kr�||j|	�7}q�||kr�|
|j|	�7}
q�td||
fddtj	�t|dtj	�tj
d�q�W||krt||
|�nt�}yt|d�j|�Wn8tk
rw}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�	
 

	"		
	

	

	rEcCs3y5tjtjdd�ddddg�\}}Wn5tjk
rl}ztd|�WYdd}~XnXd}xk|D]c\}}|dkr�td�qz|dkr�tdt�tjd�qz|dkrz|}qzqzW|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