Django

Code

Changeset 2060

Show
Ignore:
Timestamp:
01/18/06 19:09:28 (3 years ago)
Author:
adrian
Message:

magic-removal: Merged to [2059]

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • django/branches/magic-removal/django/bin/compile-messages.py

    r2057 r2060  
    1717 
    1818    for (dirpath, dirnames, filenames) in os.walk(basedir): 
    19         for file in filenames: 
    20             if file.endswith('.po'): 
    21                 sys.stderr.write('processing file %s in %s\n' % (file, dirpath)) 
    22                 pf = os.path.splitext(os.path.join(dirpath, file))[0] 
     19        for f in filenames: 
     20            if f.endswith('.po'): 
     21                sys.stderr.write('processing file %s in %s\n' % (f, dirpath)) 
     22                pf = os.path.splitext(os.path.join(dirpath, f))[0] 
    2323                cmd = 'msgfmt -o "%s.mo" "%s.po"' % (pf, pf) 
    2424                os.system(cmd) 
  • django/branches/magic-removal/django/bin/unique-messages.py

    r2057 r2060  
    33import os 
    44import sys 
    5 import getopt 
    65 
    76def unique_messages(): 
     
    1716 
    1817    for (dirpath, dirnames, filenames) in os.walk(basedir): 
    19         for file in filenames: 
    20             if file.endswith('.po'): 
    21                 sys.stderr.write('processing file %s in %s\n' % (file, dirpath)) 
    22                 pf = os.path.splitext(os.path.join(dirpath, file))[0] 
     18        for f in filenames: 
     19            if f.endswith('.po'): 
     20                sys.stderr.write('processing file %s in %s\n' % (f, dirpath)) 
     21                pf = os.path.splitext(os.path.join(dirpath, f))[0] 
    2322                cmd = 'msguniq "%s.po"' % pf 
    2423                stdout = os.popen(cmd) 
  • django/branches/magic-removal/django/utils/html.py

    r1972 r2060  
    1313word_split_re = re.compile(r'(\s+)') 
    1414punctuation_re = re.compile('^(?P<lead>(?:%s)*)(?P<middle>.*?)(?P<trail>(?:%s)*)$' % \ 
    15     ('|'.join([re.escape(p) for p in LEADING_PUNCTUATION]), 
    16     '|'.join([re.escape(p) for p in TRAILING_PUNCTUATION]))) 
     15    ('|'.join([re.escape(x) for x in LEADING_PUNCTUATION]), 
     16    '|'.join([re.escape(x) for x in TRAILING_PUNCTUATION]))) 
    1717simple_email_re = re.compile(r'^\S+@[a-zA-Z0-9._-]+\.[a-zA-Z0-9._-]+$') 
    1818link_target_attribute_re = re.compile(r'(<a [^>]*?)target=[^\s>]+') 
    1919html_gunk_re = re.compile(r'(?:<br clear="all">|<i><\/i>|<b><\/b>|<em><\/em>|<strong><\/strong>|<\/?smallcaps>|<\/?uppercase>)', re.IGNORECASE) 
    20 hard_coded_bullets_re = re.compile(r'((?:<p>(?:%s).*?[a-zA-Z].*?</p>\s*)+)' % '|'.join([re.escape(d) for d in DOTS]), re.DOTALL) 
     20hard_coded_bullets_re = re.compile(r'((?:<p>(?:%s).*?[a-zA-Z].*?</p>\s*)+)' % '|'.join([re.escape(x) for x in DOTS]), re.DOTALL) 
    2121trailing_empty_content_re = re.compile(r'(?:<p>(?:&nbsp;|\s|<br \/>)*?</p>\s*)+\Z') 
     22del x # Temporary variable 
    2223 
    2324def escape(html): 
  • django/branches/magic-removal/django/views/debug.py

    r1945 r2060  
    33from django.utils.html import escape 
    44from django.http import HttpResponseServerError, HttpResponseNotFound 
    5 import inspect, os, re, sys 
     5import os, re 
    66from itertools import count, izip 
    77from os.path import dirname, join as pathjoin 
  • django/branches/magic-removal/django/views/i18n.py

    r1914 r2060  
    1 import re 
    2 import os 
    3  
    4 import gettext as gettext_module 
    5  
    61from django import http 
    72from django.utils.translation import check_for_language, activate, to_locale, get_language 
    83from django.utils.text import javascript_quote 
    94from django.conf import settings 
     5import os 
     6import gettext as gettext_module 
    107 
    118def set_language(request): 
     
    146143            try: 
    147144                catalog = gettext_module.translation(domain, path, [default_locale]) 
    148             except IOError, e
     145            except IOError
    149146                catalog = None 
    150147            if catalog is not None: 
     
    155152            try: 
    156153                catalog = gettext_module.translation(domain, path, [locale]) 
    157             except IOError, e
     154            except IOError
    158155                catalog = None 
    159156            if catalog is not None: 
  • django/branches/magic-removal/docs/i18n.txt

    r2057 r2060  
    448448 
    449449      .. _LANGUAGES setting: http://www.djangoproject.com/documentation/settings/#languages 
    450     * the LocaleMiddleware can only select languages for which there is a 
    451       django provided base translation. If you want to provide translations 
     450    * The ``LocaleMiddleware`` can only select languages for which there is a 
     451      Django-provided base translation. If you want to provide translations 
    452452      for your application that aren't already in the set of translations 
    453       in Djangos source tree, you will want to at least provide basic 
    454       translations for that language. For example Django uses technical 
    455       message IDs to translate date formats and time formats - so you will 
     453      in Django's source tree, you'll want to provide at least basic 
     454      translations for that language. For example, Django uses technical 
     455      message IDs to translate date formats and time formats -- so you will 
    456456      need at least those translations for the system to work correctly. 
    457457 
    458       A good starting point is to just copy over the english ``.po`` file 
    459       and to translate at least the technical messages and maybe the validator 
     458      A good starting point is to copy the English ``.po`` file and to 
     459      translate at least the technical messages -- maybe the validator 
    460460      messages, too. 
    461        
    462       Technical message IDs are easily recognized by them being all upper case. 
    463       You don't translate the message ID as with other messages, you provid
    464       the correct local variant on the provided english value. For example with 
     461 
     462      Technical message IDs are easily recognized; they're all upper case. You 
     463      don't translate the message ID as with other messages, you provide th
     464      correct local variant on the provided English value. For example, with 
    465465      ``DATETIME_FORMAT`` (or ``DATE_FORMAT`` or ``TIME_FORMAT``), this would 
    466       be the format string that you want to use in your language. The format 
    467       is identical to the ``now`` tag date formattings
     466      be the format string that you want to use in your language. The format 
     467      is identical to the format strings used by the ``now`` template tag
    468468 
    469469Once ``LocaleMiddleware`` determines the user's preference, it makes this