Support Message with Brace
In ICU standard, brace in message is treated as variable. An object is supposed to be passed as second parameter in the intl.get("key", object)
function. Otherwise, react-intl-universal
could not format the message, resulting in returning empty string.
// en-US.js
module.exports = ({
"BRACE": "The format is {var}",
});
intl.get("BRACE"); // Before this release, it return empty string ""
However, in some case, brace is just a part of the sentence. It's better to be return the original message instead of empty string. This release fixes this issue. Here is the result:
intl.get("BRACE"); // "The format is {var}"
intl.get("BRACE", {var: "x.y.z"}); // "The format is x.y.z"