1
0
Fork 0

the Languages screen now loads more than 100x faster, thanks to optimizing Text.capitalize()

This commit is contained in:
sspanak 2024-04-24 14:46:49 +03:00
parent b609178976
commit 67d17e2914
2 changed files with 5 additions and 7 deletions

View file

@ -240,8 +240,8 @@ public class NaturalLanguage extends Language implements Comparable<NaturalLangu
@Override
public int compareTo(NaturalLanguage other) {
String key = getName().equals("Suomi") ? "su" : getLocale().toString();
String otherKey = other.getName().equals("Suomi") ? "su" : other.getLocale().toString();
String key = getLocale().getCountry().equals("FI") ? "su" : getLocale().toString();
String otherKey = other.getLocale().getCountry().equals("FI") ? "su" : other.getLocale().toString();
return key.compareTo(otherKey);
}
}

View file

@ -25,11 +25,9 @@ public class Text extends TextTools {
return text;
}
if (text.length() == 1) {
return text.toUpperCase(language.getLocale());
} else {
return text.substring(0, 1).toUpperCase(language.getLocale()) + text.substring(1);
}
char[] chars = text.toCharArray();
chars[0] = Character.toUpperCase(chars[0]);
return String.valueOf(chars);
}