Skip to content

Access the translations within a helper function #5190

Discussion options

You must be logged in to vote

Use this.__. For example:

hexo.extend.helper.register('post_edit', function(src) {
  const { post_edit } = this.theme;
  if (!post_edit.enable) return '';
  return this.next_url(post_edit.url + src, '<i class="fa fa-pen-nib"></i>', {
    class: 'post-edit-link',
    title: this.__('post.edit')
  });
});

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@lorezyra
Comment options

@lorezyra
Comment options

Answer selected by lorezyra
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants