/
opt
/
canhelp
/
apps
/
web
/
src
/
lib
/
/opt/canhelp/apps/web/src/lib
mkdir
upload
Name
Size
Mode
Actions
api.ts
44017
0644
edit
dl
rm
auth.ts
312
0644
edit
dl
rm
formatLastSeen.ts
643
0644
edit
dl
rm
formatName.ts
865
0644
edit
dl
rm
taskLocale.ts
941
0644
edit
dl
rm
translations.ts
365788
0644
edit
dl
rm
Edit:
/opt/canhelp/apps/web/src/lib/taskLocale.ts
(941B)
import type { Task } from '@canhelp/shared' import type { Locale } from './translations' export function taskTitle(task: Task, locale: Locale): string { if (locale === 'el' && task.titleEl) return task.titleEl if (locale === 'en' && task.titleEn) return task.titleEn if (locale === 'ru' && task.titleRu) return task.titleRu return task.title } /** Display a price without decimal cents: 100.00 → 100, 99.5 → 100 */ export function formatPrice(value: number | string | null | undefined): string { if (value === null || value === undefined || value === '') return '' return Math.round(Number(value)).toString() } export function taskDescription(task: Task, locale: Locale): string { if (locale === 'el' && task.descriptionEl) return task.descriptionEl if (locale === 'en' && task.descriptionEn) return task.descriptionEn if (locale === 'ru' && task.descriptionRu) return task.descriptionRu return task.description }
Save
cmd:
run