Extended the localization system to easily include additional languages in the future

This commit is contained in:
Junior 2023-10-07 00:08:43 -03:00
parent d5ec712d0f
commit ae34584021
50 changed files with 45079 additions and 24129 deletions

View file

@ -73,6 +73,9 @@
TitleLabelS2 = new Label();
imageListTips = new ImageList(components);
imageListOkBtn = new ImageList(components);
imageListSendEmailBtn_ko = new ImageList(components);
imageListOKBtn_ko = new ImageList(components);
imageListContinueBtn_ko = new ImageList(components);
Stage1Panel.SuspendLayout();
((System.ComponentModel.ISupportInitialize)EmailPictureBox).BeginInit();
((System.ComponentModel.ISupportInitialize)CodePictureBox).BeginInit();
@ -683,6 +686,33 @@
imageListOkBtn.Images.SetKeyName(1, "messagewnd.button.ok.active.png");
imageListOkBtn.Images.SetKeyName(2, "messagewnd.button.ok.down.png");
//
// imageListSendEmailBtn_ko
//
imageListSendEmailBtn_ko.ColorDepth = ColorDepth.Depth32Bit;
imageListSendEmailBtn_ko.ImageStream = (ImageListStreamer)resources.GetObject("imageListSendEmailBtn_ko.ImageStream");
imageListSendEmailBtn_ko.TransparentColor = Color.Transparent;
imageListSendEmailBtn_ko.Images.SetKeyName(0, "ChangePwwnd_button_email_normal_ko.png");
imageListSendEmailBtn_ko.Images.SetKeyName(1, "ChangePwwnd_button_email_active_ko.png");
imageListSendEmailBtn_ko.Images.SetKeyName(2, "ChangePwwnd_button_email_down_ko.png");
//
// imageListOKBtn_ko
//
imageListOKBtn_ko.ColorDepth = ColorDepth.Depth32Bit;
imageListOKBtn_ko.ImageStream = (ImageListStreamer)resources.GetObject("imageListOKBtn_ko.ImageStream");
imageListOKBtn_ko.TransparentColor = Color.Transparent;
imageListOKBtn_ko.Images.SetKeyName(0, "messagewnd.button.ok.normal.png");
imageListOKBtn_ko.Images.SetKeyName(1, "messagewnd.button.ok.active.png");
imageListOKBtn_ko.Images.SetKeyName(2, "messagewnd.button.ok.down.png");
//
// imageListContinueBtn_ko
//
imageListContinueBtn_ko.ColorDepth = ColorDepth.Depth32Bit;
imageListContinueBtn_ko.ImageStream = (ImageListStreamer)resources.GetObject("imageListContinueBtn_ko.ImageStream");
imageListContinueBtn_ko.TransparentColor = Color.Transparent;
imageListContinueBtn_ko.Images.SetKeyName(0, "Registerwnd_button_continue_normal_ko.png");
imageListContinueBtn_ko.Images.SetKeyName(1, "Registerwnd_button_continue_active_ko.png");
imageListContinueBtn_ko.Images.SetKeyName(2, "Registerwnd_button_continue_down_ko.png");
//
// RegForm
//
AutoScaleDimensions = new SizeF(7F, 15F);
@ -693,14 +723,14 @@
ClientSize = new Size(800, 571);
Controls.Add(CloseButton);
Controls.Add(MinimizeButton);
Controls.Add(Stage2Panel);
Controls.Add(Stage1Panel);
Controls.Add(Stage2Panel);
DoubleBuffered = true;
FormBorderStyle = FormBorderStyle.None;
Icon = (Icon)resources.GetObject("$this.Icon");
Name = "RegForm";
StartPosition = FormStartPosition.CenterScreen;
Text = "Change Password";
Text = "Register Account";
FormClosing += RegForm_FormClosing;
Load += RegForm_Load;
Stage1Panel.ResumeLayout(false);
@ -760,5 +790,8 @@
private CheckBox AgreeCheckBox;
private Label AgreementLabel;
private Label PwdStrengthLabel;
private ImageList imageListSendEmailBtn_ko;
private ImageList imageListOKBtn_ko;
private ImageList imageListContinueBtn_ko;
}
}

View file

@ -11,6 +11,10 @@ namespace RHLauncher
public string AgreementUrl = Configuration.Default.AgreementUrl;
public string VerifyCodeUrl = Configuration.Default.VerifyCodeUrl;
public string RegisterUrl = Configuration.Default.RegisterUrl;
public string Lang = Configuration.Default.Lang;
private List<Button>? buttons;
private List<ImageList>? imageLists;
private Dictionary<string, List<ImageList>>? languageImageLists;
private readonly System.Windows.Forms.Timer resendTimer = new();
private int secondsLeft = 60;
@ -22,6 +26,25 @@ namespace RHLauncher
Stage1Panel.Visible = true;
Stage2Panel.Visible = false;
LoadLocalizedStrings();
Text = LocalizedStrings.ChangePwdFormTitle;
EmailLabel.Text = LocalizedStrings.AccountEmail;
TitleLabelS1.Text = LocalizedStrings.RegisterAccount;
SubTitleLabelS1.Text = LocalizedStrings.RustyHearts;
CodeLabel.Text = LocalizedStrings.VerificationCode;
TitleLabelS2.Text = LocalizedStrings.AccountDetails;
SubTitleLabelS2.Text = LocalizedStrings.Account;
NameLabel.Text = LocalizedStrings.AccountName;
PasswordLabel.Text = LocalizedStrings.EnterPassword;
RepeatPasswordLabel.Text = LocalizedStrings.RepeatPassword;
AgreeCheckBox.Text = LocalizedStrings.AgreeTerms;
AgreementLabel.Text = LocalizedStrings.UserAgreement;
NameDescLabel.Text = LocalizedStrings.UsernameDesc;
PwdDescLabel.Text = LocalizedStrings.NewPasswordDesc;
PwdConfirmDescLabel.Text = LocalizedStrings.RepeatPasswordDesc;
ReturnLabelS2.Text = LocalizedStrings.Return;
resendTimer = new System.Windows.Forms.Timer
{
Interval = 1000
@ -29,6 +52,24 @@ namespace RHLauncher
resendTimer.Tick += ResendTimer_Tick;
}
private void LoadLocalizedStrings()
{
// Initialize buttons and image lists
buttons = new List<Button> { ContinueButtonS1, SendEmailButton, ContinueButtonS2 };
imageLists = new List<ImageList> { imageListContinueBtn, imageListSendEmailBtn, imageListContinueBtn };
// Initialize language-specific image lists
languageImageLists = new Dictionary<string, List<ImageList>>
{
{ "en", new List<ImageList> { imageListContinueBtn, imageListSendEmailBtn, imageListContinueBtn } }, // English image lists
{ "ko", new List<ImageList> { imageListContinueBtn_ko, imageListSendEmailBtn_ko, imageListContinueBtn_ko } }, // Korean image lists
// Add other languages and their respective image lists here
};
// Load the appropriate resource file based on the selected language
LocalizationHelper.LoadLocalizedStrings(Lang, buttons, imageLists, languageImageLists);
}
#region Methods
private async Task<string> SendEmailRequestAsync()

File diff suppressed because it is too large Load diff