Skip to content

Instantly share code, notes, and snippets.

@lelandrichardson
Last active March 25, 2017 18:44
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lelandrichardson/fa137fcfb519bce144956a2380fc1adb to your computer and use it in GitHub Desktop.
Save lelandrichardson/fa137fcfb519bce144956a2380fc1adb to your computer and use it in GitHub Desktop.
function t(strings, ...values) {
const string = strings.reduce((s, next, i) => `${s}%{${i}}${next}`);
return new IntlMessageFormat(string, 'en-us').format(values);
}
const person = 'Mike';
const age = 28;
console.log(t`${person} is age ${age}`);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment