jeffijoe / messageformat.net

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

Select format with URLs always returns default #45

Closed Revarin closed 1 month ago

Revarin commented 1 month ago

Select format does not seem to work correctly with text containing url. Formatter always returns default string no matter what arguments are passed. No exception or any other form of a warning is raised.

public void UrlTest()
{
    var mf= new MessageFormatter(locale: "en-US");

    IDictionary<string, object> dict = new Dictionary<string, object>
    {
        ["cond"] = "foo"
    };

    Assert.Equal("https://www.google.com/", mf.FormatMessage("{cond, select, foo{https://www.google.com/} other{https://www.bing.com/}}", dict));
}
Message: 
Assert.Equal() Failure: Strings differ

Expected: "https://www.google.com/"
Actual:   "https://www.bing.com/"

Formatter should either format the string correctly or throw an exception.

jeffijoe commented 1 month ago

That's odd, I'll take a look.

jeffijoe commented 1 month ago

Thanks for the report! MessageFormat v7.1.2 has been released with a fix for this.