Enhancement: Ability to define which fields need translation #778

Closed
opened 2026-10-05 03:05:01 +02:00 by adam · 2 comments
Owner

Currently, frontmatter fields aren’t being translated. I would appreciate it if we could configure which frontmatter fields - such as 'slug' 'summary', 'ogTitle', 'metaTitle' etc. - should be translated.
For example, in Hugo, I have a 'review' archetype with 'pros', 'cons', 'verdict' etc., as frontmatter.

Originally posted by @nachbelichtet in #1054

> Currently, frontmatter fields aren’t being translated. I would appreciate it if we could configure which frontmatter fields - such as 'slug' 'summary', 'ogTitle', 'metaTitle' etc. - should be translated. > For example, in Hugo, I have a 'review' archetype with 'pros', 'cons', 'verdict' etc., as frontmatter. _Originally posted by @nachbelichtet in [#1054](https://github.com/estruyf/vscode-front-matter/issues/1054#issuecomment-5140653011)_ <!-- github-sync-id:5028528608 -->
adam closed this issue 2026-10-05 03:05:01 +02:00
Author
Owner

Thanks for the suggestion @nachbelichtet! I added a translate property which you can set on the fields of your content types.

By default, only the title, description, and the content of your article are sent to the translation service. Any other field now requires translate: true:

{
  "name": "review",
  "fields": [
    { "title": "Title", "name": "title", "type": "string" },
    { "title": "Description", "name": "description", "type": "string" },
    { "title": "Verdict", "name": "verdict", "type": "string", "translate": true },
    { "title": "Pros", "name": "pros", "type": "list", "translate": true },
    { "title": "Cons", "name": "cons", "type": "list", "translate": true }
  ]
}

If you do not want the title or description to be translated, you can set translate: false on those fields.

A couple of details:

  • The property also works on fields nested in a fields field, and on the fields of the field groups used by a block field.
  • When the value is a list, each of the values is translated individually.
  • Field types which do not hold text (boolean, choice, contentRelationship, dataFile, datetime, divider, draft, file, heading, image, json, and number) are never translated.

Documentation: https://beta.frontmatter.codes/docs/content-creation/multilingual#define-the-fields-to-translate

This is available for testing in BETA release: 10.12.306288402

Thanks for the suggestion @nachbelichtet! I added a `translate` property which you can set on the fields of your content types. By default, only the title, description, and the content of your article are sent to the translation service. Any other field now requires `translate: true`: ```json { "name": "review", "fields": [ { "title": "Title", "name": "title", "type": "string" }, { "title": "Description", "name": "description", "type": "string" }, { "title": "Verdict", "name": "verdict", "type": "string", "translate": true }, { "title": "Pros", "name": "pros", "type": "list", "translate": true }, { "title": "Cons", "name": "cons", "type": "list", "translate": true } ] } ``` If you do not want the title or description to be translated, you can set `translate: false` on those fields. A couple of details: - The property also works on fields nested in a `fields` field, and on the fields of the field groups used by a `block` field. - When the value is a list, each of the values is translated individually. - Field types which do not hold text (`boolean`, `choice`, `contentRelationship`, `dataFile`, `datetime`, `divider`, `draft`, `file`, `heading`, `image`, `json`, and `number`) are never translated. Documentation: https://beta.frontmatter.codes/docs/content-creation/multilingual#define-the-fields-to-translate This is available for testing in BETA release: `10.12.306288402` <!-- github-comment-id:5142619299 -->
Author
Owner

Released in version 10.12.0.

Released in version 10.12.0. <!-- github-comment-id:5371145163 -->
Sign in to join this conversation.
No labels
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: adam/vscode-front-matter#778