locale upgrade
This commit is contained in:
@@ -32,14 +32,17 @@ export default async function ProjectsPage({
|
||||
orderBy: { createdAt: "desc" },
|
||||
include: {
|
||||
translations: {
|
||||
where: { locale },
|
||||
select: { title: true, description: true },
|
||||
select: { title: true, description: true, locale: true },
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
const localized = projects.map((p) => {
|
||||
const tr = p.translations?.[0];
|
||||
const trPreferred = p.translations?.find((t) => t.locale === locale && (t?.title || t?.description));
|
||||
const trDefault = p.translations?.find(
|
||||
(t) => t.locale === p.defaultLocale && (t?.title || t?.description),
|
||||
);
|
||||
const tr = trPreferred ?? trDefault;
|
||||
const { translations: _translations, ...rest } = p;
|
||||
return {
|
||||
...rest,
|
||||
|
||||
Reference in New Issue
Block a user