mirror of
https://github.com/cryptomator/cryptomator.git
synced 2024-11-23 03:59:51 +00:00
init collator once
This commit is contained in:
parent
7d62fc78de
commit
2a704d5eb4
@ -31,11 +31,11 @@ public class SupportedLanguages {
|
||||
public SupportedLanguages(Settings settings) {
|
||||
var preferredLanguage = settings.languageProperty().get();
|
||||
preferredLocale = preferredLanguage == null ? Locale.getDefault() : Locale.forLanguageTag(preferredLanguage);
|
||||
var sorted = LANGUAGE_TAGS.stream().sorted((a, b) -> {
|
||||
var collator = Collator.getInstance(preferredLocale);
|
||||
collator.setStrength(Collator.PRIMARY);
|
||||
return collator.compare(Locale.forLanguageTag(a).getDisplayName(), Locale.forLanguageTag(b).getDisplayName());
|
||||
}).collect(Collectors.toList());
|
||||
var collator = Collator.getInstance(preferredLocale);
|
||||
collator.setStrength(Collator.PRIMARY);
|
||||
var sorted = LANGUAGE_TAGS.stream() //
|
||||
.sorted((a, b) -> collator.compare(Locale.forLanguageTag(a).getDisplayName(), Locale.forLanguageTag(b).getDisplayName())) //
|
||||
.collect(Collectors.toList());
|
||||
sorted.add(0, Settings.DEFAULT_LANGUAGE);
|
||||
sorted.add(1, ENGLISH);
|
||||
sortedLanguageTags = Collections.unmodifiableList(sorted);
|
||||
|
Loading…
Reference in New Issue
Block a user