"use client" import { usePathname } from "next/navigation" import { useIntl } from "react-intl" import { languages } from "@scandic-hotels/common/constants/language" import { MaterialIcon } from "@scandic-hotels/design-system/Icons/MaterialIcon" import Link from "@scandic-hotels/design-system/OldDSLink" import { Typography } from "@scandic-hotels/design-system/Typography" import useLang from "@/hooks/useLang" import { replaceUrlPart } from "./utils" import styles from "./languageSwitcherContent.module.css" import type { LanguageSwitcherContentProps } from "@/types/components/languageSwitcher/languageSwitcher" export default function LanguageSwitcherContent({ urls, onLanguageSwitch, }: LanguageSwitcherContentProps) { const intl = useIntl() const currentLanguage = useLang() const urlKeys = (Object.keys(urls) as (keyof typeof urls)[]).sort((a, b) => { return languages[a].localeCompare(languages[b]) }) const pathname = usePathname() return (
{intl.formatMessage({ id: "common.selectYourLanguage", defaultMessage: "Select your language", })}