Skip to content

Allow leading and trailing whitespace in complex messages #809

@lucacasonato

Description

@lucacasonato

Currenly, complex messages can not start or end with whitespace. The first character of a complex message must either be . or {, and the final character must be }. This is unfortunate, because this results in unnecessary complexity for users.

Example:

const message = `
.input {$count :number}
.match {$count}
one {{You have {$count} notification.}}
*   {{You have {$count} notifications.}}
`

This does not work right now, because there is whitespace between the string start, and the first char of the complex message, and the trailing } and the end of the string.

This can not be remedied by just trimming all messages, because for simple messages, leading and trailing whitespace is significant.

For complex messages, leading and trailing whitespace is not significant, because all chars outside of a quoted-pattern are control characters and not relevant for display (they are not included in the output message).

To fix this, complex-message grammar can be changed as follows:

- complex-body = quoted-pattern / matcher
+ complex-body = [s] (quoted-pattern / matcher) [s]

Metadata

Metadata

Assignees

No one assigned

    Labels

    Preview-FeedbackFeedback gathered during the technical previewsyntaxIssues related with syntax or ABNF

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions