diff --git a/.changeset/odd-lamps-invite.md b/.changeset/odd-lamps-invite.md new file mode 100644 index 0000000000..da82ac147f --- /dev/null +++ b/.changeset/odd-lamps-invite.md @@ -0,0 +1,5 @@ +--- +"@medusajs/dashboard": patch +--- + +fix(dashboard): Prevent language ptBR from breaking dashboard diff --git a/packages/admin/dashboard/src/i18n/translations/index.ts b/packages/admin/dashboard/src/i18n/translations/index.ts index 0e7918f05c..cca0a44527 100644 --- a/packages/admin/dashboard/src/i18n/translations/index.ts +++ b/packages/admin/dashboard/src/i18n/translations/index.ts @@ -5,8 +5,8 @@ import fr from "./fr.json" import it from "./it.json" import pl from "./pl.json" import ptBR from "./ptBR.json" -import tr from "./tr.json" import th from "./th.json" +import tr from "./tr.json" export default { de: { diff --git a/packages/admin/dashboard/src/providers/i18n-provider/i18n-provider.tsx b/packages/admin/dashboard/src/providers/i18n-provider/i18n-provider.tsx index 6da3118eb8..29944ef2b9 100644 --- a/packages/admin/dashboard/src/providers/i18n-provider/i18n-provider.tsx +++ b/packages/admin/dashboard/src/providers/i18n-provider/i18n-provider.tsx @@ -5,6 +5,10 @@ import { languages } from "../../i18n/languages" type I18nProviderProps = PropsWithChildren +const formatLocaleCode = (code: string) => { + return code.replace(/([a-z])([A-Z])/g, "$1-$2") +} + export const I18nProvider = ({ children }: I18nProviderProps) => { const { i18n } = useTranslation() @@ -12,5 +16,5 @@ export const I18nProvider = ({ children }: I18nProviderProps) => { languages.find((lan) => lan.code === i18n.language)?.code || languages[0].code - return {children} + return {children} } diff --git a/packages/admin/dashboard/src/routes/profile/profile-edit/components/edit-profile-form/edit-profile-form.tsx b/packages/admin/dashboard/src/routes/profile/profile-edit/components/edit-profile-form/edit-profile-form.tsx index a8439cff35..2f65a48f5d 100644 --- a/packages/admin/dashboard/src/routes/profile/profile-edit/components/edit-profile-form/edit-profile-form.tsx +++ b/packages/admin/dashboard/src/routes/profile/profile-edit/components/edit-profile-form/edit-profile-form.tsx @@ -4,7 +4,7 @@ import { useForm } from "react-hook-form" import { useTranslation } from "react-i18next" import * as zod from "zod" -import { UserDTO } from "@medusajs/types" +import { HttpTypes } from "@medusajs/types" import { Form } from "../../../../../components/common/form" import { RouteDrawer, useRouteModal } from "../../../../../components/modals" import { KeyboundForm } from "../../../../../components/utilities/keybound-form" @@ -12,7 +12,7 @@ import { useUpdateUser } from "../../../../../hooks/api/users" import { languages } from "../../../../../i18n/languages" type EditProfileProps = { - user: Partial> + user: HttpTypes.AdminUser // usageInsights: boolean } diff --git a/packages/admin/dashboard/src/routes/profile/profile-edit/profile-edit.tsx b/packages/admin/dashboard/src/routes/profile/profile-edit/profile-edit.tsx index 4bc89eb4e5..5ed2412284 100644 --- a/packages/admin/dashboard/src/routes/profile/profile-edit/profile-edit.tsx +++ b/packages/admin/dashboard/src/routes/profile/profile-edit/profile-edit.tsx @@ -16,11 +16,11 @@ export const ProfileEdit = () => { return ( - {t("profile.edit.header")} + + {t("profile.edit.header")} + - {!isLoading && user && ( - - )} + {!isLoading && user && } ) }