mirror of https://github.com/zulip/zulip.git
templates: Allow the same line-wrapping in {{t}} as in {{#tr}}.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
This commit is contained in:
parent
ba5a2c8866
commit
8cd78d356f
|
@ -62,6 +62,11 @@ Handlebars.registerHelper("t", function (message) {
|
|||
// Note: use `{` and `}` instead of `{{` and `}}` to declare
|
||||
// variables.
|
||||
|
||||
message = message
|
||||
.trim()
|
||||
.split("\n")
|
||||
.map((s) => s.trim())
|
||||
.join(" ");
|
||||
const descriptor = {id: message, defaultMessage: message};
|
||||
return intl.formatMessage(descriptor, this);
|
||||
});
|
||||
|
|
|
@ -53,11 +53,11 @@ strip_whitespace_left = re.compile(
|
|||
|
||||
regexes = [
|
||||
r"{{#tr}}([\s\S]*?)(?:{{/tr}}|{{#\*inline )", # '.' doesn't match '\n' by default
|
||||
r'{{\s*t "(.*?)"\W*}}',
|
||||
r"{{\s*t '(.*?)'\W*}}",
|
||||
r'\(t "(.*?)"\)',
|
||||
r'=\(t "(.*?)"\)(?=[^{]*}})',
|
||||
r"=\(t '(.*?)'\)(?=[^{]*}})",
|
||||
r'{{\s*t "([\s\S]*?)"\W*}}',
|
||||
r"{{\s*t '([\s\S]*?)'\W*}}",
|
||||
r'\(t "([\s\S]*?)"\)',
|
||||
r'=\(t "([\s\S]*?)"\)(?=[^{]*}})',
|
||||
r"=\(t '([\s\S]*?)'\)(?=[^{]*}})",
|
||||
]
|
||||
tags = [
|
||||
("err_", "error"),
|
||||
|
|
Loading…
Reference in New Issue