mirror of
https://github.com/django/django.git
synced 2025-10-24 06:06:09 +00:00
Fixed #26341 -- Fixed makemessages breaking location comments for HTML files
Thanks Sylvain Garancher for the report and Veranika Sabiashchanskaya for the initial patch.
This commit is contained in:
@@ -128,13 +128,18 @@ class BuildFile(object):
|
||||
# Remove '.py' suffix
|
||||
if os.name == 'nt':
|
||||
# Preserve '.\' prefix on Windows to respect gettext behavior
|
||||
old = '#: ' + self.work_path
|
||||
new = '#: ' + self.path
|
||||
old_path = self.work_path
|
||||
new_path = self.path
|
||||
else:
|
||||
old = '#: ' + self.work_path[2:]
|
||||
new = '#: ' + self.path[2:]
|
||||
old_path = self.work_path[2:]
|
||||
new_path = self.path[2:]
|
||||
|
||||
return msgs.replace(old, new)
|
||||
return re.sub(
|
||||
r'^(#: .*)(' + re.escape(old_path) + r')',
|
||||
r'\1' + new_path,
|
||||
msgs,
|
||||
flags=re.MULTILINE
|
||||
)
|
||||
|
||||
def cleanup(self):
|
||||
"""
|
||||
|
||||
Reference in New Issue
Block a user