KGRKJGETMRETU895U-589TY5MIGM5JGB5SDFESFREWTGR54TY
Server : Apache/2.2.17 (Unix) mod_ssl/2.2.17 OpenSSL/0.9.8e-fips-rhel5 DAV/2 PHP/5.2.17
System : Linux localhost 2.6.18-419.el5 #1 SMP Fri Feb 24 22:47:42 UTC 2017 x86_64
User : nobody ( 99)
PHP Version : 5.2.17
Disable Function : NONE
Directory :  /proc/21573/root/usr/lib/python2.4/site-packages/dogtail/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : //proc/21573/root/usr/lib/python2.4/site-packages/dogtail/i18n.pyo
mò
,Ec@sÎdZdZdkZdkZdkZdkZdkZdklZ	d„Z
d„ZgZdfd„ƒYZ
de
fd	„ƒYZd
„Zdfd„ƒYZd
d„Zd
ed„Zed„ZdS(sO
Internationalization facilities

Authors: David Malcolm <dmalcolm@redhat.com>
sCDavid Malcolm <dmalcolm@redhat.com>, Zack Cerza <zcerza@redhat.com>N(sdebugLoggercCsSt|tƒp?y|idƒ}WqOtj
o|iddƒ}qOXn|S(Nsutf-8treplace(t
isinstancetstringtunicodetdecodetUnicodeDecodeError(R((t0/usr/lib/python2.4/site-packages/dogtail/i18n.pyt
safeDecodescCsdS(N((R((Rt
safeEncodest
TranslationDbcBstZdZd„ZRS(sE
    Abstract base class representing a database of translations
    cCs
t‚dS(sÉ
        Pure virtual method to look up the translation of a string.
        Returns a list of candidate strings (the translation), empty if not found.

        Note that a source string can map to multiple translated strings. For
        example, in the French translation of Evolution, the string "Forward" can
        translate to both
        (i) "Faire suivre" for forwarding an email, and
        (ii) "Suivant" for the next page in a wizard.
        N(tNotImplementedError(tselftsrcName((RtgetTranslationsOf+s
(t__name__t
__module__t__doc__R
(((RR	'stGettextTranslationDbcBs tZdZd„Zd„ZRS(sj
    Implementation of TranslationDb which leverages gettext, using a single
    translation mo-file.
    cCs%||_tit|ƒƒ|_dS(N(tmoFileRt_GettextTranslationDb__moFiletgettexttGNUTranslationstopent&_GettextTranslationDb__gnutranslations(RR((Rt__init__=s	cCsµt|ƒ}h}|ii|ƒ}||jod||<nxitt	|ƒƒD]U}|| d||}|ii|ƒ}||jot||i
ddƒ<qRqRW|iƒS(Nt_t(RRtresultsRRtugettexttresulttNonetrangetlentindext	candidatetTrueRtkeys(RRR!R"RR((RR
As

(RRRRR
(((RR8s	cCsŠh}x>tD]6}x-|i|ƒD]}t|ƒ}t||<q#Wq
Wt|ƒdjo&t	i	i
otid|ƒq€n|i
ƒS(s‘
    Look up srcString in the various translation databases (if any), returning
    a list of all matches found (potentially the empty list)
    isTranslation not found for "%s"N(RttranslationDbst
translationDbR
t	srcStringRRR#R tconfigtdebugTranslationtloggertlogR$(R'R&RR((Rt	translate`s
tTranslatableStringcBs)tZdZd„Zd„Zd„ZRS(s™
    Class representing a string that we want to match strings against, handling
    translation for us, by looking it up once at construction time.
    cCsHt|tƒot|ƒ}n
t|ƒ}||_t|ƒ|_dS(s‰
        Constructor looks up the string in all of the translation databases, storing
        the various translations it finds.
        N(RtuntranslatedStringRRRR,ttranslatedStrings(RR.((RRys	cCshd„}t}xF|iD];}|||ƒ}|p||j}n|o|SqqW||i|ƒS(s¥
        Compare the test string against either the translation of the original
        string (or simply the original string, if no translation was found).
        cCsŸt|ƒ}|}||jotSn|d}t|ƒ}t|ƒ}|ddjod|}ntidd|ƒ}ti	||ƒ}|dj	}|S(sº
            Compares a regular expression to a string

            inS: the regular expression (or normal string)
            outS: the normal string to be compared against
            t$it*s\s([\(\)])s\\\1N(tstrtinStinStringtoutSt	outStringR#RtretsubtmatchRtmatched(R3R5R4R6R9R:((RtstringsMatch‹s

N(R;tFalseR:RR/ttranslatedStringRR.(RRR;R=R:((Rt	matchedBy…s	
cCszt|iƒdjoUd}x%|iD]}|dt|ƒ7}q&Wdt|iƒ|f}t|ƒSnd|iSdS(sg
        Provide a meaningful debug version of the string (and the translation in
        use)
        iRu"%s", u	"%s" (%s)s"%s"N(R RR/ttranslationsttStringRR.R(RR?RR@((Rt__str__¯s
(RRRRR>RA(((RR-ss		*RcCsQtid|ƒo6|ptSqMtid||ƒotSqMtSntSdS(s¥
    Does the given filename look like a gettext mo file?

    Optionally: Does the file also contain translations for a certain language,
    for example 'ja'?
    s	(.*)\.mo$s2/usr/share/locale(.*)/%s(.*)/LC_MESSAGES/(.*)\.mo$N(R7R9tfilenametlanguageR#R<(RBRC((RtisMoFileÀs

cCs‰g}x;tii|ƒD]'}t||ƒo|i|ƒqqW|o:x7tii	|ƒD]}|it||t
ƒƒq^Wn|S(sÂ
    Look up the named package and find all gettext mo files within it and its
    dependencies. It is possible to restrict the results to those of a certain
    language, for example 'ja'.
    N(Rtdistrot	packageDbtgetFilestpackageNameRBRDRCtappendtgetDependenciestdeptextendtgetMoFilesForPackageR<(RHRCRJRKRBR((RRMÑs!cszh‰dt‡d†}tiidtidƒdd!}ttiti	ƒo|d||ƒn||||ƒdS(	s 
    Helper function which appends all of the gettext translation mo-files used by
    the package (and its dependencies) to the translation database list.
    Rcs“xŒt|||ƒD]x}d|joey!tit|ƒƒdˆ|<Wq‹t
tfj
o+}t
i
iotid|ƒq‡q‹XqqWdS(Nspopt.mos1Warning: Failed to load mo-file for translation: (RMRHRCRJRR%RIRRtmoFilestAttributeErrort
IndexErrortinstR(R)R*R+(RHRCRJRQR(RN(Rtloadìs

tLANGUAGEtLANGiislanguage-pack-gnome-%sN(RNR#RRtostenvirontgetRCRREtUbuntuRHRJ(RHRJRRRCRN((RNRt"loadTranslationsFromPackageMoFilesås#(Rt
__author__RER(RUR7RtloggingtdebugLoggerR*RRR%R	RR,R-RDR#RMRY(R,RYR%R(R	RRRZR-R7RMRR*RRURDRE((Rt?s$					
	
	(	M

Anon7 - 2021