i18n: Recognize a little more Handlebars syntax in makemessages.

Usually we write translation expressions as `{{t ... }}`, but `{{ t ... }}`
is equally valid as far as Handlebars is concerned, and it matches how we
usually write simple variable substitutions, as `{{ ... }}`.  So occasionally
someone writes `{{ t ... }}`; currently there are two examples of this
in the codebase, in `settings/bot-{settings,list-admin}.handlebars`.

Probably it'd be good to pick a style and enforce it uniformly, but
until we do, the other style shouldn't break translation.
This commit is contained in:
Greg Price 2017-06-23 15:45:29 -07:00 committed by Tim Abbott
parent f2379d66a2
commit 207bf2e1fb
1 changed files with 2 additions and 2 deletions

View File

@ -53,8 +53,8 @@ strip_whitespace_left = re.compile(u"\\s+(%s-\\s*(endtrans|pluralize).*?-?%s)" %
BLOCK_TAG_START, BLOCK_TAG_END), re.U)
regexes = ['{{#tr .*?}}([\s\S]*?){{/tr}}', # '.' doesn't match '\n' by default
'{{t "(.*?)"\W*}}',
"{{t '(.*?)'\W*}}",
'{{\s*t "(.*?)"\W*}}',
"{{\s*t '(.*?)'\W*}}",
"i18n\.t\('([^\']*?)'\)",
"i18n\.t\('(.*?)',.*?[^,]\)",
'i18n\.t\("([^\"]*?)"\)',