hexo 中的`__()`(双下划线)函数是什么?
what is `__()` (double underscore) function in hexo?
最近在学习搭建hexo主题,但是对__()
功能比较迷茫。我没有在 hexo doc 中找到答案。我不知道这是内置的还是什么?
此代码来自 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>
谁能帮帮我?
终于在hexo文档中找到了答案
Use __
or _p
helpers in templates to get the translated strings. The former is for normal usage and the latter is for plural strings.
最近在学习搭建hexo主题,但是对__()
功能比较迷茫。我没有在 hexo doc 中找到答案。我不知道这是内置的还是什么?
此代码来自 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>
谁能帮帮我?
终于在hexo文档中找到了答案
Use
__
or_p
helpers in templates to get the translated strings. The former is for normal usage and the latter is for plural strings.