Merged in feat/SW-1958-sort-languages (pull request #2540)
feat(SW-1958): add sorting of languge switcher languages * feat(SW-1958): add sorting of languge switcher languages Approved-by: Anton Gunnarsson
This commit is contained in:
@@ -16,8 +16,6 @@ import { replaceUrlPart } from "./utils"
|
||||
|
||||
import styles from "./languageSwitcherContent.module.css"
|
||||
|
||||
import type { Lang } from "@scandic-hotels/common/constants/language"
|
||||
|
||||
import type { LanguageSwitcherContentProps } from "@/types/components/languageSwitcher/languageSwitcher"
|
||||
|
||||
export default function LanguageSwitcherContent({
|
||||
@@ -27,7 +25,9 @@ export default function LanguageSwitcherContent({
|
||||
const intl = useIntl()
|
||||
const currentLanguage = useLang()
|
||||
|
||||
const urlKeys = Object.keys(urls) as Lang[]
|
||||
const urlKeys = (Object.keys(urls) as (keyof typeof urls)[]).sort((a, b) => {
|
||||
return languages[a].localeCompare(languages[b])
|
||||
})
|
||||
|
||||
const pathname = usePathname()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user