diff --git a/web/apps/photos/src/components/Search/SearchBar/searchInput/optionWithInfo.tsx b/web/apps/photos/src/components/Search/SearchBar/searchInput/optionWithInfo.tsx index 62a8d72b4b..2957e77318 100644 --- a/web/apps/photos/src/components/Search/SearchBar/searchInput/optionWithInfo.tsx +++ b/web/apps/photos/src/components/Search/SearchBar/searchInput/optionWithInfo.tsx @@ -1,4 +1,5 @@ import { SearchOption } from "@/new/photos/services/search/types"; +import { labelForSuggestionType } from "@/new/photos/services/search/ui"; import { FreeFlowText, SpaceBetweenFlex, @@ -24,7 +25,7 @@ const LabelWithInfo = ({ data }: { data: SearchOption }) => { <> - {t(`SEARCH_TYPE.${data.type}`)} + {labelForSuggestionType(data.type)} diff --git a/web/packages/new/photos/services/search/ui.ts b/web/packages/new/photos/services/search/ui.ts new file mode 100644 index 0000000000..85e671ea7f --- /dev/null +++ b/web/packages/new/photos/services/search/ui.ts @@ -0,0 +1,30 @@ +import { t } from "i18next"; +import { SuggestionType } from "./types"; + +/** + * Return a localized label for the given suggestion {@link type}. + */ +export const labelForSuggestionType = (type: SuggestionType) => { + switch (type) { + case SuggestionType.DATE: + return t("SEARCH_TYPE.DATE"); + case SuggestionType.LOCATION: + return t("SEARCH_TYPE.LOCATION"); + case SuggestionType.COLLECTION: + return t("SEARCH_TYPE.COLLECTION"); + case SuggestionType.FILE_NAME: + return t("SEARCH_TYPE.FILE_NAME"); + case SuggestionType.PERSON: + return t("SEARCH_TYPE.PERSON"); + case SuggestionType.INDEX_STATUS: + return t("SEARCH_TYPE.INDEX_STATUS"); + case SuggestionType.FILE_CAPTION: + return t("SEARCH_TYPE.FILE_CAPTION"); + case SuggestionType.FILE_TYPE: + return t("SEARCH_TYPE.FILE_TYPE"); + case SuggestionType.CLIP: + return t("SEARCH_TYPE.CLIP"); + case SuggestionType.CITY: + return t("SEARCH_TYPE.CITY"); + } +};