summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorClaude Paroz <claude@2xlibre.net>2016-05-01 19:21:43 +0200
committerClaude Paroz <claude@2xlibre.net>2016-05-02 19:39:56 +0200
commit4731e9d82ea72b6d793fb06713d11d228eb89ace (patch)
tree4cef7745abe643f52e296c329318a26fcf6810b9
parent4e2ee8662753ca6a2619039b903f11c60709f398 (diff)
Fixed #26341 (again) -- Addressed multiple occurrences per line use case
-rw-r--r--django/core/management/commands/makemessages.py2
-rw-r--r--tests/i18n/commands/templates/test.html2
2 files changed, 3 insertions, 1 deletions
diff --git a/django/core/management/commands/makemessages.py b/django/core/management/commands/makemessages.py
index 0ee6327357..2b47c81bf7 100644
--- a/django/core/management/commands/makemessages.py
+++ b/django/core/management/commands/makemessages.py
@@ -136,7 +136,7 @@ class BuildFile(object):
return re.sub(
r'^(#: .*)(' + re.escape(old_path) + r')',
- r'\1' + new_path,
+ lambda match: match.group().replace(old_path, new_path),
msgs,
flags=re.MULTILINE
)
diff --git a/tests/i18n/commands/templates/test.html b/tests/i18n/commands/templates/test.html
index b4b896fcef..cac034e63e 100644
--- a/tests/i18n/commands/templates/test.html
+++ b/tests/i18n/commands/templates/test.html
@@ -72,6 +72,8 @@ continued here.{% endcomment %}
<!-- Source file inside a msgid, should be left as-is. -->
{% trans "#: templates/test.html.py" %}
+<!-- Deliberate duplicated string. -->
+{% trans "This literal should be included." %}
{% blocktrans context "Special blocktrans context #1" %}Translatable literal #8a{% endblocktrans %}
{% blocktrans count 2 context "Special blocktrans context #2" %}Translatable literal #8b-singular{% plural %}Translatable literal #8b-plural{% endblocktrans %}