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

Cannot escape pattern in curly braces with single quotes #837

Open
mylonasartist opened this issue Jul 18, 2018 · 1 comment
Open

Cannot escape pattern in curly braces with single quotes #837

mylonasartist opened this issue Jul 18, 2018 · 1 comment

Comments

@mylonasartist
Copy link

Hello, thank you for this package.
Could you please check if this is a bug.
I am trying to escape a message pattern argument using single quotes. The argument is defined as index in curly braces.
The problem is I have no luck to obtain the message that contains the unchanged pattern.
Short code:
...
`Globalize.loadMessages({
en: {
escaped: "Escaped '{0}'"
}
});

Globalize.locale( "en" );

var escaped = Globalize.messageFormatter( "escaped" );

console.log( escaped() ); // here "Escaped {0}" is expected, but got "Cannot read property '0' of undefined"
`
...
Output with error:
return function(d) { return "Escaped '" + d["0"] + "'"; }
^

TypeError: Cannot read property '0' of undefined
at eval (eval at MessageFormat.compile (D:\skre\projects\JavaScript\Globalize\EscapeTest\node_modules\globalize\dist\globalize\message.js:1820:13), :3:44)

Thank you.

@rxaviers
Copy link
Member

We should update Globalize to use a newer messageformat version.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants