jeffijoe / messageformat.net

ICU MessageFormat implementation for .NET.
MIT License
161 stars 23 forks source link

Line breaks for static text inside 'select' are ignored #34

Closed vtoms4 closed 1 year ago

vtoms4 commented 1 year ago

Library version: 6.2. Sample message:

"Single text which will not change.\nSummary:{acceptedData, select, NONE {} other {\nAccepted Data:{acceptedData}}}"

Message arguments:

{
    "acceptedData": "\n-X\n-Y\n-Z"
}

MessageFormatter usage:

var messageFormatProvider = new MessageFormatter(true, "en");
var result = messageFormatProvider.FormatMessage(message, messageArguments)

Current result:

"Single text which will not change.\nSummary:Accepted Data:\n-X\n-Y\n-Z"

Current result from VisualStudio Text Visualizer: image Expected result:

"Single text which will not change.\nSummary:\nAccepted Data:\n-X\n-Y\n-Z"
jeffijoe commented 1 year ago

So the first newline in the other branch is being omitted?

vtoms4 commented 1 year ago

Yes. And it could be anywhere in this static text. Also other {Accepted\nData:{acceptedData}} will not keep the newline between 'Accepted' and 'Data'.

jeffijoe commented 1 year ago

Interesting, that definitely sounds like a bug. I'll look into it.

jeffijoe commented 1 year ago

Fixed and released as 7.0.0, thanks for reporting!