diff --git a/CHANGELOG.md b/CHANGELOG.md index c8b3ec8c5b3..0cc588d5f64 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -34,7 +34,7 @@ Note that this project **does not** adhere to [Semantic Versioning](https://semv - We fixed an issue where the added protected term has unwanted leading and trailing whitespaces, where the formatted text has unwanted empty brackets and where the word at the cursor in the textbox can be added to the list. [#10415](https://github.com/JabRef/jabref/issues/10415) - We fixed an issue where in the merge dialog the file field of entries was not correctly merged when the first and second entry both contained values inside the file field. [#10572](https://github.com/JabRef/jabref/issues/10572) -- We fixed some small inconsistencies in the user interface. [#10507](https://github.com/JabRef/jabref/issues/10507) [#10458](https://github.com/JabRef/jabref/issues/10458) +- We fixed some small inconsistencies in the user interface. [#10507](https://github.com/JabRef/jabref/issues/10507) [#10458](https://github.com/JabRef/jabref/issues/10458) [#10660](https://github.com/JabRef/jabref/issues/10660) - We fixed the issue where the Hayagriva YAML exporter would not include a parent field for the publisher/series. [#10596](https://github.com/JabRef/jabref/issues/10596) ### Removed diff --git a/src/main/java/org/jabref/gui/preferences/general/GeneralTabViewModel.java b/src/main/java/org/jabref/gui/preferences/general/GeneralTabViewModel.java index d47bb33183f..810bfdc50e3 100644 --- a/src/main/java/org/jabref/gui/preferences/general/GeneralTabViewModel.java +++ b/src/main/java/org/jabref/gui/preferences/general/GeneralTabViewModel.java @@ -57,7 +57,7 @@ public class GeneralTabViewModel implements PreferenceTabViewModel { new SpinnerValueFactory.IntegerSpinnerValueFactory(9, Integer.MAX_VALUE); private final ReadOnlyListProperty languagesListProperty = - new ReadOnlyListWrapper<>(FXCollections.observableArrayList(Language.values())); + new ReadOnlyListWrapper<>(FXCollections.observableArrayList(Language.getSorted())); private final ObjectProperty selectedLanguageProperty = new SimpleObjectProperty<>(); private final ReadOnlyListProperty themesListProperty = diff --git a/src/main/java/org/jabref/logic/l10n/Language.java b/src/main/java/org/jabref/logic/l10n/Language.java index 2805b6b3ee5..9d3e9958fb8 100644 --- a/src/main/java/org/jabref/logic/l10n/Language.java +++ b/src/main/java/org/jabref/logic/l10n/Language.java @@ -1,8 +1,12 @@ package org.jabref.logic.l10n; +import java.util.Arrays; +import java.util.Comparator; +import java.util.List; import java.util.Locale; import java.util.Objects; import java.util.Optional; +import java.util.regex.Pattern; /** * Contains all supported languages. @@ -35,9 +39,9 @@ public enum Language { UKRAINIAN("украї́нська (Ukrainian)", "uk"), VIETNAMESE("Vietnamese", "vi"); + private static final Pattern IS_NOT_LATIN = Pattern.compile("[^\\p{IsLatin}]"); private final String displayName; private final String id; - /** * @param id Typically as 639-1 code */ @@ -70,4 +74,14 @@ public String getDisplayName() { public String getId() { return id; } + + public static List getSorted() { + return Arrays.stream(values()) + .sorted(Comparator.comparing(language -> removeNonLatinCharacters(language.getDisplayName()))) + .toList(); + } + + private static String removeNonLatinCharacters(String input) { + return IS_NOT_LATIN.matcher(input).replaceAll(""); + } }