英文:
Starting with Go Templates, what does the T indicate in {{T "post_nav_prev"}}
问题
我正在尝试理解Hugo中的Go模板。我发现了这个语法结构{{T "post_nav_prev"}}。我在i18n yaml文件en.yaml中找到了post_nav_prev的定义,但是找不到T是什么或者它在哪里定义的。对于基础知识的欠缺,我感到抱歉。感谢任何指导。
英文:
Trying to understand Go templates in Hugo. I find the subject construct {{T "post_nav_prev"}}. I see post_nav_prev defined in i18n yaml file en.yaml, but can't seem to find what T is or where it is defined. Sorry for the lack of basic knowledge. Thanks for any guidance.
答案1
得分: 3
T
是 lang.Translate
的别名。
来源:https://gohugo.io/functions/lang/#langtranslate
它在这里定义:https://github.com/gohugoio/hugo/blob/e164834f0aaaf1c58489fab41f5835b66f16b87c/tpl/lang/init.go#L33
英文:
T
is an alias for lang.Translate
source : https://gohugo.io/functions/lang/#langtranslate
It define here
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论