mirror of
https://github.com/GeyserMC/Geyser.git
synced 2024-08-14 23:57:35 +00:00
Properly handle Norwegian locale code differences
Bedrock's code is not the same as Java's code.
This commit is contained in:
parent
3323e5732c
commit
59c34fbcae
1 changed files with 13 additions and 6 deletions
|
@ -35,10 +35,7 @@ import org.geysermc.connector.GeyserConnector;
|
|||
import java.io.*;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.*;
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
import java.util.zip.ZipFile;
|
||||
|
||||
|
@ -119,7 +116,11 @@ public class LocaleUtils {
|
|||
* @param locale Locale to download and load
|
||||
*/
|
||||
public static void downloadAndLoadLocale(String locale) {
|
||||
locale = locale.toLowerCase();
|
||||
locale = locale.toLowerCase(Locale.ROOT);
|
||||
if (locale.equals("nb_no")) {
|
||||
// Different locale code - https://minecraft.fandom.com/wiki/Language
|
||||
locale = "no_no";
|
||||
}
|
||||
|
||||
// Check the locale isn't already loaded
|
||||
if (!ASSET_MAP.containsKey("minecraft/lang/" + locale + ".json") && !locale.equals("en_us")) {
|
||||
|
@ -225,8 +226,14 @@ public class LocaleUtils {
|
|||
langMap.put(entry.getKey(), entry.getValue().asText());
|
||||
}
|
||||
|
||||
String bedrockLocale = locale.toLowerCase(Locale.ROOT);
|
||||
if (bedrockLocale.equals("no_no")) {
|
||||
// Store this locale under the Bedrock locale so we don't need to do this check over and over
|
||||
bedrockLocale = "nb_no";
|
||||
}
|
||||
|
||||
// Insert the locale into the mappings
|
||||
LOCALE_MAPPINGS.put(locale.toLowerCase(), langMap);
|
||||
LOCALE_MAPPINGS.put(bedrockLocale, langMap);
|
||||
|
||||
try {
|
||||
localeStream.close();
|
||||
|
|
Loading…
Reference in a new issue