Fixes locations options mistranslations (#2336)

This commit is contained in:
Omar López authored and GitHub committed 2022-03-31 14:29:03 -07:00
1 parent f293f8b5c4
commit f71c0ddfc3
2 files changed
+19 -42

No files matched your search

+11 -2
View File
@@ -1,4 +1,5 @@
import { Prisma } from "@prisma/client";
import { TFunction } from "next-i18next";
import { LocationType } from "@calcom/lib/location";
import type { App } from "@calcom/types/App";
@@ -24,9 +25,17 @@ type OptionTypeBase = {
disabled?: boolean;
};
export function getLocationOptions(integrations: AppMeta) {
function translateLocations(locations: OptionTypeBase[], t: TFunction) {
return locations.map((l) => ({
...l,
label: t(l.label),
}));
}
export function getLocationOptions(integrations: AppMeta, t: TFunction) {
const defaultLocations: OptionTypeBase[] = [
{ value: LocationType.InPerson, label: "in_person_meeting" },
{ value: LocationType.Link, label: "link_meeting" },
{ value: LocationType.Phone, label: "phone_call" },
];
@@ -36,7 +45,7 @@ export function getLocationOptions(integrations: AppMeta) {
}
});
return defaultLocations;
return translateLocations(defaultLocations, t);
}
/**