【发布时间】:2020-10-12 06:56:54
【问题描述】:
我正在尝试翻译 Hugo 中的标签。
我的标签只在我的帖子的元数据中声明:
---
author: arthur.sw
date: 2007-01-01T00:00:35Z
tags:
- experiment
- reflection
---
... post content ...
我将它们翻译成我的语言文件:
/i18n/en.toml:
[Experiment]
one = "Experiment"
other = "Experiments"
[Reflection]
one = "Reflection"
other = "Reflections"
/i18n/fr.toml:
[Experiment]
one = "Expérience"
other = "Expériences"
[Reflection]
one = "Réflexion"
other = "Réflexions"
但无论我是否使用大写字母,它都不会翻译标签。
我也试过修改我的layouts/_default/list.html:
[...]
<h1 class='title'>
{{- if eq .Kind "taxonomy" -}}
<span class='taxonomy-type'>
{{- ( ( i18n .Data.Singular 1 ) | default .Data.Singular ) | title -}}
{{- print ": " -}}
</span>
{{- end -}}
{{- i18n .Title -}}
</h1>
[...]
(我在.Title 之前添加了i18n 来翻译分类名称)但这也不起作用。
如何翻译标签?
【问题讨论】:
标签: internationalization taxonomy hugo