decaporg / decaporg/decap-cms

Allow setting locale in frontmatter

Open
#5,969 1 comment 1 reaction 0 assignees View on GitHub
area: i18n type: feature
Dominant language
JavaScript
Stars
19.4k
Forks
3.1k
Avg merge
1d 14h
Merged PRs (30d)
9

Description

**Is your feature request related to a problem? Please describe.**
I am using astro's dynamic routing to build up my urls, and it would be really nice if I could add a hidden `locale` field to my collection so that it appears in the frontmatter. As it stands, it seems the only way to determine a file's locale is from the path/filename, unless I'm missing another option.

**Describe the solution you'd like**
Ideally, this would be as easy as adding a field like `{ name: "locale", label: "Locale", widget: "hidden", default: "{{locale}}", i18n: true},`

**Describe alternatives you've considered**
I tried to create a `preSave` handler, but it seems to only run once per entry, and expects `data` to be returned, not the i18n map which contains the data for the localized versions.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.