Skip to content

Commit

Permalink
[DPCP-121] Fix Locale Parsing (#50)
Browse files Browse the repository at this point in the history
* ar(fix) DPCP-121: Locale Parsing

* ar(fix) DPCP-121: Locale Parsing

* ar(fix) DPCP-121: Locale Parsing

* ar(fix) DPCP-121: Locale Parsing

* ar(fix) DPCP-121: Locale Parsing

* ar(fix) DPCP-121: Locale Parsing
  • Loading branch information
angeloreale authored Aug 30, 2024
1 parent 1176ab5 commit f0051f7
Showing 1 changed file with 6 additions and 2 deletions.
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

0 comments on commit f0051f7

Please sign in to comment.