Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions libs/common-const/src/locales.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,10 @@ export const SUPPORTED_LOCALES = [
export type SupportedLocale = (typeof SUPPORTED_LOCALES)[number] | 'pseudo'

export const DEFAULT_LOCALE: SupportedLocale = 'en-US'

// Override display names shown in language selectors to ensure consistent wording
export const LOCALE_DISPLAY_NAMES: Partial<Record<SupportedLocale, string>> = {
'en-US': 'English (US)',
'es-ES': 'Español (España)',
'ru-RU': 'Русский (Россия)',
}
6 changes: 6 additions & 0 deletions libs/ui/src/pure/MenuBar/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import IMG_ICON_MENU_DOTS from '@cowprotocol/assets/images/menu-grid-dots.svg'
import IMG_ICON_MENU_HAMBURGER from '@cowprotocol/assets/images/menu-hamburger.svg'
import IMG_ICON_SETTINGS_GLOBAL from '@cowprotocol/assets/images/settings-global.svg'
import IMG_ICON_X from '@cowprotocol/assets/images/x.svg'
import { LOCALE_DISPLAY_NAMES } from '@cowprotocol/common-const'
import { useMediaQuery, useOnClickOutside } from '@cowprotocol/common-hooks'
import { addBodyClass, removeBodyClass } from '@cowprotocol/common-utils'

Expand Down Expand Up @@ -102,6 +103,11 @@ const DAO_NAV_ITEMS: MenuItem[] = [
]

const getLanguageName = (locale: string): string => {
const override = LOCALE_DISPLAY_NAMES[locale as keyof typeof LOCALE_DISPLAY_NAMES]
if (override) {
return override
}

const display = new Intl.DisplayNames([locale], { type: 'language' })
const languageName = display.of(locale)

Expand Down