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_basic_io=Please type the password for {0}.
///mcc.password_hidden=Password(invisible): {0}
///mcc.off [rest of string was truncated]";.
///mcc.offline=§8You [rest of string was truncated]";.
/// </summary>
internal static string Translation_en {
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>
/// Looks up a localized string similar to [mcc]
///# Messages from MCC itself

View file

@ -1,17 +1,17 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
@ -26,36 +26,36 @@
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
@ -160,6 +160,9 @@
<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>
</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">
<value>Resources\lang\vi.ini;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;utf-8</value>
</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.pausing=Pausing!
cmd.follow.player_left=The player {0} left the server!
cmd.follow.stopping=Stopped!
cmd.follow.stopped=Stopped!
# HangmanGame
botname.HangmanGame=HangmanGame
@ -770,6 +770,17 @@ bot.TelegramBridge.direction.both=Both
bot.TelegramBridge.direction.minecraft=Minecraft
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
botname.TestBot=TestBot
bot.testBot.told=Bot: {0} told me : {1}
@ -1029,4 +1040,11 @@ config.ChatBot.TelegramBridge.Token=Your Telegram Bot token.
config.ChatBot.TelegramBridge.ChannelId=An ID of a channel where you want to interact with the MCC using the bot.
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.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-TR":
gameLanguage = "tr_tr";
name.Add("tr");
break;
case "tt":
case "tt-RU":
@ -564,6 +565,9 @@ namespace MinecraftClient
case "ru_ru":
name.Add("ru");
break;
case "tr_tr":
name.Add("tr");
break;
case "vi_vn":
name.Add("vi");
break;
@ -659,7 +663,7 @@ namespace MinecraftClient
string[] transEn = DefaultConfigResource.ResourceManager.GetString("Translation_en")!
.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(
DefaultConfigResource.ResourceManager.GetString("Translation_" + lang.Replace('-', '_'), System.Globalization.CultureInfo.InvariantCulture)!