Add support of language files (#1273)

* Basic support of language file
Only mapped main part of MCC.
* Translations function imporve
* Change translation file naming
* Fix default translation file naming
* Complete translation file mapping for main part
Command and ChatBot not done yet
* Complete translation mapping for commands
Except Entitycmd
* Complete translation mapping for ChatBots
* Add new method for replacing translation key
Just for Entitycmd. Be proud of yourself. We have a convenient method now.
* Complete all translation mapping
* Add default config and translation file to resource
* Remove untranslatable messages from default translation file
This commit is contained in:
ReinforceZwei 2020-10-17 19:41:31 +08:00 committed by GitHub
parent 0c88c18ea0
commit 2017d5d652
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
54 changed files with 1658 additions and 660 deletions

View file

@ -8,8 +8,9 @@ namespace MinecraftClient.Commands
{
public class Look : Command
{
public override string CMDName { get { return "look"; } }
public override string CMDDesc { get { return "look <x y z|yaw pitch|up|down|east|west|north|south>: look at direction or coordinates."; } }
public override string CmdName { get { return "look"; } }
public override string CmdUsage { get { return "look <x y z|yaw pitch|up|down|east|west|north|south>"; } }
public override string CmdDesc { get { return "cmd.look.desc"; } }
public override string Run(McClient handler, string command, Dictionary<string, object> localVars)
{
@ -28,7 +29,7 @@ namespace MinecraftClient.Commands
case "west": direction = Direction.West; break;
case "north": direction = Direction.North; break;
case "south": direction = Direction.South; break;
default: return "Unknown direction '" + dirStr + "'.";
default: return Translations.Get("cmd.look.unknown", dirStr);
}
handler.UpdateLocation(handler.GetCurrentLocation(), direction);
@ -42,9 +43,9 @@ namespace MinecraftClient.Commands
float pitch = Single.Parse(args[1]);
handler.UpdateLocation(handler.GetCurrentLocation(), yaw, pitch);
return String.Format("Looking at YAW: {0} PITCH: {1}", yaw.ToString("0.00"), pitch.ToString("0.00"));
return Translations.Get("cmd.look.at", yaw.ToString("0.00"), pitch.ToString("0.00"));
}
catch (FormatException) { return CMDDesc; }
catch (FormatException) { return GetCmdDescTranslated(); }
}
else if (args.Length == 3)
{
@ -57,14 +58,14 @@ namespace MinecraftClient.Commands
Location block = new Location(x, y, z);
handler.UpdateLocation(handler.GetCurrentLocation(), block);
return "Looking at " + block;
return Translations.Get("cmd.look.block", block);
}
catch (FormatException) { return CMDDesc; }
catch (FormatException) { return CmdUsage; }
}
else return CMDDesc;
else return GetCmdDescTranslated();
}
else return "Please enable terrainandmovements in config to use this command.";
else return Translations.Get("extra.terrainandmovement_required");
}
}
}