Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[DPCP-121] Fix Locale Parsing #50

Merged
merged 8 commits into from
Aug 30, 2024
Merged
8 changes: 6 additions & 2 deletions lib/model/decorators/hypnos-public-decorator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,15 @@ import type { ICard } from '@dreampipcom/oneiros';

/* private */
const decorateListing = (listing: Record<string, any>, uMeta: any, locale?: string): ICard => {
const coerceStringLocale = (localeString: any) => {
const locArr = locale?.split('-') || [];
return localeString[locArr[1]] || localeString[locArr[0]];
};
const decd: ICard = {
id: `${listing.id}`,
className: '',
title: `${listing?.title[locale || 'en']}`,
description: `${listing?.description[locale || 'en']}`,
title: `${coerceStringLocale(listing?.title)}`,
description: `${coerceStringLocale(listing?.description)}`,
where: `${listing?.location?.name}`,
latlng: `${listing?.location?.geo}`,
when: `${listing?.scheduledFor}`,
Expand Down
Loading