Crowdin localization support (#2310)

* Switching to use resource files

* Update Crowdin configuration file

* Code cleanup
This commit is contained in:
BruceChen 2022-10-28 11:13:20 +08:00 committed by GitHub
parent a27491c1b6
commit 077e3a5e9f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
193 changed files with 102089 additions and 3564 deletions

View file

@ -37,8 +37,8 @@ namespace MinecraftClient.ChatBots
if (!File.Exists(Matches_File))
{
LogToConsole(BotName, Translations.TryGet("bot.autoRespond.file_not_found", Path.GetFullPath(Matches_File)));
LogToConsole(BotName, Translations.TryGet("general.bot_unload"));
LogToConsole(BotName, string.Format(Translations.bot_autoRespond_file_not_found, Path.GetFullPath(Matches_File)));
LogToConsole(BotName, Translations.general_bot_unload);
Enabled = false;
}
}
@ -167,8 +167,8 @@ namespace MinecraftClient.ChatBots
/// <returns></returns>
public override string ToString()
{
return Translations.Get(
"bot.autoRespond.match",
return string.Format(
Translations.bot_autoRespond_match,
match,
regex,
actionPublic,
@ -196,7 +196,7 @@ namespace MinecraftClient.ChatBots
TimeSpan cooldown = TimeSpan.Zero;
respondRules = new List<RespondRule>();
LogDebugToConsoleTranslated("bot.autoRespond.loading", System.IO.Path.GetFullPath(Config.Matches_File));
LogDebugToConsole(string.Format(Translations.bot_autoRespond_loading, System.IO.Path.GetFullPath(Config.Matches_File)));
foreach (string lineRAW in File.ReadAllLines(Config.Matches_File, Encoding.UTF8))
{
@ -243,7 +243,7 @@ namespace MinecraftClient.ChatBots
}
else
{
LogToConsoleTranslated("bot.autoRespond.file_not_found", System.IO.Path.GetFullPath(Config.Matches_File));
LogToConsole(string.Format(Translations.bot_autoRespond_file_not_found, System.IO.Path.GetFullPath(Config.Matches_File)));
UnloadBot(); //No need to keep the bot active
}
}
@ -270,11 +270,11 @@ namespace MinecraftClient.ChatBots
if (matchRegex != null || matchString != null)
{
respondRules!.Add(rule);
LogDebugToConsoleTranslated("bot.autoRespond.loaded_match", rule);
LogDebugToConsole(string.Format(Translations.bot_autoRespond_loaded_match, rule));
}
else LogDebugToConsoleTranslated("bot.autoRespond.no_trigger", rule);
else LogDebugToConsole(string.Format(Translations.bot_autoRespond_no_trigger, rule));
}
else LogDebugToConsoleTranslated("bot.autoRespond.no_action", rule);
else LogDebugToConsole(string.Format(Translations.bot_autoRespond_no_action, rule));
}
}
@ -307,7 +307,7 @@ namespace MinecraftClient.ChatBots
if (!String.IsNullOrEmpty(toPerform))
{
string? response = null;
LogToConsoleTranslated("bot.autoRespond.match_run", toPerform);
LogToConsole(string.Format(Translations.bot_autoRespond_match_run, toPerform));
PerformInternalCommand(toPerform, ref response, localVars);
if (!String.IsNullOrEmpty(response))
LogToConsole(response);