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

@ -204,7 +204,7 @@ namespace MinecraftClient
/// <param name="settingsfile">File to load</param>
public static void LoadSettings(string settingsfile)
{
ConsoleIO.WriteLogLine(String.Format("[Settings] Loading Settings from {0}", System.IO.Path.GetFullPath(settingsfile)));
ConsoleIO.WriteLogLine("[Settings] Loading Settings from " + Path.GetFullPath(settingsfile));
if (File.Exists(settingsfile))
{
try
@ -635,175 +635,8 @@ namespace MinecraftClient
/// <param name="settingsfile">File to (over)write</param>
public static void WriteDefaultSettings(string settingsfile)
{
System.IO.File.WriteAllText(settingsfile, "# Minecraft Console Client v" + Program.Version + "\r\n"
+ "# Startup Config File\r\n"
+ "\r\n"
+ "[Main]\r\n"
+ "\r\n"
+ "# General settings\r\n"
+ "# Leave blank to prompt user on startup\r\n"
+ "# Use \"-\" as password for offline mode\r\n"
+ "\r\n"
+ "login=\r\n"
+ "password=\r\n"
+ "serverip=\r\n"
+ "\r\n"
+ "# Advanced settings\r\n"
+ "\r\n"
+ "language=en_GB\r\n"
+ "consoletitle=%username%@%serverip% - Minecraft Console Client\r\n"
+ "internalcmdchar=slash # Use 'none', 'slash' or 'backslash'\r\n"
+ "splitmessagedelay=2 # Seconds between each part of a long message\r\n"
+ "botowners=Player1,Player2,Player3 # Name list or myfile.txt, one name per line. !Server admins can impersonate owners!\r\n"
+ "botmessagedelay=2 # Seconds to delay between message a bot makes to avoid accidental spam\r\n"
+ "mcversion=auto # Use 'auto' or '1.X.X' values\r\n"
+ "mcforge=auto # Use 'auto' or 'false'\r\n"
+ "brandinfo=mcc # Use 'mcc','vanilla', or 'none'\r\n"
+ "chatbotlogfile= # Leave empty for no logfile\r\n"
+ "privatemsgscmdname=tell # Used by RemoteControl bot\r\n"
+ "showsystemmessages=true # System messages for server ops\r\n"
+ "showxpbarmessages=true # Messages displayed above xp bar\r\n"
+ "showchatlinks=true # Show links embedded in chat messages\r\n"
+ "terrainandmovements=false # Uses more ram, cpu, bandwidth\r\n"
+ "inventoryhandling=false # Toggle inventory handling (beta)\r\n"
+ "entityhandling=false # Toggle entity handling (beta)\r\n"
+ "sessioncache=disk # How to retain session tokens. Use 'none', 'memory' or 'disk'\r\n"
+ "resolvesrvrecords=fast # Use 'false', 'fast' (5s timeout), or 'true'. Required for joining some servers.\r\n"
+ "accountlist=accounts.txt # See README > 'Servers and Accounts file' for more info about this file\r\n"
+ "serverlist=servers.txt # See README > 'Servers and Accounts file' for more info about this file\r\n"
+ "playerheadicon=true # Only works on Windows XP-8 or Windows 10 with old console\r\n"
+ "exitonfailure=false # Disable pauses on error, for using MCC in non-interactive scripts\r\n"
+ "debugmessages=false # Please enable this before submitting bug reports. Thanks!\r\n"
+ "scriptcache=true # Cache compiled scripts for faster load on low-end devices\r\n"
+ "timestamps=false # Prepend timestamps to chat messages\r\n"
+ "autorespawn=false # Toggle auto respawn if client player was dead (make sure your spawn point is safe)\r\n"
+ "\r\n"
+ "[AppVars]\r\n"
+ "# yourvar=yourvalue\r\n"
+ "# can be used in some other fields as %yourvar%\r\n"
+ "# %username% and %serverip% are reserved variables.\r\n"
+ "\r\n"
+ "[Proxy]\r\n"
+ "enabled=false # Use 'false', 'true', or 'login' for login only\r\n"
+ "type=HTTP # Supported types: HTTP, SOCKS4, SOCKS4a, SOCKS5\r\n"
+ "server=0.0.0.0:0000 # Proxy server must allow HTTPS for login, and non-443 ports for playing\r\n"
+ "username= # Only required for password-protected proxies\r\n"
+ "password= # Only required for password-protected proxies\r\n"
+ "\r\n"
+ "[ChatFormat]\r\n"
+ "# Do not forget to uncomment (remove '#') these settings if modifying them\r\n"
+ "builtins=true # MCC built-in support for common message formats\r\n"
+ "# public=^<([a-zA-Z0-9_]+)> (.+)$\r\n"
+ "# private=^([a-zA-Z0-9_]+) whispers to you: (.+)$\r\n"
+ "# tprequest=^([a-zA-Z0-9_]+) has requested (?:to|that you) teleport to (?:you|them)\\.$\r\n"
+ "\r\n"
+ "[MCSettings]\r\n"
+ "enabled=true # If disabled, settings below are not sent to the server\r\n"
+ "locale=en_US # Use any language implemented in Minecraft\r\n"
+ "renderdistance=medium # Use tiny, short, medium, far, or chunk amount [0 - 255]\r\n"
+ "difficulty=normal # MC 1.7- difficulty. peaceful, easy, normal, difficult\r\n"
+ "chatmode=enabled # Use 'enabled', 'commands', or 'disabled'. Allows to mute yourself...\r\n"
+ "chatcolors=true # Allows disabling chat colors server-side\r\n"
+ "main_hand=left # MC 1.9+ main hand. left or right\r\n"
+ "skin_cape=true\r\n"
+ "skin_hat=true\r\n"
+ "skin_jacket=false\r\n"
+ "skin_sleeve_left=false\r\n"
+ "skin_sleeve_right=false\r\n"
+ "skin_pants_left=false\r\n"
+ "skin_pants_right=false"
+ "\r\n"
+ "# Bot Settings\r\n"
+ "\r\n"
+ "[Alerts]\r\n"
+ "enabled=false\r\n"
+ "alertsfile=alerts.txt\r\n"
+ "excludesfile=alerts-exclude.txt\r\n"
+ "beeponalert=true\r\n"
+ "\r\n"
+ "[AntiAFK]\r\n"
+ "enabled=false\r\n"
+ "delay=600 #10 = 1s\r\n"
+ "command=/ping\r\n"
+ "\r\n"
+ "[AutoRelog]\r\n"
+ "enabled=false\r\n"
+ "delay=10\r\n"
+ "retries=3 #-1 = unlimited\r\n"
+ "ignorekickmessage=false\r\n"
+ "kickmessagesfile=kickmessages.txt\r\n"
+ "\r\n"
+ "[ChatLog]\r\n"
+ "enabled=false\r\n"
+ "timestamps=true\r\n"
+ "filter=messages\r\n"
+ "logfile=chatlog-%username%-%serverip%.txt\r\n"
+ "\r\n"
+ "[Hangman]\r\n"
+ "enabled=false\r\n"
+ "english=true\r\n"
+ "wordsfile=hangman-en.txt\r\n"
+ "fichiermots=hangman-fr.txt\r\n"
+ "\r\n"
+ "[ScriptScheduler]\r\n"
+ "enabled=false\r\n"
+ "tasksfile=tasks.ini\r\n"
+ "\r\n"
+ "[RemoteControl]\r\n"
+ "enabled=false\r\n"
+ "autotpaccept=true\r\n"
+ "tpaccepteveryone=false\r\n"
+ "\r\n"
+ "[AutoRespond]\r\n"
+ "enabled=false\r\n"
+ "matchesfile=matches.ini\r\n"
+ "\r\n"
+ "[AutoAttack]\r\n"
+ "# Entity Handling NEED to be enabled first\r\n"
+ "enabled=false\r\n"
+ "mode=single # single or multi. single target one mob per attack. multi target all mobs in range per attack\r\n"
+ "priority=distance # health or distance. Only needed when using single mode\r\n"
+ "\r\n"
+ "[AutoFishing]\r\n"
+ "# Entity Handling NEED to be enabled first\r\n"
+ "enabled=false\r\n"
+ "antidespawn=false\r\n"
+ "\r\n"
+ "[AutoEat]\r\n"
+ "# Inventory Handling NEED to be enabled first\r\n"
+ "enabled=false\r\n"
+ "threshold=6\r\n"
+ "\r\n"
+ "[AutoCraft]\r\n"
+ "# Inventory Handling NEED to be enabled first\r\n"
+ "# Enable terrainandmovements if you need to use crafting table\r\n"
+ "enabled=false\r\n"
+ "configfile=autocraft\\config.ini\r\n"
+ "\r\n"
+ "[Mailer]\r\n"
+ "# Let the bot act like a mail plugin\r\n"
+ "enabled=false\r\n"
+ "database=MailerDatabase.ini\r\n"
+ "ignorelist=MailerIgnoreList.ini\r\n"
+ "publicinteractions=false\r\n"
+ "maxmailsperplayer=10\r\n"
+ "maxdatabasesize=10000\r\n"
+ "retentiondays=30\r\n"
+ "\r\n"
+ "[AutoDrop]\r\n"
+ "# Inventory Handling NEED to be enabled first\r\n"
+ "enabled=false\r\n"
+ "mode=include # include, exclude or everything. Include: drop item IN the list. Exclude: drop item NOT IN the list\r\n"
+ "items= # separate each item with comma ','\r\n"
+ "# For the naming of the items, please see \r\n"
+ "# https://github.com/ORelio/Minecraft-Console-Client/blob/master/MinecraftClient/Inventory/ItemType.cs \r\n"
+ "\r\n"
+ "[ReplayMod]\r\n"
+ "# Enable recording the game and replay it later using Replay Mod\r\n"
+ "# You MUST exit the program using /quit command or the replay will NOT be saved!\r\n"
+ "enabled=false\r\n"
+ "backupinterval=300 # How long should replay file be auto-saved, in seconds. Use -1 for disabled\r\n"
+ "\r\n", Encoding.UTF8);
// Use embedded default config
File.WriteAllText(settingsfile, "# Minecraft Console Client v" + Program.Version + "\r\n" + DefaultConfigResource.MinecraftClient, Encoding.UTF8);
}
/// <summary>
@ -818,7 +651,7 @@ namespace MinecraftClient
return Convert.ToInt32(str.Trim());
}
catch {
ConsoleIO.WriteLogLine("Failed to convert '" + str + "' into an int. Please check your settings.");
ConsoleIO.WriteLogLine(Translations.Get("error.setting.str2int", str));
return 0;
}
}