Django

Code

Changeset 7206

Show
Ignore:
Timestamp:
03/07/08 21:55:47 (6 months ago)
Author:
gwilson
Message:

Removed unused import, corrected a typo, and made some styling fixes.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • django/trunk/django/utils/translation/trans_real.py

    r7185 r7206  
    1 "Translation helper functions
     1"""Translation helper functions.""
    22 
    33import locale 
     
    88from cStringIO import StringIO 
    99 
    10 from django.utils.encoding import force_unicode 
    1110from django.utils.safestring import mark_safe, SafeData 
    1211 
     
    3130_default = None 
    3231 
    33 # This is a cache for normalised accept-header languages to prevent multiple 
     32# This is a cache for normalized accept-header languages to prevent multiple 
    3433# file lookups when checking the same locale on repeated requests. 
    3534_accepted = {} 
     
    5756 
    5857def to_language(locale): 
    59     "Turns a locale name (en_US) into a language name (en-us).
     58    """Turns a locale name (en_US) into a language name (en-us).""
    6059    p = locale.find('_') 
    6160    if p >= 0: 
     
    230229 
    231230def get_language(): 
    232     "Returns the currently selected language.
     231    """Returns the currently selected language.""
    233232    t = _active.get(currentThread(), None) 
    234233    if t is not None: 
     
    252251def catalog(): 
    253252    """ 
    254     This function returns the current active catalog for further processing. 
     253    Returns the current active catalog for further processing. 
    255254    This can be used if you need to modify the catalog or want to access the 
    256255    whole message catalog instead of just translating one string. 
     
    375374        if not normalized: 
    376375            continue 
    377         # Remove the default encoding from locale_alias 
     376        # Remove the default encoding from locale_alias. 
    378377        normalized = normalized.split('.')[0] 
    379378 
     
    397396def get_date_formats(): 
    398397    """ 
    399     This function checks whether translation files provide a translation for some 
    400     technical message ID to store date and time formats. If it doesn't contain 
    401     one, the formats provided in the settings will be used. 
     398    Checks whether translation files provide a translation for some technical 
     399    message ID to store date and time formats. If it doesn't contain one, the 
     400    formats provided in the settings will be used. 
    402401    """ 
    403402    from django.conf import settings 
     
    415414def get_partial_date_formats(): 
    416415    """ 
    417     This function checks whether translation files provide a translation for some 
    418     technical message ID to store partial date formats. If it doesn't contain 
    419     one, the formats provided in the settings will be used. 
     416    Checks whether translation files provide a translation for some technical 
     417    message ID to store partial date formats. If it doesn't contain one, the 
     418    formats provided in the settings will be used. 
    420419    """ 
    421420    from django.conf import settings 
     
    441440plural_re = re.compile(r"""^\s*plural$""") 
    442441constant_re = re.compile(r"""_\(((?:".*?")|(?:'.*?'))\)""") 
     442 
    443443def templatize(src): 
    444444    """ 
     
    476476                    inplural = True 
    477477                else: 
    478                     raise SyntaxError, "Translation blocks must not include other block tags: %s" % t.contents 
     478                    raise SyntaxError("Translation blocks must not include other block tags: %s" % t.contents) 
    479479            elif t.token_type == TOKEN_VAR: 
    480480                if inplural: 
     
    542542    result.sort(lambda x, y: -cmp(x[1], y[1])) 
    543543    return result 
    544