Implement multi-language email templates

- Add language columns to email_templates table (subject_en/de, body_html_en/de, body_text_en/de)
- Update adminEmail.js routes to support language-specific templates
- Create EmailProcessor service to handle language selection based on recipient
- Update EmailConfigPage component with language tabs similar to CMS pages
- Add German translations for all email templates
- Update all email queue usage to use proper template keys
- Add missing email templates (gallery_expired, archive_complete)
- Integrate email processor service into main server startup

The system now automatically selects the appropriate language (English/German) based on the recipient's email domain or preferences.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
2025-07-08 17:57:26 +02:00
parent 1bc9b547c7
commit 69b56ed582
13 changed files with 564 additions and 102 deletions
+11 -5
View File
@@ -13,9 +13,15 @@ export interface EmailConfig {
export interface EmailTemplate {
id: number;
template_key: string;
subject: string;
body_html: string;
body_text?: string;
subject: string; // For backward compatibility
body_html: string; // For backward compatibility
body_text?: string; // For backward compatibility
subject_en: string;
subject_de: string;
body_html_en: string;
body_html_de: string;
body_text_en?: string;
body_text_de?: string;
variables: string[];
updated_at: string;
}
@@ -61,10 +67,10 @@ export const emailService = {
},
// Preview email template
async previewTemplate(key: string, previewData: Record<string, string>): Promise<EmailPreview> {
async previewTemplate(key: string, previewData: Record<string, string>, language: 'en' | 'de' = 'en'): Promise<EmailPreview> {
const response = await api.post<EmailPreview>(
`/api/admin/email/templates/${key}/preview`,
{ preview_data: previewData }
{ preview_data: previewData, language }
);
return response.data;
}