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KO}ӽmSşذqsOy?\[,d@'73'j%kOe`1.g2"e =YIzS2|zŐƄa\U,dP;jhhhaxǶ?КZ՚.q SE+XrbOu%\GتX(H,N^~]JyEZQKceTQ]VGYqnah;y$cQahT&QPZ*iZ8UQQM.qo/T\7X"u?Mttl2Xq(IoW{R^ ux*SYJ! 4S.Jy~ BROS[V|žKNɛP(L6V^|cR7i7nZW1Fd@ Ara{詑|(T*dN]Ko?s=@ |_EvF]׍kR)eBJc" MUUbY6`~V޴dJKß&~'d3i WWWWWW
Current Directory: /usr/lib/python2.7/site-packages/kitchen/i18n
Viewing File: /usr/lib/python2.7/site-packages/kitchen/i18n/__init__.pyc
� i�:Oc@svdZddlmZdddffZee�ZddlZddlmZddlZddl Z ddl Z ddl Z ddl Z yddlm ZWn,ek r�e jje jdd �ZnXdd lmZmZdd lmZiZd eejfd ��YZdeejfd��YZe�eee ed�Z!e�e d�Z"d dddfZ#dS(s� :term:`I18N` is an important piece of any modern program. Unfortunately, setting up :term:`i18n` in your program is often a confusing process. The functions provided here aim to make the programming side of that a little easier. Most projects will be able to do something like this when they startup:: # myprogram/__init__.py: import os import sys from kitchen.i18n import easy_gettext_setup _, N_ = easy_gettext_setup('myprogram', localedirs=( os.path.join(os.path.realpath(os.path.dirname(__file__)), 'locale'), os.path.join(sys.prefix, 'lib', 'locale') )) Then, in other files that have strings that need translating:: # myprogram/commands.py: from myprogram import _, N_ def print_usage(): print _(u"""available commands are: --help Display help --version Display version of this program --bake-me-a-cake as fast as you can """) def print_invitations(age): print _('Please come to my party.') print N_('I will be turning %(age)s year old', 'I will be turning %(age)s years old', age) % {'age': age} See the documentation of :func:`easy_gettext_setup` and :func:`get_translation_object` for more details. .. seealso:: :mod:`gettext` for details of how the python gettext facilities work `babel <http://babel.edgewall.org>`_ The babel module for in depth information on gettext, :term:`message catalogs`, and translating your app. babel provides some nice features for :term:`i18n` on top of :mod:`gettext` i����(tversion_tuple_to_stringiiN(tENOENT(t_default_localedirtsharetlocale(tto_bytest to_unicode(tbyte_string_valid_encodingtDummyTranslationscBs�eZdZdd�Zd�Zd�Zeee�Zd�Z e e j d�s`d�Z nd�Zd�Z d �Zd �Zd �Zd �Zd �ZRS(s�Safer version of :class:`gettext.NullTranslations` This Translations class doesn't translate the strings and is intended to be used as a fallback when there were errors setting up a real Translations object. It's safer than :class:`gettext.NullTranslations` in its handling of byte :class:`str` vs :class:`unicode` strings. Unlike :class:`~gettext.NullTranslations`, this Translation class will never throw a :exc:`~exceptions.UnicodeError`. The code that you have around a call to :class:`DummyTranslations` might throw a :exc:`~exceptions.UnicodeError` but at least that will be in code you control and can fix. Also, unlike :class:`~gettext.NullTranslations` all of this Translation object's methods guarantee to return byte :class:`str` except for :meth:`ugettext` and :meth:`ungettext` which guarantee to return :class:`unicode` strings. When byte :class:`str` are returned, the strings will be encoded according to this algorithm: 1) If a fallback has been added, the fallback will be called first. You'll need to consult the fallback to see whether it performs any encoding changes. 2) If a byte :class:`str` was given, the same byte :class:`str` will be returned. 3) If a :class:`unicode` string was given and :meth:`set_output_charset` has been called then we encode the string using the :attr:`output_charset` 4) If a :class:`unicode` string was given and this is :meth:`gettext` or :meth:`ngettext` and :attr:`_charset` was set output in that charset. 5) If a :class:`unicode` string was given and this is :meth:`gettext` or :meth:`ngettext` we encode it using 'utf-8'. 6) If a :class:`unicode` string was given and this is :meth:`lgettext` or :meth:`lngettext` we encode using the value of :func:`locale.getpreferredencoding` For :meth:`ugettext` and :meth:`ungettext`, we go through the same set of steps with the following differences: * We transform byte :class:`str` into :class:`unicode` strings for these methods. * The encoding used to decode the byte :class:`str` is taken from :attr:`input_charset` if it's set, otherwise we decode using :term:`UTF-8`. .. attribute:: input_charset is an extension to the |stdlib|_ :mod:`gettext` that specifies what charset a message is encoded in when decoding a message to :class:`unicode`. This is used for two purposes: 1) If the message string is a byte :class:`str`, this is used to decode the string to a :class:`unicode` string before looking it up in the :term:`message catalog`. 2) In :meth:`~kitchen.i18n.DummyTranslations.ugettext` and :meth:`~kitchen.i18n.DummyTranslations.ungettext` methods, if a byte :class:`str` is given as the message and is untranslated this is used as the encoding when decoding to :class:`unicode`. This is different from :attr:`_charset` which may be set when a :term:`message catalog` is loaded because :attr:`input_charset` is used to describe an encoding used in a python source file while :attr:`_charset` describes the encoding used in the :term:`message catalog` file. Any characters that aren't able to be transformed from a byte :class:`str` to :class:`unicode` string or vice versa will be replaced with a replacement character (ie: ``u'�'`` in unicode based encodings, ``'?'`` in other :term:`ASCII` compatible encodings). .. seealso:: :class:`gettext.NullTranslations` For information about what methods are available and what they do. .. versionchanged:: kitchen-1.1.0 ; API kitchen.i18n 2.1.0 * Although we had adapted :meth:`gettext`, :meth:`ngettext`, :meth:`lgettext`, and :meth:`lngettext` to always return byte :class:`str`, we hadn't forced those byte :class:`str` to always be in a specified charset. We now make sure that :meth:`gettext` and :meth:`ngettext` return byte :class:`str` encoded using :attr:`output_charset` if set, otherwise :attr:`charset` and if neither of those, :term:`UTF-8`. With :meth:`lgettext` and :meth:`lngettext` :attr:`output_charset` if set, otherwise :func:`locale.getpreferredencoding`. * Make setting :attr:`input_charset` and :attr:`output_charset` also set those attributes on any fallback translation objects. cCs;tjj||�t|d�s.d|_nd|_dS(Nt_output_charsetsutf-8(tgettexttNullTranslationst__init__thasattrtNoneR t_input_charset(tselftfp((s9/usr/lib/python2.7/site-packages/kitchen/i18n/__init__.pyR �s cCs=|jr0y||j_Wq0tk r,q0Xn||_dS(N(t _fallbackt input_charsettAttributeErrorR(Rtcharset((s9/usr/lib/python2.7/site-packages/kitchen/i18n/__init__.pyt_set_input_charset�s   cCs|jS(N(R(R((s9/usr/lib/python2.7/site-packages/kitchen/i18n/__init__.pyt_get_input_charset�scCsl|jr4y|jj|�Wq4tk r0q4Xnytjj||�Wntk rg||_nXdS(sSet the output charset This serves two purposes. The normal :meth:`gettext.NullTranslations.set_output_charset` does not set the output on fallback objects. On python-2.3, :class:`gettext.NullTranslations` objects don't contain this method. N(Rtset_output_charsetRR R R (RR((s9/usr/lib/python2.7/site-packages/kitchen/i18n/__init__.pyR�s   toutput_charsetcCs|jS(s=Compatibility for python2.3 which doesn't have output_charset(R (R((s9/usr/lib/python2.7/site-packages/kitchen/i18n/__init__.pyR�scCs�t}d}yt||�}Wntk r2nX|r=|Syt|d|jdd�}Wntk rpdSXt|d|�S(s�Return a byte string that's valid in a specific charset. .. warning:: This method may mangle the message if the inpput encoding is not known or the message isn't represntable in the chosen output encoding. tencodingt nonstringtstricttN(tFalseRRt TypeErrorRRR(Rtmessagetoutput_encodingtvalidtmsg((s9/usr/lib/python2.7/site-packages/kitchen/i18n/__init__.pyt_reencode_if_necessary�s   cCsg|jr<y|jj|�}Wq<ttfk r8q<Xn|jpT|jpT|j}|j||�S(N(RR Rt UnicodeErrorR t_charsetRR$(RR R!((s9/usr/lib/python2.7/site-packages/kitchen/i18n/__init__.pyR s  cCs�|dkr|}n|}|jr]y|jj|||�}Wq]ttfk rYq]Xn|jpu|jpu|j}|j||�S(Ni(RtngettextRR%R R&RR$(Rtmsgid1tmsgid2tnR R!((s9/usr/lib/python2.7/site-packages/kitchen/i18n/__init__.pyR''s    cCsa|jr<y|jj|�}Wq<ttfk r8q<Xn|jpNtj�}|j||�S(N(RtlgettextRR%R RtgetpreferredencodingR$(RR R!((s9/usr/lib/python2.7/site-packages/kitchen/i18n/__init__.pyR+<s   cCs�|dkr|}n|}|jr]y|jj|||�}Wq]ttfk rYq]Xn|jpotj�}|j||�S(Ni(Rt lngettextRR%R RR,R$(RR(R)R*R R!((s9/usr/lib/python2.7/site-packages/kitchen/i18n/__init__.pyR-Ls     cCswt|t�sdS|jrdt|d|j�}y|jj|�}Wqdttfk r`qdXnt|d|j�S(NuR(t isinstancet basestringRRRtugettextRR%(RR R#((s9/usr/lib/python2.7/site-packages/kitchen/i18n/__init__.pyR0bs cCs�|dkr|}n|}|jr�t|d|j�}t|d|j�}y|jj|||�}Wq�ttfk r�q�Xnt|d|jdd�S(NiRRtempty(RRRt ungettextRR%(RR(R)R*R ((s9/usr/lib/python2.7/site-packages/kitchen/i18n/__init__.pyR2ps   N(t__name__t __module__t__doc__RR RRtpropertyRRR R R RR$R'R+R-R0R2(((s9/usr/lib/python2.7/site-packages/kitchen/i18n/__init__.pyRusU          tNewGNUTranslationscBsMeZdZd�Zd�Zd�Zd�Zd�Zd�Zd�Z RS(shSafer version of :class:`gettext.GNUTranslations` :class:`gettext.GNUTranslations` suffers from two problems that this class fixes. 1) :class:`gettext.GNUTranslations` can throw a :exc:`~exceptions.UnicodeError` in :meth:`gettext.GNUTranslations.ugettext` if the message being translated has non-:term:`ASCII` characters and there is no translation for it. 2) :class:`gettext.GNUTranslations` can return byte :class:`str` from :meth:`gettext.GNUTranslations.ugettext` and :class:`unicode` strings from the other :meth:`~gettext.GNUTranslations.gettext` methods if the message being translated is the wrong type When byte :class:`str` are returned, the strings will be encoded according to this algorithm: 1) If a fallback has been added, the fallback will be called first. You'll need to consult the fallback to see whether it performs any encoding changes. 2) If a byte :class:`str` was given, the same byte :class:`str` will be returned. 3) If a :class:`unicode` string was given and :meth:`set_output_charset` has been called then we encode the string using the :attr:`output_charset` 4) If a :class:`unicode` string was given and this is :meth:`gettext` or :meth:`ngettext` and a charset was detected when parsing the :term:`message catalog`, output in that charset. 5) If a :class:`unicode` string was given and this is :meth:`gettext` or :meth:`ngettext` we encode it using :term:`UTF-8`. 6) If a :class:`unicode` string was given and this is :meth:`lgettext` or :meth:`lngettext` we encode using the value of :func:`locale.getpreferredencoding` For :meth:`ugettext` and :meth:`ungettext`, we go through the same set of steps with the following differences: * We transform byte :class:`str` into :class:`unicode` strings for these methods. * The encoding used to decode the byte :class:`str` is taken from :attr:`input_charset` if it's set, otherwise we decode using :term:`UTF-8` .. attribute:: input_charset an extension to the |stdlib|_ :mod:`gettext` that specifies what charset a message is encoded in when decoding a message to :class:`unicode`. This is used for two purposes: 1) If the message string is a byte :class:`str`, this is used to decode the string to a :class:`unicode` string before looking it up in the :term:`message catalog`. 2) In :meth:`~kitchen.i18n.DummyTranslations.ugettext` and :meth:`~kitchen.i18n.DummyTranslations.ungettext` methods, if a byte :class:`str` is given as the message and is untranslated his is used as the encoding when decoding to :class:`unicode`. This is different from the :attr:`_charset` parameter that may be set when a :term:`message catalog` is loaded because :attr:`input_charset` is used to describe an encoding used in a python source file while :attr:`_charset` describes the encoding used in the :term:`message catalog` file. Any characters that aren't able to be transformed from a byte :class:`str` to :class:`unicode` string or vice versa will be replaced with a replacement character (ie: ``u'�'`` in unicode based encodings, ``'?'`` in other :term:`ASCII` compatible encodings). .. seealso:: :class:`gettext.GNUTranslations.gettext` For information about what methods this class has and what they do .. versionchanged:: kitchen-1.1.0 ; API kitchen.i18n 2.1.0 Although we had adapted :meth:`gettext`, :meth:`ngettext`, :meth:`lgettext`, and :meth:`lngettext` to always return byte :class:`str`, we hadn't forced those byte :class:`str` to always be in a specified charset. We now make sure that :meth:`gettext` and :meth:`ngettext` return byte :class:`str` encoded using :attr:`output_charset` if set, otherwise :attr:`charset` and if neither of those, :term:`UTF-8`. With :meth:`lgettext` and :meth:`lngettext` :attr:`output_charset` if set, otherwise :func:`locale.getpreferredencoding`. cCstjj||�dS(N(R tGNUTranslationst_parse(RR((s9/usr/lib/python2.7/site-packages/kitchen/i18n/__init__.pyR9�scCs�t|t�sdS|}t|d|j�}y|j|}WnMtk r�|jr�y|jj|�}Wq�tt fk r�q�Xq�nX|j p�|j p�|j}|j ||�S(NRR( R.R/RRt_catalogtKeyErrorRR RR%R R&R$(RR ttmsgt u_messageR!((s9/usr/lib/python2.7/site-packages/kitchen/i18n/__init__.pyR �s    cCs�|dkr|}n|}t|t�s.dSt|d|j�}y |j||j|�f}WnStk r�|jr�y|jj|||�}Wq�t t fk r�q�Xq�nX|j p�|j p�|j}|j ||�S(NiRR(R.R/RRR:tpluralR;RR'RR%R R&R$(RR(R)R*R<tu_msgid1R!((s9/usr/lib/python2.7/site-packages/kitchen/i18n/__init__.pyR'�s"       cCs�t|t�sdS|}t|d|j�}y|j|}WnMtk r�|jr�y|jj|�}Wq�tt fk r�q�Xq�nX|j p�t j �}|j ||�S(NRR(R.R/RRR:R;RR+RR%R RR,R$(RR R<R=R!((s9/usr/lib/python2.7/site-packages/kitchen/i18n/__init__.pyR+ s     cCs�|dkr|}n|}t|t�s.dSt|d|j�}y |j||j|�f}WnStk r�|jr�y|jj|||�}Wq�t t fk r�q�Xq�nX|j p�t j �}|j||�S(NiRR(R.R/RRR:R>R;RR'RR%R RR,R$(RR(R)R*R<R?R!((s9/usr/lib/python2.7/site-packages/kitchen/i18n/__init__.pyR-!s"        cCs�t|t�sdSt|d|j�}y|j|}WnMtk r�|jr�y|jj|�}Wq�tt fk r�q�Xq�nXt|d|j�S(NuR( R.R/RRR:R;RR0RR%(RR ((s9/usr/lib/python2.7/site-packages/kitchen/i18n/__init__.pyR0<s   cCs�|dkr|}n|}t|t�s.dSt|d|j�}y |j||j|�f}WnStk r�|jr�y|jj|||�}Wq�t t fk r�q�Xq�nXt|d|jdd�S(NiuRRR1( R.R/RRR:R>R;RR2RR%(RR(R)R*R<R?((s9/usr/lib/python2.7/site-packages/kitchen/i18n/__init__.pyR2Ms       ( R3R4R5R9R R'R+R-R0R2(((s9/usr/lib/python2.7/site-packages/kitchen/i18n/__init__.pyR7�sS      c Cs>|st}ng}x?tj|tf�D](}|jtj|||dd��q+W|s|rjt�Stt d|��nd}x�|D]�} t j j | �} tj| �} | s�t| d�} ztj| || ��} Wd| j�Xntj| �} |r| j|�n|s)| }q�|j| �q�W|S(s�Get a translation object bound to the :term:`message catalogs` :arg domain: Name of the message domain. This should be a unique name that can be used to lookup the :term:`message catalog` for this app or library. :kwarg localedirs: Iterator of directories to look for :term:`message catalogs` under. The directories are searched in order for :term:`message catalogs`. For each of the directories searched, we check for message catalogs in any language specified in:attr:`languages`. The :term:`message catalogs` are used to create the Translation object that we return. The Translation object will attempt to lookup the msgid in the first catalog that we found. If it's not in there, it will go through each subsequent catalog looking for a match. For this reason, the order in which you specify the :attr:`localedirs` may be important. If no :term:`message catalogs` are found, either return a :class:`DummyTranslations` object or raise an :exc:`IOError` depending on the value of :attr:`fallback`. Rhe default localedir from :mod:`gettext` which is :file:`os.path.join(sys.prefix, 'share', 'locale')` on Unix is implicitly appended to the :attr:`localedirs`, making it the last directory searched. :kwarg languages: Iterator of language codes to check for :term:`message catalogs`. If unspecified, the user's locale settings will be used. .. seealso:: :func:`gettext.find` for information on what environment variables are used. :kwarg class_: The class to use to extract translations from the :term:`message catalogs`. Defaults to :class:`NewGNUTranslations`. :kwarg fallback: If set to data:`False`, raise an :exc:`IOError` if no :term:`message catalogs` are found. If :data:`True`, the default, return a :class:`DummyTranslations` object. :kwarg codeset: Set the character encoding to use when returning byte :class:`str` objects. This is equivalent to calling :meth:`~gettext.GNUTranslations.output_charset` on the Translations object that is returned from this function. :return: Translation object to get :mod:`gettext` methods from If you need more flexibility than :func:`easy_gettext_setup`, use this function. It sets up a :mod:`gettext` Translation object and returns it to you. Then you can access any of the methods of the object that you need directly. For instance, if you specifically need to access :func:`~gettext.GNUTranslations.lgettext`:: translations = get_translation_object('foo') translations.lgettext('My Message') This function is similar to the |stdlib|_ :func:`gettext.translation` but makes it better in two ways 1. It returns :class:`NewGNUTranslations` or :class:`DummyTranslations` objects by default. These are superior to the :class:`gettext.GNUTranslations` and :class:`gettext.NullTranslations` objects because they are consistent in the string type they return and they fix several issues that can causethe |stdlib|_ objects to throw :exc:`UnicodeError`. 2. This function takes multiple directories to search for :term:`message catalogs`. The latter is important when setting up :mod:`gettext` in a portable manner. There is not a common directory for translations across operating systems so one needs to look in multiple directories for the translations. :func:`get_translation_object` is able to handle that if you give it a list of directories to search for catalogs:: translations = get_translation_object('foo', localedirs=( os.path.join(os.path.realpath(os.path.dirname(__file__)), 'locale'), os.path.join(sys.prefix, 'lib', 'locale'))) This will search for several different directories: 1. A directory named :file:`locale` in the same directory as the module that called :func:`get_translation_object`, 2. In :file:`/usr/lib/locale` 3. In :file:`/usr/share/locale` (the fallback directory) This allows :mod:`gettext` to work on Windows and in development (where the :term:`message catalogs` are typically in the toplevel module directory) and also when installed under Linux (where the :term:`message catalogs` are installed in :file:`/usr/share/locale`). You (or the system packager) just need to install the :term:`message catalogs` in :file:`/usr/share/locale` and remove the :file:`locale` directory from the module to make this work. ie:: In development: ~/foo # Toplevel module directory ~/foo/__init__.py ~/foo/locale # With message catalogs below here: ~/foo/locale/es/LC_MESSAGES/foo.mo Installed on Linux: /usr/lib/python2.7/site-packages/foo /usr/lib/python2.7/site-packages/foo/__init__.py /usr/share/locale/ # With message catalogs below here: /usr/share/locale/es/LC_MESSAGES/foo.mo .. note:: This function will setup Translation objects that attempt to lookup msgids in all of the found :term:`message catalogs`. This means if you have several versions of the :term:`message catalogs` installed in different directories that the function searches, you need to make sure that :attr:`localedirs` specifies the directories so that newer :term:`message catalogs` are searched first. It also means that if a newer catalog does not contain a translation for a msgid but an older one that's in :attr:`localedirs` does, the translation from that older catalog will be returned. .. versionchanged:: kitchen-1.1.0 ; API kitchen.i18n 2.1.0 Add more parameters to :func:`~kitchen.i18n.get_translation_object` so it can more easily be used as a replacement for :func:`gettext.translation`. Also change the way we use localedirs. We cycle through them until we find a suitable locale file rather than simply cycling through until we find a directory that exists. The new code is based heavily on the |stdlib|_ :func:`gettext.translation` function. tallis$No translation file found for domaintrbN(R7t itertoolstchaint_DEFAULT_LOCALEDIRtextendR tfindRtIOErrorRRtostpathtabspatht _translationstgettopent setdefaulttclosetcopyRt add_fallback( tdomaint localedirst languagestclass_tfallbacktcodesettmofilest localedirtstacked_translationstmofilet full_patht translationt mofile_fh((s9/usr/lib/python2.7/site-packages/kitchen/i18n/__init__.pytget_translation_objectfs4x &   cCs8t|d|�}|r(|j|jfS|j|jfS(s� Setup translation functions for an application :arg domain: Name of the message domain. This should be a unique name that can be used to lookup the :term:`message catalog` for this app. :kwarg localedirs: Iterator of directories to look for :term:`message catalogs` under. The first directory to exist is used regardless of whether messages for this domain are present. If none of the directories exist, fallback on ``sys.prefix`` + :file:`/share/locale` Default: No directories to search so we just use the fallback. :kwarg use_unicode: If :data:`True` return the :mod:`gettext` functions for :class:`unicode` strings else return the functions for byte :class:`str` for the translations. Default is :data:`True`. :return: tuple of the :mod:`gettext` function and :mod:`gettext` function for plurals Setting up :mod:`gettext` can be a little tricky because of lack of documentation. This function will setup :mod:`gettext` using the `Class-based API <http://docs.python.org/library/gettext.html#class-based-api>`_ for you. For the simple case, you can use the default arguments and call it like this:: _, N_ = easy_gettext_setup() This will get you two functions, :func:`_` and :func:`N_` that you can use to mark strings in your code for translation. :func:`_` is used to mark strings that don't need to worry about plural forms no matter what the value of the variable is. :func:`N_` is used to mark strings that do need to have a different form if a variable in the string is plural. .. seealso:: :doc:`api-i18n` This module's documentation has examples of using :func:`_` and :func:`N_` :func:`get_translation_object` for information on how to use :attr:`localedirs` to get the proper :term:`message catalogs` both when in development and when installed to FHS compliant directories on Linux. .. note:: The gettext functions returned from this function should be superior to the ones returned from :mod:`gettext`. The traits that make them better are described in the :class:`DummyTranslations` and :class:`NewGNUTranslations` documentation. .. versionchanged:: kitchen-0.2.4 ; API kitchen.i18n 2.0.0 Changed :func:`~kitchen.i18n.easy_gettext_setup` to return the lgettext functions instead of gettext functions when use_unicode=False. RS(R_R0R2R+R-(RRRSt use_unicodet translations((s9/usr/lib/python2.7/site-packages/kitchen/i18n/__init__.pyteasy_gettext_setups3RbR_($R5tkitchen.versioningRt__version_info__t __version__RPterrnoRR RBRRHtsysRRDt ImportErrorRItjointprefixtkitchen.text.convertersRRtkitchen.text.miscRRKtobjectR RR8R7ttupleRtTrueR_Rbt__all__(((s9/usr/lib/python2.7/site-packages/kitchen/i18n/__init__.pyt<module>Ns2         �� �8