Crowdin localization support (#2310)

* Switching to use resource files

* Update Crowdin configuration file

* Code cleanup
This commit is contained in:
BruceChen 2022-10-28 11:13:20 +08:00 committed by GitHub
parent a27491c1b6
commit 077e3a5e9f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
193 changed files with 102089 additions and 3564 deletions

View file

@ -131,7 +131,7 @@ namespace MinecraftClient.Protocol.Handlers
byte fmlProtocolVersion = dataTypes.ReadNextByte(packetData);
if (Settings.Config.Logging.DebugMessages)
ConsoleIO.WriteLineFormatted(Translations.Get("forge.version", fmlProtocolVersion));
ConsoleIO.WriteLineFormatted(string.Format(Translations.forge_version, fmlProtocolVersion));
if (fmlProtocolVersion >= 1)
currentDimension = dataTypes.ReadNextInt(packetData);
@ -141,7 +141,7 @@ namespace MinecraftClient.Protocol.Handlers
// Then tell the server that we're running the same mods.
if (Settings.Config.Logging.DebugMessages)
Translations.WriteLineFormatted("forge.send_mod");
ConsoleIO.WriteLineFormatted(Translations.forge_send_mod, acceptnewlines: true);
byte[][] mods = new byte[forgeInfo.Mods.Count][];
for (int i = 0; i < forgeInfo.Mods.Count; i++)
{
@ -161,7 +161,7 @@ namespace MinecraftClient.Protocol.Handlers
Thread.Sleep(2000);
if (Settings.Config.Logging.DebugMessages)
Translations.WriteLineFormatted("forge.accept");
ConsoleIO.WriteLineFormatted(Translations.forge_accept, acceptnewlines: true);
// Tell the server that yes, we are OK with the mods it has
// even though we don't actually care what mods it has.
@ -183,7 +183,7 @@ namespace MinecraftClient.Protocol.Handlers
int registrySize = dataTypes.ReadNextVarInt(packetData);
if (Settings.Config.Logging.DebugMessages)
ConsoleIO.WriteLineFormatted(Translations.Get("forge.registry", registrySize));
ConsoleIO.WriteLineFormatted(string.Format(Translations.forge_registry, registrySize));
fmlHandshakeState = FMLHandshakeClientState.PENDINGCOMPLETE;
}
@ -195,7 +195,7 @@ namespace MinecraftClient.Protocol.Handlers
string registryName = dataTypes.ReadNextString(packetData);
int registrySize = dataTypes.ReadNextVarInt(packetData);
if (Settings.Config.Logging.DebugMessages)
ConsoleIO.WriteLineFormatted(Translations.Get("forge.registry_2", registryName, registrySize));
ConsoleIO.WriteLineFormatted(string.Format(Translations.forge_registry_2, registryName, registrySize));
if (!hasNextRegistry)
fmlHandshakeState = FMLHandshakeClientState.PENDINGCOMPLETE;
}
@ -207,7 +207,7 @@ namespace MinecraftClient.Protocol.Handlers
if (discriminator != FMLHandshakeDiscriminator.HandshakeAck)
return false;
if (Settings.Config.Logging.DebugMessages)
Translations.WriteLineFormatted("forge.accept_registry");
ConsoleIO.WriteLineFormatted(Translations.forge_accept_registry, acceptnewlines: true);
SendForgeHandshakePacket(FMLHandshakeDiscriminator.HandshakeAck,
new byte[] { (byte)FMLHandshakeClientState.PENDINGCOMPLETE });
fmlHandshakeState = FMLHandshakeClientState.COMPLETE;
@ -221,7 +221,7 @@ namespace MinecraftClient.Protocol.Handlers
SendForgeHandshakePacket(FMLHandshakeDiscriminator.HandshakeAck,
new byte[] { (byte)FMLHandshakeClientState.COMPLETE });
if (Settings.Config.Logging.DebugMessages)
Translations.WriteLine("forge.complete");
ConsoleIO.WriteLine(Translations.forge_complete);
fmlHandshakeState = FMLHandshakeClientState.DONE;
return true;
}
@ -301,7 +301,7 @@ namespace MinecraftClient.Protocol.Handlers
// [1]: Version is usually set to "FML2" for FML stuff and "1" for mods
if (Settings.Config.Logging.DebugMessages)
Translations.WriteLineFormatted("forge.fml2.mod");
ConsoleIO.WriteLineFormatted(Translations.forge_fml2_mod, acceptnewlines: true);
List<string> mods = new();
int modCount = dataTypes.ReadNextVarInt(packetData);
@ -333,7 +333,7 @@ namespace MinecraftClient.Protocol.Handlers
// In MCC, we just want to send a valid response so we'll reply back with data collected from the server.
if (Settings.Config.Logging.DebugMessages)
Translations.WriteLineFormatted("forge.fml2.mod_send");
ConsoleIO.WriteLineFormatted(Translations.forge_fml2_mod_send, acceptnewlines: true);
// Packet ID 2: Client to Server Mod List
fmlResponsePacket.AddRange(dataTypes.GetVarInt(2));
@ -371,7 +371,7 @@ namespace MinecraftClient.Protocol.Handlers
if (Settings.Config.Logging.DebugMessages)
{
string registryName = dataTypes.ReadNextString(packetData);
ConsoleIO.WriteLineFormatted(Translations.Get("forge.fml2.registry", registryName));
ConsoleIO.WriteLineFormatted(string.Format(Translations.forge_fml2_registry, registryName));
}
fmlResponsePacket.AddRange(dataTypes.GetVarInt(99));
@ -390,7 +390,7 @@ namespace MinecraftClient.Protocol.Handlers
if (Settings.Config.Logging.DebugMessages)
{
string configName = dataTypes.ReadNextString(packetData);
ConsoleIO.WriteLineFormatted(Translations.Get("forge.fml2.config", configName));
ConsoleIO.WriteLineFormatted(string.Format(Translations.forge_fml2_config, configName));
}
fmlResponsePacket.AddRange(dataTypes.GetVarInt(99));
@ -399,7 +399,7 @@ namespace MinecraftClient.Protocol.Handlers
default:
if (Settings.Config.Logging.DebugMessages)
ConsoleIO.WriteLineFormatted(Translations.Get("forge.fml2.unknown", packetID));
ConsoleIO.WriteLineFormatted(string.Format(Translations.forge_fml2_unknown, packetID));
break;
}
@ -415,7 +415,7 @@ namespace MinecraftClient.Protocol.Handlers
}
else if (Settings.Config.Logging.DebugMessages)
{
ConsoleIO.WriteLineFormatted(Translations.Get("forge.fml2.unknown_channel", fmlChannel));
ConsoleIO.WriteLineFormatted(string.Format(Translations.forge_fml2_unknown_channel, fmlChannel));
}
}
return false;
@ -464,7 +464,7 @@ namespace MinecraftClient.Protocol.Handlers
{
return new ForgeInfo(FMLVersion.FML2);
}
else throw new InvalidOperationException(Translations.Get("error.forgeforce"));
else throw new InvalidOperationException(Translations.error_forgeforce);
}
/// <summary>
@ -504,10 +504,10 @@ namespace MinecraftClient.Protocol.Handlers
forgeInfo = new ForgeInfo(modData, fmlVersion);
if (forgeInfo.Mods.Any())
{
ConsoleIO.WriteLineFormatted(Translations.Get("forge.with_mod", forgeInfo.Mods.Count));
ConsoleIO.WriteLineFormatted(string.Format(Translations.forge_with_mod, forgeInfo.Mods.Count));
if (Settings.Config.Logging.DebugMessages)
{
Translations.WriteLineFormatted("forge.mod_list");
ConsoleIO.WriteLineFormatted(Translations.forge_mod_list, acceptnewlines: true);
foreach (ForgeInfo.ForgeMod mod in forgeInfo.Mods)
ConsoleIO.WriteLineFormatted("§8 " + mod.ToString());
}
@ -515,7 +515,7 @@ namespace MinecraftClient.Protocol.Handlers
}
else
{
Translations.WriteLineFormatted("forge.no_mod");
ConsoleIO.WriteLineFormatted(Translations.forge_no_mod, acceptnewlines: true);
forgeInfo = null;
}
}