Polish Swedish locale support

This commit is contained in:
Tero Halla-aho 2025-11-27 23:43:22 +02:00
parent 39aae25e81
commit 17832fef46
3 changed files with 10 additions and 3 deletions

View file

@ -202,6 +202,7 @@ export async function POST(req: Request) {
const priceHintPerNightEuros = body.priceHintPerNightEuros !== undefined && body.priceHintPerNightEuros !== null && body.priceHintPerNightEuros !== '' ? Math.round(Number(body.priceHintPerNightEuros)) : null; const priceHintPerNightEuros = body.priceHintPerNightEuros !== undefined && body.priceHintPerNightEuros !== null && body.priceHintPerNightEuros !== '' ? Math.round(Number(body.priceHintPerNightEuros)) : null;
const calendarUrls = normalizeCalendarUrls(body.calendarUrls); const calendarUrls = normalizeCalendarUrls(body.calendarUrls);
const translationsInputRaw = Array.isArray(body.translations) ? body.translations : []; const translationsInputRaw = Array.isArray(body.translations) ? body.translations : [];
type TranslationInput = { locale: string; title: string; description: string; teaser: string | null; slug: string };
const translationsInput = const translationsInput =
translationsInputRaw translationsInputRaw
.map((item: any) => ({ .map((item: any) => ({
@ -332,7 +333,7 @@ export async function POST(req: Request) {
published: status === ListingStatus.PUBLISHED, published: status === ListingStatus.PUBLISHED,
isSample, isSample,
translations: { translations: {
create: translationsInput.map((t) => ({ create: translationsInput.map((t: TranslationInput) => ({
locale: t.locale, locale: t.locale,
slug: t.slug || slug, slug: t.slug || slug,
title: t.title, title: t.title,

View file

@ -357,7 +357,13 @@ export default function NewListingPage() {
</label> </label>
<label style={{ display: 'grid', gap: 6, marginTop: 8 }}> <label style={{ display: 'grid', gap: 6, marginTop: 8 }}>
<span>{t('aiResponseLabel')}</span> <span>{t('aiResponseLabel')}</span>
<textarea value={aiResponse} onChange={(e) => setAiResponse(e.target.value)} rows={6} placeholder="{\"locales\":{\"fi\":{\"title\":\"...\"}}}" style={{ fontFamily: 'monospace' }} /> <textarea
value={aiResponse}
onChange={(e) => setAiResponse(e.target.value)}
rows={6}
placeholder='{"locales":{"fi":{"title":"..."}}}'
style={{ fontFamily: 'monospace' }}
/>
</label> </label>
<div style={{ display: 'flex', gap: 10, marginTop: 8, flexWrap: 'wrap' }}> <div style={{ display: 'flex', gap: 10, marginTop: 8, flexWrap: 'wrap' }}>
<button type="button" className="button secondary" onClick={() => applyAiResponse()}> <button type="button" className="button secondary" onClick={() => applyAiResponse()}>

View file

@ -525,7 +525,7 @@ const baseMessages = {
}, },
} as const; } as const;
const svMessages: typeof baseMessages.en = { const svMessages: Record<keyof typeof baseMessages.en, string> = {
...baseMessages.en, ...baseMessages.en,
navProfile: 'Profil', navProfile: 'Profil',
navMyListings: 'Mina annonser', navMyListings: 'Mina annonser',