internationalization - 如何使用 Hugo 和 NetlifyCMS 管理国际化
问题描述
我正在使用 NetlifyCMS 集成(GitLab 作为后端)在 Hugo 网站上工作。我想知道我有哪些选项可以允许从 NetlifyCMS 管理面板中修改 Hugo 使用的国际化文件(i18n/en.yaml
、、 ...)。i18n/fr.yaml
只需为每个页面创建一个单独的集合并在同一集合下添加一个页面的每个语言版本,就可以轻松修改内容文件的翻译(_index.md
、_index.fr.md
、 ...)。
我应该如何处理 i18n 文件与 NetlifyCMS 的集成?https://gohugo.io/content-management/multilingual/#translation-of-strings
解决方案
File Collection
在您config.yml
的文件中创建一个i18n
文件,其中每种语言都有一个文件。
- name: Language
label: language
delete: false
files:
- name: english
file: 'i18n/en.yaml'
label: English
fields:
- widget: object
name: home
label: Home
fields:
- {widget: string, name: other, label: Other, required: true}
- widget: object
name: title
label: 'Site Title'
fields:
- {widget: string, name: other, label: Other, required: true}
- name: french
file: 'i18n/fr.yaml'
label: French
fields:
- widget: object
name: home
label: Home
fields:
- {widget: string, name: other, label: Other, required: true}
- widget: object
name: title
label: 'Site Title'
fields:
- {widget: string, name: other, label: Other, required: true}
推荐阅读
- git - 在开发和主控之间执行壁球合并时如何解决文件冲突
- c# - Linq - 如何从匿名类型中区分多个字段
- android - 当最后一个字符位于edittext中间时,android将文本向左滚动
- swift - 白天在 Apple Watch 上记录条目并稍后显示
- javascript - 在自定义弹出窗口中暂停 Vimeo 视频
- swift - 如何从 StackView 内的 UITextfield 获取文本
- c# - C#如何根据从代码创建的前一个面板的位置创建一个面板?
- python - 如何通过用户名获取 ID - Twitter API Python
- sql - 如何在没有超时的情况下锁定 Ibm Db2 中的更新行?
- shell - 传递可能包含通配符作为参数的变量