Fix: norwegian locale handling (#4716)

This commit is contained in:
chris 2024-06-19 02:37:34 +02:00 committed by GitHub
parent a9300fb1ab
commit 6884a0f7db
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -259,6 +259,13 @@ public class GeyserLocale {
// Invalid locale // Invalid locale
return locale; return locale;
} }
// See https://en.wikipedia.org/wiki/List_of_ISO_639_language_codes - covers the special case that is norwegian
String lowerCaseLocale = locale.toLowerCase(Locale.ROOT);
if (lowerCaseLocale.equals("nn_no") || lowerCaseLocale.equals("no_no")) {
locale = "nb_NO";
}
String language = locale.substring(0, 2); String language = locale.substring(0, 2);
String country = locale.substring(3); String country = locale.substring(3);
return language.toLowerCase(Locale.ENGLISH) + "_" + country.toUpperCase(Locale.ENGLISH); return language.toLowerCase(Locale.ENGLISH) + "_" + country.toUpperCase(Locale.ENGLISH);