Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save jsdevjournal/c5cc713ff172d9e52b3458c164e505f1 to your computer and use it in GitHub Desktop.
Save jsdevjournal/c5cc713ff172d9e52b3458c164e505f1 to your computer and use it in GitHub Desktop.
formattedMessage
export function formattedMessage(translation, object) {
let text = `${translation}`
Object.keys(object).forEach(key =>
text = text.replace(`{${key}}`, object[key])
)
return text
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment