Changeset 9155
- Timestamp:
- 10/05/08 20:36:35 (3 months ago)
- Files:
-
- django/trunk/django/core/management/commands/makemessages.py (modified) (2 diffs)
- django/trunk/docs/topics/i18n.txt (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
django/trunk/django/core/management/commands/makemessages.py
r9148 r9155 76 76 raise CommandError(message) 77 77 78 # xgettext versions prior to 0.15 assumed Python source files were encoded 79 # in iso-8859-1, and produce utf-8 output. In the case where xgettext is 80 # given utf-8 input (required for Django files with non-ASCII characters), 81 # this results in a utf-8 re-encoding of the original utf-8 that needs to be 82 # undone to restore the original utf-8. So we check the xgettext version 83 # here once and set a flag to remember if a utf-8 decoding needs to be done 84 # on xgettext's output for Python files. We default to assuming this isn't 85 # necessary if we run into any trouble determining the version. 86 xgettext_reencodes_utf8 = False 87 (stdin, stdout, stderr) = os.popen3('xgettext --version', 't') 88 match = re.search(r'(?P<major>\d+)\.(?P<minor>\d+)', stdout.read()) 89 if match: 90 xversion = (int(match.group('major')), int(match.group('minor'))) 91 if xversion < (0, 15): 92 xgettext_reencodes_utf8 = True 93 78 94 languages = [] 79 95 if locale is not None: … … 140 156 if errors: 141 157 raise CommandError("errors happened while running xgettext on %s\n%s" % (file, errors)) 158 159 if xgettext_reencodes_utf8: 160 msgs = msgs.decode('utf-8').encode('iso-8859-1') 161 142 162 if thefile != file: 143 163 old = '#: '+os.path.join(dirpath, thefile)[2:] django/trunk/docs/topics/i18n.txt
r9131 r9155 975 975 * Add ``;C:\Program Files\gettext-utils\bin`` at the end of the 976 976 ``Variable value`` field 977 978 You may also use ``gettext`` binaries you have obtained elsewhere, so long as 979 the ``xgettext --version`` command works properly. Some version 0.14.4 binaries 980 have been found to not support this command. Do not attempt to use Django 981 translation utilities with a ``gettext`` package if the command ``xgettext 982 --version`` entered at a Windows command prompt causes a popup window saying 983 "xgettext.exe has generated errors and will be closed by Windows".
