feat: localize admin field labels and tighten forms
This commit is contained in:
@@ -4,10 +4,16 @@ import { getDocLocaleDefault, resolveDocLocale, syncDocLocaleWithRequestLocale }
|
||||
|
||||
const statusField = {
|
||||
name: 'status',
|
||||
label: { en: 'Status', zh: '状态' },
|
||||
type: 'select' as const,
|
||||
localized: true,
|
||||
defaultValue: 'draft',
|
||||
options: ['draft', 'review', 'published', 'archived'],
|
||||
options: [
|
||||
{ label: 'Draft / 草稿', value: 'draft' },
|
||||
{ label: 'Review / 待审核', value: 'review' },
|
||||
{ label: 'Published / 已发布', value: 'published' },
|
||||
{ label: 'Archived / 已归档', value: 'archived' },
|
||||
],
|
||||
required: true,
|
||||
}
|
||||
|
||||
@@ -39,40 +45,49 @@ export const Downloads: CollectionConfig = {
|
||||
fields: [
|
||||
{
|
||||
name: 'docLocale',
|
||||
label: { en: 'Doc Locale', zh: '文档语言' },
|
||||
type: 'select',
|
||||
required: true,
|
||||
defaultValue: getDocLocaleDefault,
|
||||
options: [
|
||||
{ label: 'English Doc', value: 'en' },
|
||||
{ label: '中文 Doc', value: 'zh' },
|
||||
{ label: 'English / 英文', value: 'en' },
|
||||
{ label: '简体中文', value: 'zh' },
|
||||
],
|
||||
admin: {
|
||||
position: 'sidebar',
|
||||
description: 'Independent document language for this download entry.',
|
||||
},
|
||||
},
|
||||
{ name: 'title', type: 'text', required: true, localized: true },
|
||||
{ name: 'title', label: { en: 'Title', zh: '标题' }, type: 'text', required: true, localized: true },
|
||||
{
|
||||
name: 'type',
|
||||
label: { en: 'Type', zh: '分类' },
|
||||
type: 'select',
|
||||
localized: true,
|
||||
required: true,
|
||||
options: ['firmware', 'manual', 'software', 'other'],
|
||||
options: [
|
||||
{ label: 'Firmware / 固件', value: 'firmware' },
|
||||
{ label: 'Manual / 说明书', value: 'manual' },
|
||||
{ label: 'Software / 软件', value: 'software' },
|
||||
{ label: 'Other / 其他', value: 'other' },
|
||||
],
|
||||
},
|
||||
{ name: 'product', type: 'relationship', relationTo: 'products', required: true },
|
||||
{ name: 'version', type: 'text', localized: true },
|
||||
{ name: 'releaseDate', type: 'date', localized: true },
|
||||
{ name: 'file', type: 'upload', relationTo: 'files', localized: true },
|
||||
{ name: 'checksum', type: 'text', localized: true },
|
||||
{ name: 'changelog', type: 'richText', localized: true },
|
||||
{ name: 'notes', type: 'richText', localized: true },
|
||||
{ name: 'product', label: { en: 'Product', zh: '关联产品' }, type: 'relationship', relationTo: 'products', required: true },
|
||||
{ name: 'version', label: { en: 'Version', zh: '版本号' }, type: 'text', localized: true },
|
||||
{ name: 'releaseDate', label: { en: 'Release Date', zh: '发布日期' }, type: 'date', localized: true },
|
||||
{ name: 'file', label: { en: 'File', zh: '安装包/文件' }, type: 'upload', relationTo: 'files', localized: true },
|
||||
{ name: 'checksum', label: { en: 'Checksum', zh: '校验值' }, type: 'text', localized: true },
|
||||
{ name: 'changelog', label: { en: 'Changelog', zh: '更新日志' }, type: 'richText', localized: true },
|
||||
{ name: 'notes', label: { en: 'Notes', zh: '附加说明' }, type: 'richText', localized: true },
|
||||
{
|
||||
name: 'visibility',
|
||||
label: { en: 'Visibility', zh: '显示设置' },
|
||||
type: 'group',
|
||||
localized: true,
|
||||
fields: [
|
||||
{
|
||||
name: 'showInDownloadsCenter',
|
||||
label: { en: 'Show in Downloads Center', zh: '在下载中心显示' },
|
||||
type: 'checkbox',
|
||||
defaultValue: true,
|
||||
admin: {
|
||||
|
||||
Reference in New Issue
Block a user