Kexin Li
Kexin Li

Reputation: 228

what is `__()` (double underscore) function in hexo?

I'm learning to build a hexo theme recently, but I am confused about __() function. I didn't find answer in hexo doc. I have no idea this is in-built or what?

this code is from theme-minos:

<span class="column is-narrow">
  <% let words = word_count(post._content); %>
  <% let time = duration((words / 150.0) * 60, 'seconds') %>
  <%= `${ time.humanize() } ${ __('article.read')} (${ __('article.about') } ${ words } ${ __('article.words') })` %>
</span>

Can anyone can help me?

Upvotes: 3

Views: 212

Answers (1)

Kexin Li
Kexin Li

Reputation: 228

Finally I find answer in hexo document.

Use __ or _p helpers in templates to get the translated strings. The former is for normal usage and the latter is for plural strings.

see more: https://hexo.io/docs/internationalization.html

Upvotes: 5

Related Questions