Add Translations support

This commit is contained in:
BruceChen 2022-10-25 10:32:27 +08:00
parent b8d6914615
commit 404689836d
5 changed files with 76 additions and 31 deletions

View file

@ -304,7 +304,7 @@ namespace MinecraftClient {
///mcc.password=Password: ///mcc.password=Password:
///mcc.password_basic_io=Please type the password for {0}. ///mcc.password_basic_io=Please type the password for {0}.
///mcc.password_hidden=Password(invisible): {0} ///mcc.password_hidden=Password(invisible): {0}
///mcc.off [rest of string was truncated]";. ///mcc.offline=§8You [rest of string was truncated]";.
/// </summary> /// </summary>
internal static string Translation_en { internal static string Translation_en {
get { get {
@ -356,6 +356,26 @@ namespace MinecraftClient {
} }
} }
/// <summary>
/// Looks up a localized string similar to [mcc]
///# Messages from MCC itself
///mcc.help_us_translate=MCCyi çevirmemize yardımcı olun: {0}
///mcc.run_with_default_settings=\nMCC varsayılan ayarlarla çalışıyor.
///mcc.settings_generated=§cAyarlar dosyası MinecraftClient.ini oluşturuldu.
///mcc.has_update=§eMCCnin yeni sürümü mevcut: {0}
///mcc.login=Login :
///mcc.login_basic_io=Lütfen tercih ettiğiniz kullanıcı adını veya e-posta adresini yazın.
///mcc.password=Password :
///mcc.password_basic_io=Lütfen {0} için şifreyi yazın.
///mcc.password_hidden=Password : {0}
///m [rest of string was truncated]&quot;;.
/// </summary>
internal static string Translation_tr {
get {
return ResourceManager.GetString("Translation_tr", resourceCulture);
}
}
/// <summary> /// <summary>
/// Looks up a localized string similar to [mcc] /// Looks up a localized string similar to [mcc]
///# Messages from MCC itself ///# Messages from MCC itself

View file

@ -160,6 +160,9 @@
<data name="Translation_ru" type="System.Resources.ResXFileRef, System.Windows.Forms"> <data name="Translation_ru" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>Resources\lang\ru.ini;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;utf-8</value> <value>Resources\lang\ru.ini;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;utf-8</value>
</data> </data>
<data name="Translation_tr" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>Resources\lang\tr.ini;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;utf-8</value>
</data>
<data name="Translation_vi" type="System.Resources.ResXFileRef, System.Windows.Forms"> <data name="Translation_vi" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>Resources\lang\vi.ini;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;utf-8</value> <value>Resources\lang\vi.ini;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;utf-8</value>
</data> </data>

View file

@ -668,7 +668,7 @@ cmd.follow.resuming=Resuming to follow!
cmd.follow.player_left_the_range=The player {0} has left the range! cmd.follow.player_left_the_range=The player {0} has left the range!
cmd.follow.pausing=Pausing! cmd.follow.pausing=Pausing!
cmd.follow.player_left=The player {0} left the server! cmd.follow.player_left=The player {0} left the server!
cmd.follow.stopping=Stopped! cmd.follow.stopped=Stopped!
# HangmanGame # HangmanGame
botname.HangmanGame=HangmanGame botname.HangmanGame=HangmanGame
@ -770,6 +770,17 @@ bot.TelegramBridge.direction.both=Both
bot.TelegramBridge.direction.minecraft=Minecraft bot.TelegramBridge.direction.minecraft=Minecraft
bot.TelegramBridge.direction.Telegram=Telegram bot.TelegramBridge.direction.Telegram=Telegram
# WebSocketBot
bot.WebSocketBot.session_id_changed=§bSession with an id §a{0}§b has been renamed to: §a{1}§b!
bot.WebSocketBot.session_authenticated=§bSession with an id §a{0}§b has been succesfully authenticated!
bot.WebSocketBot.failed_to_start.ip=§cFailed to start a server! The provided IP address is not a valid one!
bot.WebSocketBot.failed_to_start.port=§cFailed to start a server! The port number provided is out of the range, it must be 65535 or bellow it!
bot.WebSocketBot.failed_to_start.custom=§cFailed to start a server:\n\n{0}\n\n
bot.WebSocketBot.starting=Starting the Websocket server...
bot.WebSocketBot.started=§bServer started on ip §a{0}§b port: §a{1}
bot.WebSocketBot.new_session=§bNew session connected: §a{0}
bot.WebSocketBot.session_disconnected=§bSession with an id §a{0}§b has disconnected!
# TestBot # TestBot
botname.TestBot=TestBot botname.TestBot=TestBot
bot.testBot.told=Bot: {0} told me : {1} bot.testBot.told=Bot: {0} told me : {1}
@ -1030,3 +1041,10 @@ config.ChatBot.TelegramBridge.ChannelId=An ID of a channel where you want to int
config.ChatBot.TelegramBridge.Authorized_Chat_Ids=A list of Chat IDs that are allowed to send messages and execute commands. To get an id of your chat DM with the bot use ".chatid" bot command in Telegram. config.ChatBot.TelegramBridge.Authorized_Chat_Ids=A list of Chat IDs that are allowed to send messages and execute commands. To get an id of your chat DM with the bot use ".chatid" bot command in Telegram.
config.ChatBot.TelegramBridge.MessageSendTimeout=How long to wait (in seconds) if a message can not be sent to Telegram before canceling the task (minimum 1 second). config.ChatBot.TelegramBridge.MessageSendTimeout=How long to wait (in seconds) if a message can not be sent to Telegram before canceling the task (minimum 1 second).
config.ChatBot.TelegramBridge.Formats=Message formats\n# Words wrapped with { and } are going to be replaced during the code execution, do not change them!\n# For example. {message} is going to be replace with an actual message, {username} will be replaced with an username, {timestamp} with the current time.\n# For Telegram message formatting, check the following: https://sendpulse.com/blog/telegram-text-formatting config.ChatBot.TelegramBridge.Formats=Message formats\n# Words wrapped with { and } are going to be replaced during the code execution, do not change them!\n# For example. {message} is going to be replace with an actual message, {username} will be replaced with an username, {timestamp} with the current time.\n# For Telegram message formatting, check the following: https://sendpulse.com/blog/telegram-text-formatting
# ChatBot.WebSocketBot
config.ChatBot.WebSocketBot=Remotely control the client using Web Sockets.\n# This is useful if you want to implement an application that can remotely and asynchronously execute procedures in MCC.\n# Example implementation written in JavaScript: https://github.com/milutinke/MCC.js.git\n# The protocol specification will be available in the documentation soon.
config.ChatBot.WebSocketBot.Ip=The IP address that Websocket server will be bounded to.
config.ChatBot.WebSocketBot.Port=The Port that Websocket server will be bounded to.
config.ChatBot.WebSocketBot.Password=A password that will be used to authenticate on thw Websocket server (It is recommended to change the default password and to set a strong one).
config.ChatBot.WebSocketBot.DebugMode=If enabled the chat bot will print what is it recieving and sending when the "DebugMessages" are enabled in "Logging" section. This is useful when making your own library or trying to figure what is wrong with an existing one.

View file

@ -484,6 +484,7 @@ namespace MinecraftClient
case "tr": case "tr":
case "tr-TR": case "tr-TR":
gameLanguage = "tr_tr"; gameLanguage = "tr_tr";
name.Add("tr");
break; break;
case "tt": case "tt":
case "tt-RU": case "tt-RU":
@ -564,6 +565,9 @@ namespace MinecraftClient
case "ru_ru": case "ru_ru":
name.Add("ru"); name.Add("ru");
break; break;
case "tr_tr":
name.Add("tr");
break;
case "vi_vn": case "vi_vn":
name.Add("vi"); name.Add("vi");
break; break;
@ -659,7 +663,7 @@ namespace MinecraftClient
string[] transEn = DefaultConfigResource.ResourceManager.GetString("Translation_en")! string[] transEn = DefaultConfigResource.ResourceManager.GetString("Translation_en")!
.Split(new[] { "\r\n", "\r", "\n" }, StringSplitOptions.None); .Split(new[] { "\r\n", "\r", "\n" }, StringSplitOptions.None);
foreach (string lang in new string[] { "de", "fr", "ru", "vi", "zh-Hans", "zh-Hant" }) foreach (string lang in new string[] { "de", "fr", "ru", "tr", "vi", "zh-Hans", "zh-Hant" })
{ {
Dictionary<string, string> trans = ParseTranslationContent( Dictionary<string, string> trans = ParseTranslationContent(
DefaultConfigResource.ResourceManager.GetString("Translation_" + lang.Replace('-', '_'), System.Globalization.CultureInfo.InvariantCulture)! DefaultConfigResource.ResourceManager.GetString("Translation_" + lang.Replace('-', '_'), System.Globalization.CultureInfo.InvariantCulture)!