fix: days of the week in different language in the workflow (#17850)
* fix: days of the week in different language in the workflow * Update
This commit is contained in:
@@ -240,6 +240,7 @@ async function handler(req: NextApiRequest, res: NextApiResponse) {
|
||||
} else if (reminder.workflowStep.template === WorkflowTemplates.REMINDER) {
|
||||
emailContent = emailReminderTemplate(
|
||||
false,
|
||||
reminder.booking.user?.locale || "en",
|
||||
reminder.workflowStep.action,
|
||||
getTimeFormatStringFromUserTimeFormat(reminder.booking.user?.timeFormat),
|
||||
reminder.booking.startTime.toISOString() || "",
|
||||
@@ -366,6 +367,7 @@ async function handler(req: NextApiRequest, res: NextApiResponse) {
|
||||
|
||||
emailContent = emailReminderTemplate(
|
||||
false,
|
||||
reminder.booking.user?.locale || "en",
|
||||
WorkflowActions.EMAIL_ATTENDEE,
|
||||
getTimeFormatStringFromUserTimeFormat(reminder.booking.user?.timeFormat),
|
||||
reminder.booking.startTime.toISOString() || "",
|
||||
|
||||
@@ -81,7 +81,7 @@ const getTimeSectionText = (trigger: WorkflowTriggerEvents, t: TFunction) => {
|
||||
};
|
||||
|
||||
export default function WorkflowStepContainer(props: WorkflowStepProps) {
|
||||
const { t } = useLocale();
|
||||
const { t, i18n } = useLocale();
|
||||
const utils = trpc.useUtils();
|
||||
|
||||
const { step, form, reload, setReload, teamId } = props;
|
||||
@@ -145,13 +145,14 @@ export default function WorkflowStepContainer(props: WorkflowStepProps) {
|
||||
whatsappReminderTemplate(true, action, timeFormat)
|
||||
);
|
||||
} else {
|
||||
const reminderBodyTemplate = emailReminderTemplate(true, action, timeFormat).emailBody;
|
||||
const reminderBodyTemplate = emailReminderTemplate(true, i18n.language, action, timeFormat).emailBody;
|
||||
form.setValue(`steps.${step.stepNumber - 1}.reminderBody`, reminderBodyTemplate);
|
||||
}
|
||||
}
|
||||
if (!form.getValues(`steps.${step.stepNumber - 1}.emailSubject`)) {
|
||||
const subjectTemplate = emailReminderTemplate(
|
||||
true,
|
||||
i18n.language,
|
||||
form.getValues(`steps.${step.stepNumber - 1}.action`),
|
||||
timeFormat
|
||||
).emailSubject;
|
||||
@@ -525,6 +526,7 @@ export default function WorkflowStepContainer(props: WorkflowStepProps) {
|
||||
} else {
|
||||
const emailReminderBody = emailReminderTemplate(
|
||||
true,
|
||||
i18n.language,
|
||||
val.value,
|
||||
timeFormat
|
||||
);
|
||||
@@ -832,11 +834,11 @@ export default function WorkflowStepContainer(props: WorkflowStepProps) {
|
||||
} else {
|
||||
form.setValue(
|
||||
`steps.${step.stepNumber - 1}.reminderBody`,
|
||||
emailReminderTemplate(true, action, timeFormat).emailBody
|
||||
emailReminderTemplate(true, i18n.language, action, timeFormat).emailBody
|
||||
);
|
||||
form.setValue(
|
||||
`steps.${step.stepNumber - 1}.emailSubject`,
|
||||
emailReminderTemplate(true, action, timeFormat).emailSubject
|
||||
emailReminderTemplate(true, i18n.language, action, timeFormat).emailSubject
|
||||
);
|
||||
}
|
||||
} else if (val.value === WorkflowTemplates.RATING) {
|
||||
|
||||
@@ -185,6 +185,7 @@ export const scheduleEmailReminder = async (args: scheduleEmailReminderArgs) =>
|
||||
} else if (template === WorkflowTemplates.REMINDER) {
|
||||
emailContent = emailReminderTemplate(
|
||||
false,
|
||||
evt.organizer.language.locale,
|
||||
action,
|
||||
evt.organizer.timeFormat,
|
||||
startTime,
|
||||
|
||||
@@ -5,6 +5,7 @@ import { WorkflowActions } from "@calcom/prisma/enums";
|
||||
|
||||
const emailReminderTemplate = (
|
||||
isEditingMode: boolean,
|
||||
locale: string,
|
||||
action?: WorkflowActions,
|
||||
timeFormat?: TimeFormat,
|
||||
startTime?: string,
|
||||
@@ -28,9 +29,9 @@ const emailReminderTemplate = (
|
||||
name = action === WorkflowActions.EMAIL_ATTENDEE ? "{ATTENDEE}" : "{ORGANIZER}";
|
||||
eventDate = `{EVENT_DATE_${dateTimeFormat}}`;
|
||||
} else {
|
||||
eventDate = dayjs(startTime).tz(timeZone).format(dateTimeFormat);
|
||||
eventDate = dayjs(startTime).tz(timeZone).locale(locale).format(dateTimeFormat);
|
||||
|
||||
endTime = dayjs(endTime).tz(timeZone).format(currentTimeFormat);
|
||||
endTime = dayjs(endTime).tz(timeZone).locale(locale).format(currentTimeFormat);
|
||||
}
|
||||
|
||||
const emailSubject = `Reminder: ${eventName} - ${eventDate}`;
|
||||
|
||||
@@ -68,6 +68,7 @@ export const createHandler = async ({ ctx, input }: CreateOptions) => {
|
||||
|
||||
const renderedEmailTemplate = emailReminderTemplate(
|
||||
true,
|
||||
ctx.user.locale,
|
||||
WorkflowActions.EMAIL_ATTENDEE,
|
||||
getTimeFormatStringFromUserTimeFormat(ctx.user.timeFormat)
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user