@@ -60,7 +60,7 @@ export default async function TopMenu({
className={styles.sessionLink}
prefetch={false}
>
- {formatMessage({ id: "Log out" })}
+ {intl.formatMessage({ id: "Log out" })}
>
) : (
@@ -69,7 +69,7 @@ export default async function TopMenu({
trackingId="loginStartTopMenu"
className={`${styles.sessionLink} ${styles.loginLink}`}
>
- {formatMessage({ id: "Log in" })}
+ {intl.formatMessage({ id: "Log in" })}
)}
diff --git a/components/Footer/Details/index.tsx b/components/Footer/Details/index.tsx
index 59b9c2488..cb3a4eb9b 100644
--- a/components/Footer/Details/index.tsx
+++ b/components/Footer/Details/index.tsx
@@ -20,7 +20,7 @@ function SocialIcon({ iconName }: SocialIconsProps) {
export default async function FooterDetails() {
const lang = getLang()
- const { formatMessage } = await getIntl()
+ const intl = await getIntl()
// preloaded
const footer = await getFooter()
const languages = await getLanguageSwitcher()
@@ -58,7 +58,7 @@ export default async function FooterDetails() {
diff --git a/components/Header/MainMenu/MyPagesMenuWrapper/index.tsx b/components/Header/MainMenu/MyPagesMenuWrapper/index.tsx
index 14044b248..bf9473f32 100644
--- a/components/Header/MainMenu/MyPagesMenuWrapper/index.tsx
+++ b/components/Header/MainMenu/MyPagesMenuWrapper/index.tsx
@@ -8,7 +8,6 @@ import { serverClient } from "@/lib/trpc/server"
import LoginButton from "@/components/LoginButton"
import { getIntl } from "@/i18n"
-import { getLang } from "@/i18n/serverContext"
import Avatar from "../Avatar"
import MyPagesMenu from "../MyPagesMenu"
@@ -17,7 +16,6 @@ import MyPagesMobileMenu from "../MyPagesMobileMenu"
import styles from "./myPagesMenuWrapper.module.css"
export default async function MyPagesMenuWrapper() {
- const lang = getLang()
const [intl, myPagesNavigation, user, membership] = await Promise.all([
getIntl(),
getMyPagesNavigation(),
diff --git a/components/HotelReservation/EnterDetails/Summary/index.tsx b/components/HotelReservation/EnterDetails/Summary/index.tsx
index 752f3fd4a..b8d744baa 100644
--- a/components/HotelReservation/EnterDetails/Summary/index.tsx
+++ b/components/HotelReservation/EnterDetails/Summary/index.tsx
@@ -13,7 +13,6 @@ import Body from "@/components/TempDesignSystem/Text/Body"
import Caption from "@/components/TempDesignSystem/Text/Caption"
import Subtitle from "@/components/TempDesignSystem/Text/Subtitle"
import useLang from "@/hooks/useLang"
-import { formatNumber } from "@/utils/format"
import styles from "./summary.module.css"
@@ -106,7 +105,9 @@ export default function Summary({
{intl.formatMessage(
{ id: "{amount} {currency}" },
{
- amount: formatNumber(parseInt(room.localPrice.price ?? "0")),
+ amount: intl.formatNumber(
+ parseInt(room.localPrice.price ?? "0")
+ ),
currency: room.localPrice.currency,
}
)}
@@ -202,7 +203,7 @@ export default function Summary({
{intl.formatMessage(
{ id: "{amount} {currency}" },
{
- amount: formatNumber(totalPrice.local),
+ amount: intl.formatNumber(totalPrice.local),
currency: room.localPrice.currency,
}
)}
@@ -212,7 +213,7 @@ export default function Summary({
{intl.formatMessage(
{ id: "{amount} {currency}" },
{
- amount: formatNumber(totalPrice.euro),
+ amount: intl.formatNumber(totalPrice.euro),
currency: room.euroPrice.currency,
}
)}
diff --git a/components/MyPages/Sidebar/index.tsx b/components/MyPages/Sidebar/index.tsx
index 5c4de4d2d..8a871d253 100644
--- a/components/MyPages/Sidebar/index.tsx
+++ b/components/MyPages/Sidebar/index.tsx
@@ -13,7 +13,7 @@ import styles from "./sidebar.module.css"
export default async function SidebarMyPages() {
const navigation = await getMyPagesNavigation()
- const { formatMessage } = await getIntl()
+ const intl = await getIntl()
return (
@@ -46,7 +46,7 @@ export default async function SidebarMyPages() {
size="small"
variant="sidebar"
>
- {formatMessage({ id: "Log out" })}
+ {intl.formatMessage({ id: "Log out" })}
) : null}
diff --git a/components/Profile/DeleteCreditCardButton/index.tsx b/components/Profile/DeleteCreditCardButton/index.tsx
index 69ebbd21b..1526f10bf 100644
--- a/components/Profile/DeleteCreditCardButton/index.tsx
+++ b/components/Profile/DeleteCreditCardButton/index.tsx
@@ -12,17 +12,19 @@ export default function DeleteCreditCardButton({
}: {
creditCardId: string
}) {
- const { formatMessage } = useIntl()
+ const intl = useIntl()
const trpcUtils = trpc.useUtils()
const deleteCreditCardMutation = trpc.user.creditCard.delete.useMutation({
onSuccess() {
trpcUtils.user.creditCards.invalidate()
- toast.success(formatMessage({ id: "Credit card deleted successfully" }))
+ toast.success(
+ intl.formatMessage({ id: "Credit card deleted successfully" })
+ )
},
onError() {
toast.error(
- formatMessage({
+ intl.formatMessage({
id: "Failed to delete credit card, please try again later.",
})
)
diff --git a/components/Section/Header/header.module.css b/components/Section/Header/header.module.css
index 48c539418..08a25baf2 100644
--- a/components/Section/Header/header.module.css
+++ b/components/Section/Header/header.module.css
@@ -1,6 +1,6 @@
.header {
display: grid;
- gap: var(--Spacing-x1);
+ gap: var(--Spacing-x1) var(--Spacing-x5);
grid-template-columns: 1fr;
align-items: baseline;
}
diff --git a/components/SkipToMainContent.tsx b/components/SkipToMainContent.tsx
index c659d4dbf..533b5d58f 100644
--- a/components/SkipToMainContent.tsx
+++ b/components/SkipToMainContent.tsx
@@ -1,11 +1,11 @@
import { getIntl } from "@/i18n"
export default async function SkipToMainContent() {
- const { formatMessage } = await getIntl()
+ const intl = await getIntl()
return (
)
diff --git a/components/TempDesignSystem/Form/Country/index.tsx b/components/TempDesignSystem/Form/Country/index.tsx
index 0a5406640..ea6e1867a 100644
--- a/components/TempDesignSystem/Form/Country/index.tsx
+++ b/components/TempDesignSystem/Form/Country/index.tsx
@@ -34,7 +34,7 @@ export default function CountrySelect({
readOnly = false,
registerOptions = {},
}: CountryProps) {
- const { formatMessage } = useIntl()
+ const intl = useIntl()
const [rootDiv, setRootDiv] = useState(undefined)
function setRef(node: CountryPortalContainerArgs) {
@@ -53,13 +53,12 @@ export default function CountrySelect({
setValue(name, country)
}
- const selectCountryLabel = formatMessage({ id: "Select a country" })
+ const selectCountryLabel = intl.formatMessage({ id: "Select a country" })
return (
- {formatMessage({ id: "Country code" })}
+ {intl.formatMessage({ id: "Country code" })}
{props.children}
diff --git a/components/Webviews/LinkToOverview/index.tsx b/components/Webviews/LinkToOverview/index.tsx
index 8e0a57820..a990d9fce 100644
--- a/components/Webviews/LinkToOverview/index.tsx
+++ b/components/Webviews/LinkToOverview/index.tsx
@@ -10,14 +10,14 @@ import { webviewSearchParams } from "@/utils/webviews"
import styles from "./linkToOverview.module.css"
export default async function LinkToOverview() {
- const { formatMessage } = await getIntl()
+ const intl = await getIntl()
const searchParams = webviewSearchParams()
const overviewHref = `${overview[getLang()]}?${searchParams.toString()}`
return (
{" "}
- {formatMessage({ id: "Go back to overview" })}
+ {intl.formatMessage({ id: "Go back to overview" })}
)
}
diff --git a/utils/format.ts b/utils/format.ts
deleted file mode 100644
index 7a731f09e..000000000
--- a/utils/format.ts
+++ /dev/null
@@ -1,8 +0,0 @@
-import { Lang } from "@/constants/languages"
-
-/// Function to format numbers with space as thousands separator
-export function formatNumber(num: number) {
- // sv hardcoded to force space on thousands
- const formatter = new Intl.NumberFormat(Lang.sv)
- return formatter.format(num)
-}