feat(i18n): add multi-language support (en/zh) across app and server

Implement useLocale composable and shared translation dictionaries
Translate public pages, booking flow, and receipt views
Store booking locale to send localized WhatsApp notifications
This commit is contained in:
2026-05-08 15:31:44 +08:00
parent b05cfd2c0e
commit 1318e766d5
14 changed files with 789 additions and 209 deletions

View File

@@ -26,6 +26,24 @@ export function buildWhatsAppDeepLink(phoneNumber: string, message: string) {
export function buildBookingTicketReceiptMessage(event: H3Event, booking: PublicBooking) {
const receiptUrl = buildAppUrl(event, `/receipt/${booking.receiptToken}`)
if (booking.locale === 'zh') {
return [
booking.event.title,
'',
`${booking.customerName} 您好,您的票券收据已确认。`,
'',
`收据:${receiptUrl}`,
`座位:${booking.seatCount}`,
`票券类别:${booking.ticketLabel || booking.ticketType.toUpperCase()}`,
`总价:${formatBookingCurrency(booking.totalPrice, booking.locale)}`,
`日期:${booking.event.dateLabel}`,
`时间:${booking.event.timeLabel}`,
`地点:${booking.event.venue}`,
'',
'请在活动当天出示收据中的二维码。'
].join('\n')
}
return [
booking.event.title,
'',
@@ -34,7 +52,7 @@ export function buildBookingTicketReceiptMessage(event: H3Event, booking: Public
`Receipt: ${receiptUrl}`,
`Seats: ${booking.seatCount}`,
`Ticket Category: ${booking.ticketLabel || booking.ticketType.toUpperCase()}`,
`Total Price: ${formatBookingCurrency(booking.totalPrice)}`,
`Total Price: ${formatBookingCurrency(booking.totalPrice, booking.locale)}`,
`Date: ${booking.event.dateLabel}`,
`Time: ${booking.event.timeLabel}`,
`Venue: ${booking.event.venue}`,