î Í+eT ã@s ddlZddlZddlZejdkrBdZdZn dZdZdd„Zdad d „Z d d „Z d d„Z dd„Zdd„Z dS)éNÚ3ÚgettextÚngettextZugettextZ ungettextcCsB|jdƒ|jdƒ}|jdƒ|jdƒ}||kS)zz helper that verifies that the message and the translated message have the same number (and type) of % args ú%z\%)Úcount)ÚmessageZ translatedZarguments_in_messageZarguments_in_translation©rú@/usr/lib/python3/dist-packages/DistUpgrade/DistUpgradeGettext.pyÚ_verify!sr cCs@tdkr<tjƒ}tj|tj|ƒddƒantS)z1Return a suitable gettext.*Translations instance.NZfallbackT)Ú_translation_singletonÚ mygettextÚ textdomainÚ translationÚbindtextdomain)Zdomainrrr Ú _translation+s   rcCst|tƒ|ƒS)N)ÚgetattrÚ_gettext_method)rrrrr Úunicode_gettext4srcCst|tƒ|||ƒS)N)rÚ_ngettext_method)rZsingularZpluralÚnrrr Úunicode_ngettext7srcCsP|dkrdSttƒ|ƒ}t||ƒsLtjd||fƒ|S|S)ze version of gettext that logs errors but does not crash on incorrect number of arguments ÚzJincorrect translation for message '%s' to '%s' (wrong number of arguments))rrr ÚloggingÚerror)rÚtranslated_msgrrr r:s cCsYttƒ|||ƒ}t||ƒsUtjd|||fƒ|dkrQ|S|S|S)zf version of ngettext that logs errors but does not crash on incorrect number of arguments z`incorrect translation for ngettext message '%s' plural: '%s' to '%s' (wrong number of arguments)é)rrr rr)Zmsgid1Zmsgid2rrrrr rGs ) rrr ÚsysÚversionrrr r rrrrrrrr Ús