<s> """<STR_LIT>""" <EOL> import warnings <EOL> from os import path <EOL> from django . utils . encoding import force_unicode <EOL> from django . utils . functional import lazy <EOL> from django . utils . importlib import import_module <EOL> __all__ = [ <EOL> '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , <EOL> '<STR_LIT>' , '<STR_LIT>' , <EOL> '<STR_LIT>' , '<STR_LIT>' , <EOL> '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , <EOL> '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , <EOL> '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , <EOL> '<STR_LIT>' , '<STR_LIT>' , <EOL> '<STR_LIT>' , '<STR_LIT>' , <EOL> '<STR_LIT>' , '<STR_LIT>' , <EOL> '<STR_LIT>' , '<STR_LIT>' , <EOL> ] <EOL> class Trans ( object ) : <EOL> """<STR_LIT>""" <EOL> def __getattr__ ( self , real_name ) : <EOL> from django . conf import settings <EOL> if settings . USE_I18N : <EOL> from django . utils . translation import trans_real as trans <EOL> if settings . SETTINGS_MODULE is not None : <EOL> parts = settings . SETTINGS_MODULE . split ( '<STR_LIT:.>' ) <EOL> project = import_module ( parts [ <NUM_LIT:0> ] ) <EOL> project_locale_path = path . normpath ( <EOL> path . join ( path . dirname ( project . __file__ ) , '<STR_LIT>' ) ) <EOL> normalized_locale_paths = [ path . normpath ( locale_path ) <EOL> for locale_path in settings . LOCALE_PATHS ] <EOL> if ( path . isdir ( project_locale_path ) and <EOL> not project_locale_path in normalized_locale_paths ) : <EOL> warnings . warn ( "<STR_LIT>" <EOL> "<STR_LIT>" <EOL> "<STR_LIT>" , <EOL> DeprecationWarning ) <EOL> else : <EOL> from django . utils . translation import trans_null as trans <EOL> setattr ( self , real_name , getattr ( trans , real_name ) ) <EOL> return getattr ( trans , real_name ) <EOL> _trans = Trans ( ) <EOL> del Trans <EOL> def gettext_noop ( message ) : <EOL> return _trans . gettext_noop ( message ) <EOL> ugettext_noop = gettext_noop <EOL> def gettext ( message ) : <EOL> return _trans . gettext ( message ) <EOL> def ngettext ( singular , plural , number ) : <EOL> return _trans . ngettext ( singular , plural , number ) <EOL> def ugettext ( message ) : <EOL> return _trans . ugettext ( message ) <EOL> def ungettext ( singular , plural , number ) : <EOL> return _trans . ungettext ( singular , plural , number ) <EOL> def pgettext ( context , message ) : <EOL> return _trans . pgettext ( context , message ) <EOL> def npgettext ( context , singular , plural , number ) : <EOL> return _trans . npgettext ( context , singular , plural , number ) <EOL> ngettext_lazy = lazy ( ngettext , str ) <EOL> gettext_lazy = lazy ( gettext , str ) <EOL> ungettext_lazy = lazy ( ungettext , unicode ) <EOL> ugettext_lazy = lazy ( ugettext , unicode ) <EOL> pgettext_lazy = lazy ( pgettext , unicode ) <EOL> npgettext_lazy = lazy ( npgettext , unicode ) <EOL> def activate ( language ) : <EOL> return _trans . activate ( language ) <EOL> def deactivate ( ) : <EOL> return _trans . deactivate ( ) <EOL> class override ( object ) : <EOL> def __init__ ( self , language , deactivate = False ) : <EOL> self . language = language <EOL> self . deactivate = deactivate <EOL> self . old_language = get_language ( ) <EOL> def __enter__ ( self ) : <EOL> if self . language is not None : <EOL> activate ( self . language ) <EOL> else : <EOL> deactivate_all ( ) <EOL> def __exit__ ( self , exc_type , exc_value , traceback ) : <EOL> if self . deactivate : <EOL> deactivate ( ) <EOL> else : <EOL> activate ( self . old_language ) <EOL> def get_language ( ) : <EOL> return _trans . get_language ( ) <EOL> def get_language_bidi ( ) : <EOL> return _trans . get_language_bidi ( ) <EOL> def check_for_language ( lang_code ) : <EOL> return _trans . check_for_language ( lang_code ) <EOL> def to_locale ( language ) : <EOL> return _trans . to_locale ( language ) <EOL> def get_language_from_request ( request , check_path = False ) : <EOL> return _trans . get_language_from_request ( request , check_path ) <EOL> def get_language_from_path ( path ) : <EOL> return _trans . get_language_from_path ( path ) <EOL> def templatize ( src , origin = None ) : <EOL> return _trans . templatize ( src , origin ) <EOL> def deactivate_all ( ) : <EOL> return _trans . deactivate_all ( ) <EOL> def _string_concat ( * strings ) : <EOL> """<STR_LIT>""" <EOL> return u'<STR_LIT>' . join ( [ force_unicode ( s ) for s in strings ] ) <EOL> string_concat = lazy ( _string_concat , unicode ) <EOL> def get_language_info ( lang_code ) : <EOL> from django . conf . locale import LANG_INFO <EOL> try : <EOL> return LANG_INFO [ lang_code ] <EOL> except KeyError : <EOL> raise KeyError ( "<STR_LIT>" % lang_code ) </s>
