Skip to content

Commit

Permalink
feat: translate field labels via Hugo i18n
Browse files Browse the repository at this point in the history
  • Loading branch information
razonyang committed Jan 16, 2024
1 parent 8f948df commit 53dda1d
Show file tree
Hide file tree
Showing 4 changed files with 116 additions and 0 deletions.
38 changes: 38 additions & 0 deletions i18n/en.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
[cms_field_label_body]
other = "Body"

[cms_field_label_categories]
other = "Categories"

[cms_field_label_date]
other = "Date"

[cms_field_label_description]
other = "Description"

[cms_field_label_draft]
other = "Draft"

[cms_field_label_images]
other = "Images"

[cms_field_label_keywords]
other = "Keywords"

[cms_field_label_layout]
other = "Layout"

[cms_field_label_series]
other = "Series"

[cms_field_label_slug]
other = "Slug"

[cms_field_label_tags]
other = "Tags"

[cms_field_label_title]
other = "Title"

[cms_field_label_type]
other = "Type"
38 changes: 38 additions & 0 deletions i18n/zh-hans.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
[cms_field_label_body]
other = "正文"

[cms_field_label_categories]
other = "分类"

[cms_field_label_date]
other = "日期"

[cms_field_label_description]
other = "描述"

[cms_field_label_draft]
other = "草稿"

[cms_field_label_images]
other = "图片"

[cms_field_label_keywords]
other = "关键词"

[cms_field_label_layout]
other = "布局"

[cms_field_label_series]
other = "专栏"

[cms_field_label_slug]
other = "Slug"

[cms_field_label_tags]
other = "标签"

[cms_field_label_title]
other = "标题"

[cms_field_label_type]
other = "类型"
38 changes: 38 additions & 0 deletions i18n/zh-hant.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
[cms_field_label_body]
other = "正文"

[cms_field_label_categories]
other = "分類"

[cms_field_label_date]
other = "日期"

[cms_field_label_description]
other = "描述"

[cms_field_label_draft]
other = "草稿"

[cms_field_label_images]
other = "圖片"

[cms_field_label_keywords]
other = "關鍵詞"

[cms_field_label_layout]
other = "佈局"

[cms_field_label_series]
other = "專欄"

[cms_field_label_slug]
other = "Slug"

[cms_field_label_tags]
other = "標籤"

[cms_field_label_title]
other = "標題"

[cms_field_label_type]
other = "類型"
2 changes: 2 additions & 0 deletions layouts/partials/decap-cms/functions/config.html
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,8 @@
{{- $tmp := newScratch }}
{{- $tmp.Set "field" . }}
{{- $tmp.DeleteInMap "field" "_weight" }}
{{- $label := default .label (printf "cms_field_label_%s" (replace (lower .label) " " "-") | i18n) }}
{{- $tmp.SetInMap "field" "label" $label }}
{{- $collection.Add "fields" (slice ($tmp.Get "field")) }}
{{- end }}
{{- end -}}
Expand Down

0 comments on commit 53dda1d

Please sign in to comment.