Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow leading and trailing whitespace in complex messages #809

Closed
lucacasonato opened this issue Jun 15, 2024 · 6 comments · Fixed by #854
Closed

Allow leading and trailing whitespace in complex messages #809

lucacasonato opened this issue Jun 15, 2024 · 6 comments · Fixed by #854
Labels
Preview-Feedback Feedback gathered during the technical preview syntax Issues related with MF Syntax

Comments

@lucacasonato
Copy link
Contributor

lucacasonato commented Jun 15, 2024

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]
@aphillips aphillips added syntax Issues related with MF Syntax Preview-Feedback Feedback gathered during the technical preview labels Jun 15, 2024
@catamorphism
Copy link
Collaborator

@lucacasonato
Copy link
Contributor Author

I am not sure how relevant that discussion is, as it focuses on trimming white space around unquoted patterns (like simple message). I however am only concerned about complex messages here, which can not contain unquoted patterns. Additionally the spec already agrees that quotes before quoted patterns are not meaningful: for example, the optional space between key and quoted-pattern in variant shows this. I'm suggesting this is white space allowance is expanded to around the entire complex body.

@eemeli
Copy link
Collaborator

eemeli commented Jun 19, 2024

The perhaps more relevant prior discussion is #610, where I hit the same issue.

@aphillips aphillips added the Agenda+ Requested for upcoming teleconference label Jul 1, 2024
@aphillips
Copy link
Member

With #812 I have added this to the agenda of the 2024-07-01 call. Note that leading whitespace conflicts with simple message processing, as described in the PEWS design document @catamorphism linked above.

@echeran
Copy link
Collaborator

echeran commented Jul 29, 2024

Also see this previous ballot #505 with related discussion thread #507

@aphillips
Copy link
Member

The WG agreed to permit opening and trailing whitespace in complex messages. Waiting to merge #854 to close this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Preview-Feedback Feedback gathered during the technical preview syntax Issues related with MF Syntax
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants