使用 Hugo,我正在用法语创建一个博客。\n目前我的所有日期都以英语显示(二月),但我希望它们以法语显示(f\xc3\xa9vrier)。\n如何设置语言?
\n我的config.toml看起来像这样:
baseURL = 'http://example.org/'\nlanguageCode = 'fr-FR'\ndefaultContentLanguage = "fr"\ndefaultContentLang = "fr"\ntitle = 'TITLE'\ntheme = "THEME"\n我尝试设置languageCode、defaultContentLanguage和defaultContentLangtofr但没有成功。
我不需要多语言支持,我只需要法语。
\n要使用本地化,您需要使用 Hugo 函数time.Format(它有一个别名dateFormat)。它需要两个参数:
例子:
{{ time.Format "Jan. 2, 2006" .Date }}
或者
{{ dateFormat "Jan. 2, 2006" .Date }}
文档: https: //gohugo.io/functions/dateformat/
该.Format方法(例如{{.Date.Format "Jan. 2, 2006}})不会应用所需的本地化。
| 归档时间: | 
 | 
| 查看次数: | 1875 次 | 
| 最近记录: |