Skip to content

Escaping with backslashes incompatible with ICU MessageFormat #171

@dvtomas

Description

@dvtomas

Hi,
according to your specs, "Messageformat.js supports and extends all parts of the standard, with the exception of the deprecated ChoiceFormat."

According to the standard, "messageText can contain quoted literal strings including syntax characters. A quoted literal string begins with an ASCII apostrophe and a syntax character (usually a {curly brace}) and continues until the next single apostrophe. A double ASCII apostrohpe inside or outside of a quoted string represents one literal apostrophe." ...

According to your specs, "The characters { and } must be escaped with a \ to be included in the output as literal characters. Within plural statements, # must also be similarly escaped. "

It seems to me, that you have chosen a very different approach to escaping syntax characters than the official standard, even though this fact is not explicitly mentioned anywhere. Thus, your messages are incompatible with the messages written using the standard syntax, making e. g. reusing messages from a webapp java backend (validation messages etc.) and javascript frontend impossible, is that correct? Is there perhaps a toggle to make your messageformat process the messages according to the official standard? Or, perhaps, is there some js conversion function that would take the standard formatted message and turn it into message suitable for processing by your implementation?

I know that the original apostrophe escaping was a stupid decision, but it's a standard nonetheless. I hope there's a way to make your promising looking library work with the standard format.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions