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,28 +45,29 @@ export const ProductReviews: 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 review entry.',
|
||||
},
|
||||
},
|
||||
{ name: 'title', type: 'text', localized: true, required: true },
|
||||
{ name: 'product', type: 'relationship', relationTo: 'products', required: true },
|
||||
{ name: 'sourceName', type: 'text', localized: true },
|
||||
{ name: 'reviewUrl', type: 'text', required: true, localized: true },
|
||||
{ name: 'thumbnail', type: 'upload', relationTo: 'media', localized: true },
|
||||
{ name: 'excerpt', type: 'textarea', localized: true },
|
||||
{ name: 'quote', type: 'textarea', localized: true },
|
||||
{ name: 'publishedAt', type: 'date', localized: true },
|
||||
{ name: 'sortOrder', type: 'number', defaultValue: 0, localized: true },
|
||||
{ name: 'legacySourceUrl', type: 'text', localized: true },
|
||||
{ name: 'title', label: { en: 'Title', zh: '标题' }, type: 'text', localized: true, required: true },
|
||||
{ name: 'product', label: { en: 'Product', zh: '关联产品' }, type: 'relationship', relationTo: 'products', required: true },
|
||||
{ name: 'sourceName', label: { en: 'Source Name', zh: '来源名称' }, type: 'text', localized: true },
|
||||
{ name: 'reviewUrl', label: { en: 'Review URL', zh: '评测链接' }, type: 'text', required: true, localized: true },
|
||||
{ name: 'thumbnail', label: { en: 'Thumbnail', zh: '缩略图' }, type: 'upload', relationTo: 'media', localized: true },
|
||||
{ name: 'excerpt', label: { en: 'Excerpt', zh: '摘要' }, type: 'textarea', localized: true },
|
||||
{ name: 'quote', label: { en: 'Quote', zh: '引用语' }, type: 'textarea', localized: true },
|
||||
{ name: 'publishedAt', label: { en: 'Published At', zh: '发布时间' }, type: 'date', localized: true },
|
||||
{ name: 'sortOrder', label: { en: 'Sort Order', zh: '排序' }, type: 'number', defaultValue: 0, localized: true },
|
||||
{ name: 'legacySourceUrl', label: { en: 'Legacy Source URL', zh: '旧站来源链接' }, type: 'text', localized: true },
|
||||
statusField,
|
||||
],
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user