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,13 +8,14 @@ namespace MinecraftClient.Commands
{
public class Dig : Command
{
public override string CMDName { get { return "dig"; } }
public override string CMDDesc { get { return "dig <x> <y> <z>: attempt to break a block"; } }
public override string CmdName { get { return "dig"; } }
public override string CmdUsage { get { return "dig <x> <y> <z>"; } }
public override string CmdDesc { get { return "cmd.dig.desc"; } }
public override string Run(McClient handler, string command, Dictionary<string, object> localVars)
{
if (!handler.GetTerrainEnabled())
return "Please enable Terrain and Movements to use this command.";
return Translations.Get("extra.terrainandmovement_required");
if (hasArg(command))
{
@ -28,18 +29,18 @@ namespace MinecraftClient.Commands
int z = int.Parse(args[2]);
Location blockToBreak = new Location(x, y, z);
if (blockToBreak.DistanceSquared(handler.GetCurrentLocation().EyesLocation()) > 25)
return "You are too far away from this block.";
return Translations.Get("cmd.dig.too_far");
if (handler.GetWorld().GetBlock(blockToBreak).Type == Material.Air)
return "No block at this location (Air)";
return Translations.Get("cmd.dig.no_block");
if (handler.DigBlock(blockToBreak))
return String.Format("Attempting to dig block at {0} {1} {2}", x, y, z);
else return "Failed to start digging block.";
return Translations.Get("cmd.dig.dig", x, y, z);
else return "cmd.dig.fail";
}
catch (FormatException) { return CMDDesc; }
catch (FormatException) { return GetCmdDescTranslated(); }
}
else return CMDDesc;
else return GetCmdDescTranslated();
}
else return CMDDesc;
else return GetCmdDescTranslated();
}
}
}