Skip to content

Instantly share code, notes, and snippets.

@bodrovis
Created November 26, 2019 15:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bodrovis/b1fc1495b604694107467fc3603dda7d to your computer and use it in GitHub Desktop.
Save bodrovis/b1fc1495b604694107467fc3603dda7d to your computer and use it in GitHub Desktop.
jQuery(document).ready(function() {
var polyglot = new Polyglot({
phrases: {
"hello": "Hello, %{name}!",
"unread": "You have %{smart_count} unread message |||| You have %{smart_count} unread messages"
}
});
var main_content_temp = _.template($('#main-content').html());
$('body').prepend(main_content_temp({
hello: polyglot.t('hello', {name: 'John'}),
unread: polyglot.t('unread', {smart_count: 2})
}));
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment