fix(admin-ui): sort supported languages alphabetically (#5479)

## What?
Added sorting to the `supportedLanguages` array in `packages/admin-ui/ui/src/i18n/index.ts`. This makes sure the languages in the dropdown are sorted alphabetically.

![image](https://github.com/medusajs/medusa/assets/42065266/aca6e5ab-f200-45bf-afb4-22d9bc1c9a66)

## Why?
As we're supporting more languages in the admin UI, this list was getting messy.  

## How?
By using `sort()` and `localeCompare()` on array declaration.

## Testing
Go to Medusa Admin locally, login and navigate to Settings > Personal information to test the language dropdown.
This commit is contained in:
Victor Gerbrands
2023-11-14 16:09:57 +01:00
committed by GitHub
parent edeec07466
commit 3f016d871a
2 changed files with 6 additions and 1 deletions

View File

@@ -0,0 +1,5 @@
---
"@medusajs/admin-ui": patch
---
fix: sort supportedLanguages array

View File

@@ -66,7 +66,7 @@ export const supportedLanguages = [
locale: "ru",
name: "Русский"
}
]
].sort((a, b) => a.locale.localeCompare(b.locale))
const adminPath = getFullAdminPath()
const pathToLoadFrom = `${adminPath}public/locales/{{lng}}/{{ns}}.json`