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

@ -121,7 +121,7 @@ namespace MinecraftClient.ChatBots
caller = type.Name;
}
catch { }
ConsoleIO.WriteLineFormatted(String.Format("§8[MCC] [{0}] Cannot find script file: {1}", caller, filename));
ConsoleIO.WriteLineFormatted(Translations.Get("bot.script.not_found", caller, filename));
}
return false;
@ -137,14 +137,14 @@ namespace MinecraftClient.ChatBots
thread = null;
if (!String.IsNullOrEmpty(owner))
SendPrivateMessage(owner, "Script '" + file + "' loaded.");
SendPrivateMessage(owner, Translations.Get("bot.script.pm.loaded", file));
}
else
{
LogToConsole("File not found: '" + System.IO.Path.GetFullPath(file) + "'");
LogToConsoleTranslated("bot.script.file_not_found", System.IO.Path.GetFullPath(file));
if (!String.IsNullOrEmpty(owner))
SendPrivateMessage(owner, "File not found: '" + file + "'");
SendPrivateMessage(owner, Translations.Get("bot.script.file_not_found", file));
UnloadBot(); //No need to keep the bot active
}
@ -166,7 +166,7 @@ namespace MinecraftClient.ChatBots
}
catch (CSharpException e)
{
string errorMessage = "Script '" + file + "' failed to run (" + e.ExceptionType + ").";
string errorMessage = Translations.Get("bot.script.fail", file, e.ExceptionType);
LogToConsole(errorMessage);
if (owner != null)
SendPrivateMessage(owner, errorMessage);