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

@ -25,8 +25,8 @@ namespace MinecraftClient.ChatBots
{
if (!GetEntityHandlingEnabled())
{
LogToConsole("Entity Handling is not enabled in the config file!");
LogToConsole("This bot will be unloaded.");
LogToConsoleTranslated("extra.entity_required");
LogToConsoleTranslated("general.bot_unload");
UnloadBot();
}
inventoryEnabled = GetInventoryEnabled();
@ -50,7 +50,7 @@ namespace MinecraftClient.ChatBots
{
if (GetCurrentLocation().Distance(entity.Location) < 2 && !isFishing)
{
LogToConsole("Threw a fishing rod");
LogToConsoleTranslated("bot.autoFish.throw");
fishingRod = entity;
LastPos = entity.Location;
isFishing = true;
@ -108,14 +108,14 @@ namespace MinecraftClient.ChatBots
/// </summary>
public void OnCaughtFish()
{
LogToConsole(GetTimestamp() + ": Caught a fish!");
LogToConsole(GetTimestamp() + ": " + Translations.Get("bot.autoFish.caught"));
// retract fishing rod
UseItemInHand();
if (inventoryEnabled)
{
if (!hasFishingRod())
{
LogToConsole(GetTimestamp() + ": No Fishing Rod on hand. Maybe broken?");
LogToConsole(GetTimestamp() + ": " + Translations.Get("bot.autoFish.no_rod"));
return;
}
}