-
-
Save pierr/8740de8ec67bcd2b0244aec966245467 to your computer and use it in GitHub Desktop.
This file contains hidden or 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