Skip to content

Commit 121d796

Browse files
committed
v0.7.1.1 - Fix partitionTable > textbox txtName placholder's theme not updated after changing Language
1 parent d445fad commit 121d796

6 files changed

Lines changed: 64 additions & 12 deletions

File tree

LICENSE

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,15 @@
11
# MIT License
22

3+
---
4+
35
Copyright (c) 2025 QuickComp.
46

7+
---
8+
59
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
610

711
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
812

913
THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
14+
15+
---

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# QuickWinstall
22

3-
![Version](https://img.shields.io/badge/version-0.7.1-blue)
3+
![Version](https://img.shields.io/badge/version-0.7.1.1-blue)
44
![License](https://img.shields.io/badge/license-Free%20Open%20Source-green)
55
![Platform](https://img.shields.io/badge/platform-Windows-lightgrey)
66
![DEV](https://img.shields.io/badge/status-in_development-orange)

src/config/DiskPartConfig.cs

Lines changed: 25 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1234,12 +1234,34 @@ private void OnToggleEnableAutoDiskPart()
12341234
}
12351235

12361236
/// <summary>
1237-
/// Checks if a partition name textbox contains placeholder text
1237+
/// Checks if a partition name textbox contains placeholder text from any language
12381238
/// </summary>
12391239
private bool IsPlaceholderText(TextBox txtName)
12401240
{
1241-
string placeholderText = LangManager.Instance.GetString("diskPartConfig.partitionTable.namePlaceholder");
1242-
return txtName.Text == placeholderText;
1241+
if (string.IsNullOrWhiteSpace(txtName.Text))
1242+
return false;
1243+
1244+
// Get the current language's placeholder text
1245+
string currentPlaceholder = LangManager.Instance.GetString("diskPartConfig.partitionTable.namePlaceholder");
1246+
if (txtName.Text == currentPlaceholder)
1247+
return true;
1248+
1249+
// Check against all available language placeholders to handle language switches
1250+
LangManager langMgr = LangManager.Instance;
1251+
var availableLanguages = langMgr.GetAvailableLanguages();
1252+
string currentLang = langMgr.CurrentLanguage;
1253+
1254+
foreach (var lang in availableLanguages)
1255+
{
1256+
if (lang == currentLang) continue; // Already checked above
1257+
1258+
// Get placeholder text from specific language without switching
1259+
string? placeholder = langMgr.GetStringFromLanguage("diskPartConfig.partitionTable.namePlaceholder", lang);
1260+
if (!string.IsNullOrEmpty(placeholder) && txtName.Text == placeholder)
1261+
return true;
1262+
}
1263+
1264+
return false;
12431265
}
12441266

12451267
/// <summary>

src/config/UserAccConfig.cs

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -175,14 +175,14 @@ public Panel InitializeUI(Panel parentContainer, EventHandler onConfigChanged,
175175
lblUserAccConfigTitle = new Label();
176176
lblUserAccConfigTitle.Location = new Point(btnUserAccConfigToggle.Right + ui.GlobalSpacingX, ui.GlobalSpacingY + (ui.GlobalBtnBox - ui.GlobalLabelHeight) / 2);
177177
lblUserAccConfigTitle.Size = new Size(ui.GlobalLabelWidth * 2, ui.GlobalLabelHeight);
178-
lblUserAccConfigTitle.Text = lang.GetString("mainForm.sections.UserAcc");
178+
lblUserAccConfigTitle.Text = lang.GetString("mainForm.sections.userAcc");
179179
lblUserAccConfigTitle.Font = theme.GetFont("subheader");
180180
lblUserAccConfigTitle.UseMnemonic = false;
181181
lblUserAccConfigTitle.ForeColor = theme.GetFontColor("subheader");
182182
lblUserAccConfigTitle.TextAlign = ContentAlignment.MiddleLeft;
183183
lblUserAccConfigTitle.Cursor = Cursors.Hand;
184184
lblUserAccConfigTitle.Click += (sender, e) => ToggleSection();
185-
tooltips.SetToolTip(lblUserAccConfigTitle, "tooltips.UserAccConfig.header", lang.GetString("tooltips.UserAccConfig.header"));
185+
tooltips.SetToolTip(lblUserAccConfigTitle, "tooltips.userAccConfig.header", lang.GetString("tooltips.UserAccConfig.header"));
186186

187187

188188
int toggleWidth = (int)(ui.GlobalInputWidth * 0.15);
@@ -201,12 +201,12 @@ public Panel InitializeUI(Panel parentContainer, EventHandler onConfigChanged,
201201
lblEnableUserAcc = new Label();
202202
lblEnableUserAcc.Location = new Point(toggleEnableUserAcc.Right + ui.GlobalSpacingX, btnUserAccConfigToggle.Bottom + ui.GlobalSpacingY);
203203
lblEnableUserAcc.Size = new Size(ui.GlobalLabelWidth * 2, ui.GlobalLabelHeight);
204-
lblEnableUserAcc.Text = string.Format(lang.GetString("UserAccConfig.enableUserAcc.label", lang.GetString("mainForm.sections.UserAcc")));
204+
lblEnableUserAcc.Text = string.Format(lang.GetString("userAccConfig.enableUserAcc.label", lang.GetString("mainForm.sections.userAcc")));
205205
lblEnableUserAcc.Font = theme.GetFont("normal");
206206
lblEnableUserAcc.TextAlign = ContentAlignment.MiddleLeft;
207207
lblEnableUserAcc.Cursor = Cursors.Hand;
208208
lblEnableUserAcc.Click += (s, e) => OnToggleEnableUserAcc();
209-
tooltips.SetToolTip(lblEnableUserAcc, "tooltips.UserAccConfig.enableUserAcc");
209+
tooltips.SetToolTip(lblEnableUserAcc, "tooltips.userAccConfig.enableUserAcc");
210210

211211
// Line Separator
212212
pnlUserAccConfigSeparator = new Panel();
@@ -230,12 +230,11 @@ public Panel InitializeUI(Panel parentContainer, EventHandler onConfigChanged,
230230
lblEnableAutoUserAcc = new Label();
231231
lblEnableAutoUserAcc.Location = new Point(labelX, currentY);
232232
lblEnableAutoUserAcc.Size = new Size(ui.GlobalLabelWidth * 2, ui.GlobalLabelHeight);
233-
lblEnableAutoUserAcc.Text = lang.GetString("UserAccConfig.enableAutoUserAcc.label");
233+
lblEnableAutoUserAcc.Text = lang.GetString("userAccConfig.enableAutoUserAcc.label");
234234
lblEnableAutoUserAcc.Font = theme.GetFont("normal");
235235
lblEnableAutoUserAcc.TextAlign = ContentAlignment.MiddleLeft;
236236
lblEnableAutoUserAcc.Cursor = Cursors.Hand;
237-
tooltips.SetToolTip(lblEnableAutoUserAcc, "tooltips.UserAccConfig.enableAutoUserAcc");
238-
237+
tooltips.SetToolTip(lblEnableAutoUserAcc, "tooltips.userAccConfig.enableAutoUserAcc");
239238
toggleEnableAutoUserAcc = theme.CreateToggleSwitch(new Point(toggleX, currentY), toggleWidth, ui.GlobalInputHeight, true);
240239
toggleEnableAutoUserAcc.Click += (s, e) => OnToggleEnableAutoUserAcc();
241240

src/lib/LangManager.cs

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -194,5 +194,30 @@ public List<string> GetAvailableLanguages()
194194

195195
return languages;
196196
}
197+
198+
/// <summary>
199+
/// Gets a translated string from a specific language without switching the current language
200+
/// </summary>
201+
/// <param name="key">The translation key</param>
202+
/// <param name="langCode">The language code (e.g., "en-US", "vi-VN")</param>
203+
/// <returns>The translated string or null if not found</returns>
204+
public string? GetStringFromLanguage(string key, string langCode)
205+
{
206+
try
207+
{
208+
string langFilePath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "res", "langs", $"{langCode}.json");
209+
if (!File.Exists(langFilePath))
210+
return null;
211+
212+
string jsonContent = File.ReadAllText(langFilePath);
213+
JObject? langJson = JObject.Parse(jsonContent);
214+
return GetValueFromJson(langJson, key);
215+
}
216+
catch (Exception ex)
217+
{
218+
Console.WriteLine($"Warning: Failed to get string '{key}' from language '{langCode}': {ex.Message}");
219+
return null;
220+
}
221+
}
197222
}
198223
}

src/main/AboutForm.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ public partial class AboutForm : Form
1414
private readonly UIValues _uiValues;
1515

1616
// Version
17-
public string appVersion = "0.7.1";
17+
public string appVersion = "0.7.1.1";
1818
public bool _isSEdition = true;
1919
public string sEdition = "Get Ready for UserAccount Config";
2020

0 commit comments

Comments
 (0)