Created
March 25, 2017 06:00
-
-
Save ryanflorence/f9e501c62d4ed25009f8c3985cfe7b01 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const IntlMessageFormat = require('intl-messageformat') | |
function t(strings, values) { | |
const string = strings[0].trim() | |
var msg = new IntlMessageFormat(string, 'en-US') | |
return msg.format(values) | |
} | |
const person = 'Mike' | |
const age = 28 | |
console.log( | |
t`{person} is age {age} ${{ person, age }}` | |
) | |
console.log( | |
t`{0} is age {1} with an array ${[ person, age ]}` | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment