@@ -31,6 +31,10 @@ import { useSearchValues } from "@/hooks/useSearchValues";
3131import { OPTIONS_QUERY } from "@/hooks/useOptions" ;
3232import { SEARCH_FORM_PARAMS_UNIT } from "@/modules/queries/params" ;
3333import { getUnitName } from "@/modules/reservationUnit" ;
34+ import {
35+ convertLanguageCode ,
36+ getTranslationSafe ,
37+ } from "common/src/common/util" ;
3438
3539const 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