mirror of
https://github.com/hydralauncher/hydra.git
synced 2025-02-03 08:43:48 +03:00
use lodash to sort
This commit is contained in:
parent
5e019c41f4
commit
d62039fba1
@ -9,6 +9,7 @@ import { useAppSelector } from "@renderer/hooks";
|
|||||||
|
|
||||||
import { changeLanguage } from "i18next";
|
import { changeLanguage } from "i18next";
|
||||||
import * as languageResources from "@locales";
|
import * as languageResources from "@locales";
|
||||||
|
import { orderBy } from "lodash-es";
|
||||||
|
|
||||||
interface LanguageOption {
|
interface LanguageOption {
|
||||||
option: string;
|
option: string;
|
||||||
@ -47,18 +48,16 @@ export function SettingsGeneral({
|
|||||||
fetchdefaultDownloadsPath();
|
fetchdefaultDownloadsPath();
|
||||||
|
|
||||||
setLanguageOptions(
|
setLanguageOptions(
|
||||||
Object.keys(languageResources)
|
orderBy(
|
||||||
.map((language) => {
|
Object.keys(languageResources).map((language) => {
|
||||||
return {
|
return {
|
||||||
nativeName: ISO6391.getNativeName(language),
|
nativeName: ISO6391.getNativeName(language),
|
||||||
option: language,
|
option: language,
|
||||||
};
|
};
|
||||||
})
|
}),
|
||||||
.sort((a, b) => {
|
["nativeName"],
|
||||||
if (a.nativeName < b.nativeName) return -1;
|
"asc"
|
||||||
if (a.nativeName > b.nativeName) return 1;
|
)
|
||||||
return 0;
|
|
||||||
})
|
|
||||||
);
|
);
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user