feat: add core i18n runtime and catalogs

This commit is contained in:
poyrazavsever
2026-07-19 03:06:38 +03:00
parent 0548820584
commit f4a2342ac4
12 changed files with 776 additions and 0 deletions
+50
View File
@@ -0,0 +1,50 @@
export type ContentTranslationFieldKind = "text" | "textarea";
export type ContentTranslationEntityType =
| "branding"
| "calendar_event"
| "client"
| "planning_section"
| "project"
| "task";
export type ContentTranslationField = {
name: string;
label: string;
kind?: ContentTranslationFieldKind;
required?: boolean;
maxLength?: number;
placeholder?: string;
};
export type ContentTranslationInput = Record<string, Record<string, string | null>>;
export const contentTranslationRegistry = {
project: [
{ name: "name", label: "Proje adı", required: true, maxLength: 200, placeholder: "Örn. Marka web sitesi" },
{ name: "description", label: "Açıklama", kind: "textarea", maxLength: 20_000, placeholder: "Kapsam, hedef veya teslimat notları..." },
{ name: "coverImageAlt", label: "Görsel alt metni", maxLength: 500, placeholder: "Görseli kısaca açıkla" },
],
planning_section: [
{ name: "title", label: "Başlık", required: true, maxLength: 300, placeholder: "Örn. Başarı kriterleri" },
{ name: "content", label: "İçerik", kind: "textarea", maxLength: 50_000, placeholder: "Kısa notlar, kriterler, renkler, tipografi kararları..." },
],
task: [
{ name: "title", label: "Başlık", required: true, maxLength: 300, placeholder: "Örn. Ana sayfa wireframe revizyonu" },
{ name: "description", label: "Açıklama", kind: "textarea", maxLength: 20_000, placeholder: "Kapsam, not veya teslim kriterleri..." },
],
branding: [
{ name: "portalWelcome", label: "Portal karşılama metni", kind: "textarea", maxLength: 10_000 },
{ name: "portalFooter", label: "Portal footer metni", kind: "textarea", maxLength: 5_000 },
],
calendar_event: [
{ name: "title", label: "Başlık", required: true, maxLength: 300 },
{ name: "description", label: "Açıklama", kind: "textarea", maxLength: 20_000 },
],
client: [
{ name: "notes", label: "Notlar", kind: "textarea", maxLength: 10_000 },
],
} satisfies Record<ContentTranslationEntityType, ContentTranslationField[]>;
export function contentInputName(locale: string, field: string) {
return `i18n.${locale}.${field}`;
}