diff --git a/shared/i18n/index.ts b/shared/i18n/index.ts index 5880d8f..814b984 100644 --- a/shared/i18n/index.ts +++ b/shared/i18n/index.ts @@ -1,6 +1,13 @@ +import { locales } from "../utils/date"; + +type LanguageOption = { + label: string; + value: keyof typeof locales; +}; + // Note: Updating the available languages? Make sure to also update the // locales array in shared/utils/date.ts to enable translation for timestamps. -export const languageOptions = [ +export const languageOptions: LanguageOption[] = [ { label: "Русский (Russian)", value: "ru_RU", diff --git a/shared/utils/date.ts b/shared/utils/date.ts index b02c268..a45d418 100644 --- a/shared/utils/date.ts +++ b/shared/utils/date.ts @@ -191,7 +191,7 @@ const locales = { * @param language The user language * @returns The date-fns locale. */ -export function dateLocale(language: string | null | undefined) { +export function dateLocale(language: keyof typeof locales | undefined | null) { return language ? locales[language] : undefined; }