From 3f016d871a091a0a72c2eaec2f4ff74e0ad5b426 Mon Sep 17 00:00:00 2001 From: Victor Gerbrands <42065266+VariableVic@users.noreply.github.com> Date: Tue, 14 Nov 2023 16:09:57 +0100 Subject: [PATCH] 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. --- .changeset/rotten-kids-cough.md | 5 +++++ packages/admin-ui/ui/src/i18n/index.ts | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) create mode 100644 .changeset/rotten-kids-cough.md diff --git a/.changeset/rotten-kids-cough.md b/.changeset/rotten-kids-cough.md new file mode 100644 index 0000000000..796499df33 --- /dev/null +++ b/.changeset/rotten-kids-cough.md @@ -0,0 +1,5 @@ +--- +"@medusajs/admin-ui": patch +--- + +fix: sort supportedLanguages array diff --git a/packages/admin-ui/ui/src/i18n/index.ts b/packages/admin-ui/ui/src/i18n/index.ts index 240118dc7a..ace297c139 100644 --- a/packages/admin-ui/ui/src/i18n/index.ts +++ b/packages/admin-ui/ui/src/i18n/index.ts @@ -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`