mirror of
https://github.com/ViaVersion/ViaProxy.git
synced 2024-11-14 19:15:08 -05:00
Sort language map using stream API instead of guava
This commit is contained in:
parent
62b70303c4
commit
9e85832a9f
1 changed files with 4 additions and 4 deletions
|
@ -17,9 +17,6 @@
|
|||
*/
|
||||
package net.raphimc.viaproxy.ui;
|
||||
|
||||
import com.google.common.base.Functions;
|
||||
import com.google.common.collect.ImmutableSortedMap;
|
||||
import com.google.common.collect.Ordering;
|
||||
import net.raphimc.viabedrock.api.util.FileSystemUtil;
|
||||
import net.raphimc.viaproxy.ViaProxy;
|
||||
|
||||
|
@ -28,6 +25,7 @@ import java.io.InputStreamReader;
|
|||
import java.nio.charset.StandardCharsets;
|
||||
import java.nio.file.Path;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
public class I18n {
|
||||
|
||||
|
@ -49,7 +47,9 @@ public class I18n {
|
|||
} catch (Throwable e) {
|
||||
throw new RuntimeException("Failed to load translations", e);
|
||||
}
|
||||
LOCALES = ImmutableSortedMap.copyOf(LOCALES, Ordering.from(Comparator.comparing((Properties p) -> p.getProperty("language.name"))).onResultOf(Functions.forMap(LOCALES)));
|
||||
LOCALES = LOCALES.entrySet().stream()
|
||||
.sorted(Comparator.comparing(e -> e.getValue().getProperty("language.name")))
|
||||
.collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue, (oldValue, newValue) -> newValue, LinkedHashMap::new));
|
||||
|
||||
currentLocale = ViaProxy.getSaveManager().uiSave.get("locale");
|
||||
if (currentLocale == null || !LOCALES.containsKey(currentLocale)) {
|
||||
|
|
Loading…
Reference in a new issue