Skip to content
This repository was archived by the owner on Feb 10, 2025. It is now read-only.

Commit 0a7fb54

Browse files
committed
fix: options missing en / sv translations
1 parent 95258c2 commit 0a7fb54

2 files changed

Lines changed: 15 additions & 7 deletions

File tree

apps/ui/pages/search/index.tsx

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,10 @@ import { SEARCH_FORM_PARAMS_UNIT } from "@/modules/queries/params";
3737
import { getApplicationRoundName } from "@/modules/applicationRound";
3838
import { getUnitName } from "@/modules/reservationUnit";
3939
import { OPTIONS_QUERY } from "@/hooks/useOptions";
40+
import {
41+
convertLanguageCode,
42+
getTranslationSafe,
43+
} from "common/src/common/util";
4044

4145
type Props = Awaited<ReturnType<typeof getServerSideProps>>["props"];
4246

@@ -79,11 +83,11 @@ export async function getServerSideProps(ctx: GetServerSidePropsContext) {
7983

8084
const reservationUnitTypeOptions = reservationUnitTypes.map((n) => ({
8185
value: n.pk?.toString() ?? "",
82-
label: n.nameFi ?? "",
86+
label: getTranslationSafe(n, "name", convertLanguageCode(locale ?? "")),
8387
}));
8488
const purposeOptions = purposes.map((n) => ({
8589
value: n.pk?.toString() ?? "",
86-
label: n.nameFi ?? "",
90+
label: getTranslationSafe(n, "name", convertLanguageCode(locale ?? "")),
8791
}));
8892

8993
const { data: unitData } = await apolloClient.query<Query, QueryUnitsArgs>({
@@ -98,7 +102,7 @@ export async function getServerSideProps(ctx: GetServerSidePropsContext) {
98102
)
99103
.map((node) => ({
100104
pk: node.pk ?? 0,
101-
name: getUnitName(node) ?? "",
105+
name: getUnitName(node, locale) ?? "",
102106
}))
103107
.map((node) => ({
104108
value: node.pk,

apps/ui/pages/search/single.tsx

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,10 @@ import { useSearchValues } from "@/hooks/useSearchValues";
3131
import { OPTIONS_QUERY } from "@/hooks/useOptions";
3232
import { SEARCH_FORM_PARAMS_UNIT } from "@/modules/queries/params";
3333
import { getUnitName } from "@/modules/reservationUnit";
34+
import {
35+
convertLanguageCode,
36+
getTranslationSafe,
37+
} from "common/src/common/util";
3438

3539
const Wrapper = styled.div`
3640
margin-bottom: var(--spacing-layout-l);
@@ -95,15 +99,15 @@ export async function getServerSideProps(ctx: GetServerSidePropsContext) {
9599

96100
const reservationUnitTypeOptions = reservationUnitTypes.map((n) => ({
97101
value: n.pk?.toString() ?? "",
98-
label: n.nameFi ?? "",
102+
label: getTranslationSafe(n, "name", convertLanguageCode(locale ?? "")),
99103
}));
100104
const purposeOptions = purposes.map((n) => ({
101105
value: n.pk?.toString() ?? "",
102-
label: n.nameFi ?? "",
106+
label: getTranslationSafe(n, "name", convertLanguageCode(locale ?? "")),
103107
}));
104108
const equipmentsOptions = equipments.map((n) => ({
105109
value: n.pk ?? 0,
106-
label: n.nameFi ?? "",
110+
label: getTranslationSafe(n, "name", convertLanguageCode(locale ?? "")),
107111
}));
108112

109113
const { data: unitData } = await apolloClient.query<Query, QueryUnitsArgs>({
@@ -118,7 +122,7 @@ export async function getServerSideProps(ctx: GetServerSidePropsContext) {
118122
)
119123
.map((node) => ({
120124
pk: node.pk ?? 0,
121-
name: getUnitName(node) ?? "",
125+
name: getUnitName(node, locale) ?? "",
122126
}))
123127
.map((node) => ({
124128
value: node.pk,

0 commit comments

Comments
 (0)