Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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?

like image 485
Kexin Li Avatar asked Feb 18 '26 23:02

Kexin Li


1 Answers

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

like image 150
Kexin Li Avatar answered Feb 20 '26 11:02

Kexin Li



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!