1 | diff --git a/tests/regressiontests/i18n/commands/extraction.py b/tests/regressiontests/i18n/commands/extraction.py
|
---|
2 | index fb9ca4e..87e2332 100644
|
---|
3 | --- a/tests/regressiontests/i18n/commands/extraction.py
|
---|
4 | +++ b/tests/regressiontests/i18n/commands/extraction.py
|
---|
5 | @@ -148,6 +148,21 @@ class BasicExtractorTests(ExtractorTests):
|
---|
6 | self.assertTrue('msgctxt "Special blocktrans context #4"' in po_contents)
|
---|
7 | self.assertTrue("Translatable literal #8d" in po_contents)
|
---|
8 |
|
---|
9 | + def test_template_message_context_extractor_same_string(self):
|
---|
10 | + """
|
---|
11 | + Refs #18114.
|
---|
12 | + """
|
---|
13 | + os.chdir(self.test_dir)
|
---|
14 | + management.call_command('makemessages', locale=LOCALE, verbosity=0)
|
---|
15 | + self.assertTrue(os.path.exists(self.PO_FILE))
|
---|
16 | + with open(self.PO_FILE, 'r') as fp:
|
---|
17 | + po_contents = fp.read()
|
---|
18 | + print po_contents
|
---|
19 | + # {% trans %}
|
---|
20 | + self.assertTrue("Translatable literal #9" in po_contents)
|
---|
21 | + self.assertTrue('msgctxt "Special trans context #9a"' in po_contents)
|
---|
22 | + self.assertTrue('msgctxt "Special trans context #9b"' in po_contents)
|
---|
23 | +
|
---|
24 | class JavascriptExtractorTests(ExtractorTests):
|
---|
25 |
|
---|
26 | PO_FILE='locale/%s/LC_MESSAGES/djangojs.po' % LOCALE
|
---|
27 | diff --git a/tests/regressiontests/i18n/commands/templates/test.html b/tests/regressiontests/i18n/commands/templates/test.html
|
---|
28 | index 5789346..2828282 100644
|
---|
29 | --- a/tests/regressiontests/i18n/commands/templates/test.html
|
---|
30 | +++ b/tests/regressiontests/i18n/commands/templates/test.html
|
---|
31 | @@ -77,3 +77,7 @@ continued here.{% endcomment %}
|
---|
32 | {% trans "Shouldn't double escape this sequence %% either" context "ctx1" %}
|
---|
33 | {% trans "Looks like a str fmt spec %s but shouldn't be interpreted as such" %}
|
---|
34 | {% trans "Looks like a str fmt spec % o but shouldn't be interpreted as such" %}
|
---|
35 | +
|
---|
36 | +{% trans "Translatable literal #9" %}
|
---|
37 | +{% trans "Translatable literal #9" context "Special trans context #9a" %}
|
---|
38 | +{% trans "Translatable literal #9" as var context "Special trans context #9b" %}
|
---|