Replies: 1 comment 2 replies
-
Why would you have empty |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi friends, I noticed if you put an empty string as the default message in formatMessage, it thinks there is no default message so it displays the id instead.
I don't really understand how format js works enough to fix it myself but i think i found the problem here
if (!msg.defaultMessage && !msg.id) {
return;
}
if (msg.defaultMessage) {
msg.defaultMessage = msg.defaultMessage.trim().replace(/\s+/gm, ' ');
}
maybe you could change it to something like
if(typeof msg.defaultMessage === "string")
here's the link to where i found this code
formatjs/packages/ts-transformer/src/transform.ts
Line 305 in 099fd8c
p.s. i know you can also put a blank space for an empty message but i didn't know that at the time and it took me a while to figure it out so i think this might make it easier for other people that are new to formatjs
Beta Was this translation helpful? Give feedback.
All reactions