B …pIpÈ*ã@s„dZddlZddlZddlZddlZddlZddlZddlmZdZ ia ddd„Z dd „Z d d „Z d d „Zdd„Zedkr€eƒdS)aGenerate 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|tjdt |¡dS)N)Úfile)ÚprintÚ__doc__ÚsysÚstderrÚexit)ÚcodeÚmsg©r ú6/opt/alt/python37/lib64/python3.7/Tools/i18n/msgfmt.pyÚusage)srcCs|s|r|t|<dS)z.Add a non-fuzzy translation to the dictionary.N)ÚMESSAGES)ÚidÚstrÚfuzzyr r r Úadd1src Cstt ¡ƒ}g}d}}xN|D]F}| t|ƒt|ƒt|ƒtt|ƒf¡||d7}|t|d7}qWd}ddt|ƒ}|t|ƒ}g}g} x4|D],\} } } } || | |g7}| | | |g7} q–W|| }t dddt|ƒddt|ƒd dd¡}|t d |¡ ¡7}||7}||7}|S) zReturn the generated output.óórééZIiiiiiilÞ*réÚi) ÚsortedrÚkeysÚappendÚlenÚstructZpackÚarrayÚtobytes)rZoffsetsZidsZstrsrÚoutputZkeystartZ valuestartZkoffsetsZvoffsetsZo1Úl1Zo2Úl2r r r Úgenerate9s6  &  r$c Csvd}d}| d¡r|}n|d}|dkrr r r ÚmainÒs(    rOÚ__main__)r)rr1rr;rIrrZ email.parserrrLrrrr$rFrOÚ__name__r r r r Ús   *o