Cc@sdZddkZddkZddkZddkZddkZddkZddklZdddddd d d d d ddg Z ei i ei ddZ dZdZdZdd'dYZdefdYZddddZhZdddeddZdedddZhahadaddZddZddZdZd Z d!Z!d"Z"d#Z#d$Z$d%Z%d&Z&eZ'dS((sInternationalization and localization support. This module provides internationalization (I18N) and localization (L10N) support for your Python programs by providing an interface to the GNU gettext message catalog library. I18N refers to the operation by which a program is made aware of multiple languages. L10N refers to the adaptation of your program, once internationalized, to the local language and cultural habits. iN(tENOENTtNullTranslationstGNUTranslationstCatalogtfindt translationtinstallt textdomaintbindtextdomaintdgettextt dngettexttgettexttngettexttsharetlocalecCs|o|Sn|SdS(sy Implements the C expression: condition ? true : false Required to correctly interpret plural forms. N((t conditionttruetfalse((s gettext.pycttest=sc syddkl}Wn#tj oddkl}nXddk}ddk}|i||i}yNg}|D]6}|d|ijo|ddjo ||qxqx~}Wn|ij ot dnX|o t dn|i d d }|i d d }t i d i d|}t i dfddg}x|D]} | djo|idqd| djoPt|djo t dni |i} |dcd| 7 ss4Is>IIsBad magic numberisFile is corruptt:is s content-typescharset=s plural-formst;splural=tN(tstructtunpacktgetattrt_catalogR-treadR*tLE_MAGICtBE_MAGICtIOErrortxrangeRIt splitlineststriptsplittlowerRHRJR4RYR9(RNRORntfilenametcatalogtbuftbuflentmagictversiontmsgcountt masteridxttransidxtiiREtmlentmofftmendttlenttoffttendtmsgttmsgtlastktktitemtvR-RURVR/R((s gettext.pycRMsx     " "                  1   cCst}|ii||}||jo&|io|ii|Sn|Sn|io|i|iSn|io|i|iSn|S(N(tobjectRptgetRLR RKtencodeRJ(RNRStmissingR((s gettext.pycR Ws     cCst}|ii||}||jo&|io|ii|Sn|Sn|io|i|iSn|itiS(N( RRpRRLRTRKRRtgetpreferredencoding(RNRSRR((s gettext.pycRTes    cCsy`|i||i|f}|io|i|iSn|io|i|iSn|SWnPtj oD|io|ii|||Sn|djo|Sq|SnXdS(Ni(RpR-RKRRJtKeyErrorRLR (RNRURVRR((s gettext.pycR ps    cCsyQ|i||i|f}|io|i|iSn|itiSWnPtj oD|io|ii|||Sn|djo|Sq|SnXdS(Ni( RpR-RKRRRRRLRW(RNRURVRR((s gettext.pycRWs   cCs[t}|ii||}||jo,|io|ii|Snt|Sn|S(N(RRpRRLRXRY(RNRSRR((s gettext.pycRXs   cCsy |i||i|f}Wn`tj oT|io|ii|||Sn|djot|}qt|}nX|S(Ni(RpR-RRLRZRY(RNRURVRR((s gettext.pycRZs   ( RdReRrRsRMR RTR RWRXRZ(((s gettext.pycRs Q    ic Csf|djo t}n|djofg}x;dD]3}tii|}|o|id}Pq1q1Wd|jo|idqng}xC|D];}x2t|D]$}||jo|i|qqWqW|o g} nd} xr|D]j}|djoPntii ||dd|} tii | o |o| i| q^| SqqW| S( NtLANGUAGEtLC_ALLt LC_MESSAGEStLANGRjtCs%s.mo(sLANGUAGEsLC_ALLs LC_MESSAGESsLANG( RIt_default_localedirtostenvironRRxR)RGtpathtjointexists( tdomaint localedirt languagestalltenvarRFtnelangstlangtnelangtresulttmofile((s gettext.pycRs@          c Cs|djo t}nt|||dd}|p(|o tSnttd|nd}x|D]}tii|} t i | } | djo%t i | |t |d} nt i | } |o| i|n|djo | }qk|i| qkW|S(NRis$No translation file found for domaintrb(RIRRRRtRRRtabspatht _translationsRt setdefaulttopentcopyR^RQ( RRRtclass_RRRAtmofilesRRtkeytt((s gettext.pycRs*    %  cCs/t||dtd|}|i||dS(NRRRA(RtTrueR(RRRYRARcR((s gettext.pycRstmessagescCs|dj o |antS(N(RIt_current_domain(R((s gettext.pycRs  cCs+|dj o|t|s(((t__doc__RRRR'RmtsysterrnoRt__all__RRtprefixRRR4RGRRRIRRRfRRRRRRRRR RR RR RTR RWR(((s gettext.pycs s>&H   7 +T&