kaneo (minimalist kanban) fork to experiment adding a tangled integration github.com/usekaneo/kaneo
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

feat(email): localize workspace invitation template

Tin f6bec303 d2339ffe

+53 -9
+53 -9
packages/email/src/templates/workspace-invitation.tsx
··· 10 10 inviterEmail: string; 11 11 invitationLink: string; 12 12 to: string; 13 + locale?: string | null; 13 14 }; 14 15 16 + const messages = { 17 + en: { 18 + preview: "You're invited to {{workspaceName}} on Kaneo", 19 + title: "Join {{workspaceName}}", 20 + subtitle: 21 + "{{inviterName}} ({{inviterEmail}}) invited you to collaborate in Kaneo.", 22 + cta: "Accept invitation", 23 + sameEmail: "You can accept with the same email that received this message.", 24 + ignore: "If this wasn't expected, you can safely ignore this email.", 25 + footer: "Kaneo workspace invitation", 26 + }, 27 + de: { 28 + preview: "Du wurdest zu {{workspaceName}} auf Kaneo eingeladen", 29 + title: "{{workspaceName}} beitreten", 30 + subtitle: 31 + "{{inviterName}} ({{inviterEmail}}) hat dich eingeladen, in Kaneo zusammenzuarbeiten.", 32 + cta: "Einladung annehmen", 33 + sameEmail: 34 + "Du kannst die Einladung mit derselben E-Mail-Adresse annehmen, die diese Nachricht erhalten hat.", 35 + ignore: 36 + "Falls du damit nicht gerechnet hast, kannst du diese E-Mail einfach ignorieren.", 37 + footer: "Kaneo Workspace-Einladung", 38 + }, 39 + } as const; 40 + 41 + function interpolate( 42 + template: string, 43 + values: Record<string, string>, 44 + ) { 45 + return template.replace(/\{\{(\w+)\}\}/g, (_match, key: string) => { 46 + return values[key] ?? ""; 47 + }); 48 + } 49 + 15 50 const WorkspaceInvitationEmail = ({ 16 51 workspaceName, 17 52 inviterName, 18 53 inviterEmail, 19 54 invitationLink, 20 55 to, 56 + locale, 21 57 }: WorkspaceInvitationEmailProps) => ( 22 - <EmailShell 23 - preview={`You're invited to ${workspaceName} on Kaneo`} 24 - title={`Join ${workspaceName}`} 25 - subtitle={`${inviterName} (${inviterEmail}) invited you to collaborate in Kaneo.`} 26 - > 58 + (() => { 59 + const localeKey = locale?.toLowerCase().startsWith("de") ? "de" : "en"; 60 + const copy = messages[localeKey]; 61 + const values = { workspaceName, inviterName, inviterEmail }; 62 + 63 + return ( 64 + <EmailShell 65 + preview={interpolate(copy.preview, values)} 66 + title={interpolate(copy.title, values)} 67 + subtitle={interpolate(copy.subtitle, values)} 68 + > 27 69 <Section> 28 70 <Link style={styles.button} href={`${invitationLink}?email=${to}`}> 29 - Accept invitation 71 + {copy.cta} 30 72 </Link> 31 73 <Text style={styles.paragraph}> 32 - You can accept with the same email that received this message. 74 + {copy.sameEmail} 33 75 </Text> 34 76 <Text style={styles.muted}> 35 - If this wasn't expected, you can safely ignore this email. 77 + {copy.ignore} 36 78 </Text> 37 79 <Section style={styles.divider} /> 38 - <Text style={styles.footer}>Kaneo workspace invitation</Text> 80 + <Text style={styles.footer}>{copy.footer}</Text> 39 81 </Section> 40 82 </EmailShell> 83 + ); 84 + })() 41 85 ); 42 86 43 87 WorkspaceInvitationEmail.PreviewProps = {