Skip to content

Commit 9e0c0aa

Browse files
committed
fix: locales
1 parent ac3ac92 commit 9e0c0aa

File tree

1 file changed

+22
-6
lines changed
  • src/pages/office-utilization/[location]

1 file changed

+22
-6
lines changed

src/pages/office-utilization/[location]/index.tsx

Lines changed: 22 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -561,13 +561,29 @@ const OfficeUtilizationPage = (
561561
);
562562
};
563563

564-
export const getStaticPaths = (async () => {
564+
export const getStaticPaths = (async (props) => {
565+
const { locales } = props;
565566
const records = await getOfficeUtilizationData();
566-
const paths = records.map((record) => ({
567-
params: {
568-
location: kebabCase(record.city.toLowerCase()),
569-
},
570-
}));
567+
const paths = records.flatMap((record) => {
568+
const transformedRecord = {
569+
params: {
570+
location: kebabCase(record.city.toLowerCase()),
571+
},
572+
};
573+
574+
if (!locales) {
575+
return transformedRecord;
576+
}
577+
return locales.map((locale) => {
578+
if (locale === "en") {
579+
return transformedRecord;
580+
}
581+
return {
582+
...transformedRecord,
583+
locale: locale,
584+
};
585+
});
586+
});
571587

572588
return {
573589
paths: paths,

0 commit comments

Comments
 (0)