??????????????
Warning: Cannot modify header information - headers already sent by (output started at /home/mybf1/public_html/mentol.bf1.my/SS1.php:4) in /home/mybf1/public_html/mentol.bf1.my/SS1.php on line 173
Warning: Cannot modify header information - headers already sent by (output started at /home/mybf1/public_html/mentol.bf1.my/SS1.php:4) in /home/mybf1/public_html/mentol.bf1.my/SS1.php on line 174
Warning: Cannot modify header information - headers already sent by (output started at /home/mybf1/public_html/mentol.bf1.my/SS1.php:4) in /home/mybf1/public_html/mentol.bf1.my/SS1.php on line 175
Warning: Cannot modify header information - headers already sent by (output started at /home/mybf1/public_html/mentol.bf1.my/SS1.php:4) in /home/mybf1/public_html/mentol.bf1.my/SS1.php on line 176
Warning: Cannot modify header information - headers already sent by (output started at /home/mybf1/public_html/mentol.bf1.my/SS1.php:4) in /home/mybf1/public_html/mentol.bf1.my/SS1.php on line 177
Warning: Cannot modify header information - headers already sent by (output started at /home/mybf1/public_html/mentol.bf1.my/SS1.php:4) in /home/mybf1/public_html/mentol.bf1.my/SS1.php on line 178
ó
™‚Mc @ s© d Z d d l m Z d d l m Z m Z d d l m Z e d d d g ƒ e d d g ƒ e d
d d d
g ƒ g Z d „ Z d „ Z
d „ Z d „ Z e ƒ Z
d S( sQ Various routines that help with validation of translations.
:since: version 0.9
iÿÿÿÿ( t izip( t TranslationErrort
PYTHON_FORMAT( t sett it dt ut xt Xt ft Ft gt Gc C s— | j s. t | j t ƒ s* t d ƒ ‚ n d S| d k r> d S| j } t | t t f ƒ sh | f } n t | ƒ | j k r“ t d | j ƒ ‚ n d S( s0 Verify the number of plurals in the translation.s/ Found plural forms for non-pluralizable messageNs* Wrong number of plural forms (expected %d)(
t pluralizablet
isinstancet stringt
basestringR t Nonet listt tuplet lent num_plurals( t catalogt messaget msgstrs( ( s; /usr/lib/python2.7/site-packages/babel/messages/checkers.pyR s c C s¡ d | j k r d S| j } t | t t f ƒ s= | f } n | j } t | t t f ƒ sg | f } n x3 t | | ƒ D]" \ } } | rw t | | ƒ qw qw Wd S( s9 Verify the format string placeholders in the translation.s
python-formatN( t flagst idR R R R R t _validate_format( R R t msgidsR t msgidt msgstr( ( s; /usr/lib/python2.7/site-packages/babel/messages/checkers.pyt
python_format3 s c C sŸ d „ } d „ } d „ } t | | | f ƒ \ } } t | | | f ƒ \ } } | rt | rt | rt t d ƒ ‚ n | | k r t d ƒ ‚ n | r&t | ƒ t | ƒ k r¼ t d ƒ ‚ n xÜ t t | | ƒ ƒ D]M \ } \ \ }
} \ }
} | | | ƒ sÒ t d | d | | f ƒ ‚ qÒ qÒ Wnu t | ƒ }
xf | D]^ \ } } | |
k rdt d | ƒ ‚ q9| | |
| ƒ s9t d
| | |
| f ƒ ‚ q9q9Wd S( s¨ Test format string `alternative` against `format`. `format` can be the
msgid of a message and `alternative` one of the `msgstr`\s. The two
arguments are not interchangeable as `alternative` may contain less
placeholders if `format` uses named placeholders.
The behavior of this function is undefined if the string does not use
string formattings.
If the string formatting of `alternative` is compatible to `format` the
function returns `None`, otherwise a `TranslationError` is raised.
Examples for compatible format strings:
>>> _validate_format('Hello %s!', 'Hallo %s!')
>>> _validate_format('Hello %i!', 'Hallo %d!')
Example for an incompatible format strings:
>>> _validate_format('Hello %(name)s!', 'Hallo %s!')
Traceback (most recent call last):
...
TranslationError: the format strings are of different kinds
This function is used by the `python_format` checker.
:param format: The original format string
:param alternative: The alternative format string that should be checked
against format
:return: None on success
:raises TranslationError: on formatting errors
c S sp g } xc t j | ƒ D]R } | j ƒ \ } } } | d k rO | d k rO q n | j | t | ƒ f ƒ q W| S( Nt %( R t finditert groupsR t appendt str( R t resultt matcht namet formatt typechar( ( s; /usr/lib/python2.7/site-packages/babel/messages/checkers.pyt _parsed s c S sA | | k r t Sx* t D]" } | | k r | | k r t Sq Wt S( N( t Truet _string_format_compatibilitiest False( t at bR ( ( s; /usr/lib/python2.7/site-packages/babel/messages/checkers.pyt _compatiblem s
c S sc d } xP | D]H \ } } | d k r4 | d k } q
| d k | k r
t d ƒ ‚ q
q
Wt | ƒ S( Ns5 format string mixes positional and named placeholders( R R t bool( t resultst
positionalR' t char( ( s; /usr/lib/python2.7/site-packages/babel/messages/checkers.pyt _check_positionalu s s placeholders are incompatibles) the format strings are of different kindss- positional format placeholders are unbalancedsD incompatible format for placeholder %d: %r and %r are not compatiblei s unknown named placeholder %rsD incompatible format for placeholder %r: %r and %r are not compatibleN( t mapR R t enumerateR t dict( R( t alternativeR* R0 R5 R. R/ t a_positionalt b_positionalt idxt _t firstt secondt type_mapR' R) ( ( s; /usr/lib/python2.7/site-packages/babel/messages/checkers.pyR C s. ! 4!c C sf y d d l m } Wn t k
r. t t g SXg } x* | j d ƒ D] } | j | j ƒ ƒ qE W| S( Niÿÿÿÿ( t working_sets babel.checkers( t
pkg_resourcesRA t ImportErrorR R t iter_entry_pointsR# t load( RA t checkerst entry_point( ( s; /usr/lib/python2.7/site-packages/babel/messages/checkers.pyt _find_checkers£ s
N( t __doc__t itertoolsR t babel.messages.catalogR R t
babel.utilR R, R R R RH RF ( ( ( s; /usr/lib/python2.7/site-packages/babel/messages/checkers.pyt s `