Merge "i18n: trim whitespaces in extracted messages from AngularJS templates"
This commit is contained in:
commit
ccbad83a17
@ -159,7 +159,7 @@ class ExtractAngularTestCase(test.TestCase):
|
||||
"</translate></html>")
|
||||
|
||||
messages = list(extract_angular(buf, [], [], {}))
|
||||
self.assertEqual([(1, 'gettext', 'hello\n world!', [])], messages)
|
||||
self.assertEqual([(1, 'gettext', 'hello world!', [])], messages)
|
||||
|
||||
def test_nested_translate_tag(self):
|
||||
buf = StringIO(
|
||||
|
@ -15,6 +15,7 @@
|
||||
|
||||
import re
|
||||
|
||||
from django.utils.translation import trim_whitespace
|
||||
from six.moves import html_parser
|
||||
|
||||
|
||||
@ -126,12 +127,12 @@ class AngularGettextHTMLParser(html_parser.HTMLParser):
|
||||
return
|
||||
if self.plural_form:
|
||||
messages = (
|
||||
self.data.strip(),
|
||||
self.plural_form
|
||||
trim_whitespace(self.data.strip()),
|
||||
trim_whitespace(self.plural_form)
|
||||
)
|
||||
func_name = u'ngettext'
|
||||
else:
|
||||
messages = self.data.strip()
|
||||
messages = trim_whitespace(self.data.strip())
|
||||
func_name = u'gettext'
|
||||
self.strings.append(
|
||||
(self.line, func_name, messages, self.comments)
|
||||
|
Loading…
Reference in New Issue
Block a user