Skip to content

Commit dc7109c

Browse files
committed
fix english support
1 parent 5b4704c commit dc7109c

30 files changed

Lines changed: 3524 additions & 594 deletions

AddTaskWindow.xaml

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
66
xmlns:local="clr-namespace:TimeTask"
77
mc:Ignorable="d"
8+
Title="{local:Loc Key=AddTask_WindowTitle}"
89
Height="Auto" Width="400"
910
WindowStartupLocation="CenterScreen" SizeToContent="Height"
1011
WindowStyle="None" AllowsTransparency="True" Background="Transparent"
@@ -58,25 +59,25 @@
5859
<RowDefinition Height="Auto"/> <!-- Buttons StackPanel -->
5960
</Grid.RowDefinitions>
6061

61-
<TextBlock Grid.Row="0" Text="Task Description:" FontWeight="SemiBold"/>
62+
<TextBlock Grid.Row="0" Text="{local:Loc Key=AddTask_LabelDescription}" FontWeight="SemiBold"/>
6263
<TextBox Grid.Row="1" Name="TaskDescriptionTextBox" AcceptsReturn="True" TextWrapping="Wrap" VerticalScrollBarVisibility="Auto" Margin="0,5,0,10" MinHeight="60" BorderBrush="#CCCCCC" BorderThickness="1"/>
6364

6465
<Border Grid.Row="2" Name="ClarificationBorder" BorderBrush="OrangeRed" BorderThickness="1" Padding="5" Margin="0,0,0,10" Visibility="Collapsed">
6566
<StackPanel>
6667
<TextBlock Name="ClarificationPromptText" TextWrapping="Wrap" Foreground="OrangeRed" FontStyle="Italic" Margin="0,0,0,5" Visibility="Visible"/>
67-
<Button Name="ResetClarificationButton" Content="Edit Original Task / Reset" HorizontalAlignment="Left" Margin="0,5,0,0" Visibility="Visible" Click="ResetClarificationButton_Click"/>
68+
<Button Name="ResetClarificationButton" Content="{local:Loc Key=AddTask_ButtonResetClarification}" HorizontalAlignment="Left" Margin="0,5,0,0" Visibility="Visible" Click="ResetClarificationButton_Click"/>
6869
</StackPanel>
6970
</Border>
7071

71-
<TextBlock Grid.Row="3" Text="Add to List:" FontWeight="SemiBold" Margin="0,0,0,5"/>
72+
<TextBlock Grid.Row="3" Text="{local:Loc Key=AddTask_LabelList}" FontWeight="SemiBold" Margin="0,0,0,5"/>
7273
<TextBlock Grid.Row="4" Name="LlmSuggestionText" TextWrapping="Wrap" FontStyle="Italic" Margin="0,0,0,5" Visibility="Collapsed"/>
7374

74-
<CheckBox Grid.Row="5" Name="EnableReminderCheckBox" Content="Set Reminder" Margin="0,5,0,5" IsChecked="False"/>
75+
<CheckBox Grid.Row="5" Name="EnableReminderCheckBox" Content="{local:Loc Key=AddTask_EnableReminder}" Margin="0,5,0,5" IsChecked="False"/>
7576

7677
<StackPanel Grid.Row="6" Name="ReminderControlsPanel" Orientation="Vertical" Margin="0,0,0,10" Visibility="{Binding IsChecked, ElementName=EnableReminderCheckBox, Converter={StaticResource BooleanToVisibilityConverter}}">
77-
<TextBlock Text="Reminder Date:" Margin="0,0,0,2"/>
78+
<TextBlock Text="{local:Loc Key=AddTask_ReminderDate}" Margin="0,0,0,2"/>
7879
<DatePicker Name="ReminderDatePicker" Margin="0,0,0,5"/>
79-
<TextBlock Text="Reminder Time:" Margin="0,0,0,2"/>
80+
<TextBlock Text="{local:Loc Key=AddTask_ReminderTime}" Margin="0,0,0,2"/>
8081
<StackPanel Orientation="Horizontal">
8182
<ComboBox Name="ReminderHourComboBox" Width="50" Margin="0,0,5,0"/>
8283
<TextBlock Text=":" VerticalAlignment="Center"/>
@@ -87,14 +88,14 @@
8788
<ComboBox Grid.Row="7" Name="ListSelectorComboBox" Margin="0,0,0,15"/>
8889

8990
<StackPanel Grid.Row="8" Orientation="Horizontal" HorizontalAlignment="Right">
90-
<Button Name="AddTaskButton" Content="Add Task" Width="150" Margin="0,0,10,0" Click="AddTaskButton_Click">
91+
<Button Name="AddTaskButton" Content="{local:Loc Key=AddTask_ButtonAdd}" Width="150" Margin="0,0,10,0" Click="AddTaskButton_Click">
9192
<Button.Resources>
9293
<Style TargetType="Border">
9394
<Setter Property="CornerRadius" Value="5"/>
9495
</Style>
9596
</Button.Resources>
9697
</Button>
97-
<Button Name="CancelButton" Content="Cancel" Width="100" Click="CancelButton_Click">
98+
<Button Name="CancelButton" Content="{local:Loc Key=AddTask_ButtonCancel}" Width="100" Click="CancelButton_Click">
9899
<Button.Resources>
99100
<Style TargetType="Border">
100101
<Setter Property="CornerRadius" Value="5"/>

AddTaskWindow.xaml.cs

Lines changed: 28 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -50,10 +50,10 @@ private void InitializeCombobox(int? defaultQuadrantIndex)
5050
{
5151
// Populate ComboBox
5252
ListSelectorComboBox.ItemsSource = new List<string> {
53-
"重要且紧急", // Important & Urgent
54-
"重要不紧急", // Important & Not Urgent
55-
"不重要但紧急", // Not Important & Urgent
56-
"不重要不紧急" // Not Important & Not Urgent
53+
I18n.T("Quadrant_ImportantUrgent"),
54+
I18n.T("Quadrant_ImportantNotUrgent"),
55+
I18n.T("Quadrant_NotImportantUrgent"),
56+
I18n.T("Quadrant_NotImportantNotUrgent")
5757
};
5858
ListSelectorComboBox.SelectedIndex = 0; // Default to "重要且紧急"
5959

@@ -98,7 +98,16 @@ public void SetPreFilledTask(string description, string quadrant)
9898
{ "重要不紧急", 1 },
9999
{ "不重要但紧急", 2 },
100100
{ "不重要紧急", 2 }, // 兼容不同表述
101-
{ "不重要不紧急", 3 }
101+
{ "不重要不紧急", 3 },
102+
{ "Important & Urgent", 0 },
103+
{ "Important & Not Urgent", 1 },
104+
{ "Not Important but Urgent", 2 },
105+
{ "Not Important & Urgent", 2 },
106+
{ "Not Important & Not Urgent", 3 },
107+
{ I18n.T("Quadrant_ImportantUrgent"), 0 },
108+
{ I18n.T("Quadrant_ImportantNotUrgent"), 1 },
109+
{ I18n.T("Quadrant_NotImportantUrgent"), 2 },
110+
{ I18n.T("Quadrant_NotImportantNotUrgent"), 3 }
102111
};
103112

104113
if (quadrantMap.TryGetValue(quadrant, out int index))
@@ -122,7 +131,7 @@ private void ResetClarificationButton_Click(object sender, RoutedEventArgs e)
122131
ClarificationBorder.Visibility = Visibility.Collapsed; // Changed
123132
// ClarificationPromptText.Visibility = Visibility.Collapsed; // Old
124133
// ResetClarificationButton.Visibility = Visibility.Collapsed; // Old
125-
AddTaskButton.Content = "Add Task";
134+
AddTaskButton.Content = I18n.T("AddTask_ButtonAdd");
126135
_isClarificationRound = false;
127136
TaskDescriptionTextBox.Focus(); // Set focus back to the textbox
128137
}
@@ -135,13 +144,13 @@ private async void AddTaskButton_Click(object sender, RoutedEventArgs e)
135144

136145
if (string.IsNullOrWhiteSpace(currentTaskDescription))
137146
{
138-
MessageBox.Show("Task description cannot be empty.", "Validation Error", MessageBoxButton.OK, MessageBoxImage.Error);
147+
MessageBox.Show(I18n.T("AddTask_ErrorEmptyDescription"), I18n.T("AddTask_TitleValidationError"), MessageBoxButton.OK, MessageBoxImage.Error);
139148
return;
140149
}
141150

142151
if (SelectedListIndex < 0)
143152
{
144-
MessageBox.Show("Please select a list.", "Validation Error", MessageBoxButton.OK, MessageBoxImage.Error);
153+
MessageBox.Show(I18n.T("AddTask_ErrorSelectList"), I18n.T("AddTask_TitleValidationError"), MessageBoxButton.OK, MessageBoxImage.Error);
145154
return;
146155
}
147156

@@ -161,8 +170,8 @@ private async void AddTaskButton_Click(object sender, RoutedEventArgs e)
161170
// string configErrorSubstring is now defined at the beginning of the method
162171
if (!_isLlmConfigErrorNotified && question != null && question.Contains(configErrorSubstring))
163172
{
164-
MessageBox.Show("The AI assistant features may be limited due to a configuration issue (e.g., missing or placeholder API key). Please check the application's setup if you expect full AI functionality.",
165-
"LLM Configuration Issue", MessageBoxButton.OK, MessageBoxImage.Warning);
173+
MessageBox.Show(I18n.T("AddTask_LlmConfigIssueText"),
174+
I18n.T("AddTask_LlmConfigIssueTitle"), MessageBoxButton.OK, MessageBoxImage.Warning);
166175
_isLlmConfigErrorNotified = true;
167176
}
168177

@@ -172,7 +181,7 @@ private async void AddTaskButton_Click(object sender, RoutedEventArgs e)
172181
ClarificationBorder.Visibility = Visibility.Visible; // Changed
173182
// ClarificationPromptText.Visibility = Visibility.Visible; // Old
174183
// ResetClarificationButton.Visibility = Visibility.Visible; // Old
175-
AddTaskButton.Content = "Submit Clarified Task";
184+
AddTaskButton.Content = I18n.T("AddTask_ButtonSubmitClarified");
176185
_isClarificationRound = true;
177186
TaskDescriptionTextBox.Focus(); // Focus on textbox for user to edit
178187
return; // Wait for user to clarify
@@ -191,8 +200,8 @@ private async void AddTaskButton_Click(object sender, RoutedEventArgs e)
191200
((llmImportance != null && llmImportance.Contains(configErrorSubstring)) ||
192201
(llmUrgency != null && llmUrgency.Contains(configErrorSubstring))))
193202
{
194-
MessageBox.Show("The AI assistant features may be limited due to a configuration issue (e.g., missing or placeholder API key). Please check the application's setup if you expect full AI functionality.",
195-
"LLM Configuration Issue", MessageBoxButton.OK, MessageBoxImage.Warning);
203+
MessageBox.Show(I18n.T("AddTask_LlmConfigIssueText"),
204+
I18n.T("AddTask_LlmConfigIssueTitle"), MessageBoxButton.OK, MessageBoxImage.Warning);
196205
_isLlmConfigErrorNotified = true;
197206
}
198207

@@ -204,13 +213,13 @@ private async void AddTaskButton_Click(object sender, RoutedEventArgs e)
204213
if (suggestedIndex != -1 && ListSelectorComboBox.SelectedItem != null)
205214
{
206215
string label = ListSelectorComboBox.SelectedItem as string;
207-
LlmSuggestionText.Text = $"AI建议象限({sourceTag}): {label}";
216+
LlmSuggestionText.Text = I18n.Tf("AddTask_SuggestionFormat", sourceTag, label);
208217
LlmSuggestionText.Visibility = Visibility.Visible;
209218
}
210219
else
211220
{
212221
// Handle cases where suggestion is ambiguous or mapping fails
213-
LlmSuggestionText.Text = "AI建议暂不可用,请手动选择象限。";
222+
LlmSuggestionText.Text = I18n.T("AddTask_SuggestionUnavailable");
214223
LlmSuggestionText.Visibility = Visibility.Collapsed; // Or Visible with a different message
215224
}
216225
// --- End LLM Suggestion Logic ---
@@ -262,7 +271,7 @@ private async void AddTaskButton_Click(object sender, RoutedEventArgs e)
262271
}
263272
catch (Exception ex)
264273
{
265-
MessageBox.Show($"An error occurred: {ex.Message}", "Error", MessageBoxButton.OK, MessageBoxImage.Error);
274+
MessageBox.Show(I18n.Tf("AddTask_ErrorOccurredFormat", ex.Message), I18n.T("Title_Error"), MessageBoxButton.OK, MessageBoxImage.Error);
266275
// Consider how to handle state if error occurs mid-process
267276
// For now, re-enable buttons and let user retry or cancel
268277
}
@@ -338,16 +347,16 @@ private static bool IsKnownPriority(string value)
338347

339348
if (llmValid)
340349
{
341-
return (llmImportance, llmUrgency, "LLM");
350+
return (llmImportance, llmUrgency, I18n.T("AddTask_SourceLlm"));
342351
}
343352

344353
bool ruleValid = IsKnownPriority(ruleImportance) && IsKnownPriority(ruleUrgency);
345354
if (ruleValid)
346355
{
347-
return (ruleImportance, ruleUrgency, "规则");
356+
return (ruleImportance, ruleUrgency, I18n.T("AddTask_SourceRule"));
348357
}
349358

350-
return ("Medium", "Low", "默认");
359+
return ("Medium", "Low", I18n.T("AddTask_SourceDefault"));
351360
}
352361

353362
private static bool ContainsDummy(string value)

App.config

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,10 @@
1717
<add key="LlmRequestTimeoutSeconds" value="120" />
1818
<!-- 自动更新(优先使用 GitHub Releases) -->
1919
<add key="AutoUpdateEnabled" value="true" />
20-
<add key="AutoUpdateGithubOwner" value="YOUR_GITHUB_OWNER" />
21-
<add key="AutoUpdateGithubRepo" value="YOUR_GITHUB_REPO" />
20+
<add key="AutoUpdateGithubOwner" value="showkeyjar" />
21+
<add key="AutoUpdateGithubRepo" value="TimeTask" />
2222
<!-- 可选:仅匹配包含该关键字的 zip 资产名称;留空则取第一个 zip -->
23-
<add key="AutoUpdateGithubAssetNameContains" value="" />
23+
<add key="AutoUpdateGithubAssetNameContains" value="TimeTask-win-x64" />
2424
<!-- true 时从 releases 列表中选最新(可含预发布);false 时走 latest(仅稳定版) -->
2525
<add key="AutoUpdateGithubIncludePrerelease" value="false" />
2626
<!-- 可选兜底:若未配置 GitHub,可改用自定义 manifest -->
@@ -95,7 +95,7 @@
9595
<add key="LlmSkillAssistEnabled" value="true" />
9696
<!-- 低打断交互:尽量使用轻提示而不是阻塞式确认框 -->
9797
<add key="NonBlockingInteractionEnabled" value="true" />
98-
<add key="EnabledSkillIds" value="decompose,focus_sprint,priority_rebalance,risk_check,delegate_prepare,clarify_goal" />
98+
<add key="EnabledSkillIds" value="decompose,focus_sprint,priority_rebalance,risk_check,delegate_prepare,clarify_goal,five_whys,first_principles,pareto_80_20,swot_scan,premortem,ooda_loop,smart_goal,cost_benefit" />
9999
<!-- 安静时段(24小时制,跨天区间) -->
100100
<add key="QuietHoursStart" value="22" />
101101
<add key="QuietHoursEnd" value="8" />

AutoUpdateService.cs

Lines changed: 33 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@ internal sealed class AutoUpdateService
2121
private const string PlaceholderManifestUrl = "YOUR_UPDATE_MANIFEST_URL";
2222
private const string PlaceholderGithubOwner = "YOUR_GITHUB_OWNER";
2323
private const string PlaceholderGithubRepo = "YOUR_GITHUB_REPO";
24+
private const string DefaultGithubOwner = "showkeyjar";
25+
private const string DefaultGithubRepo = "TimeTask";
2426
private readonly Dispatcher _dispatcher;
2527

2628
public AutoUpdateService(Dispatcher dispatcher)
@@ -56,17 +58,18 @@ private async Task CheckForUpdatesAsync()
5658
return;
5759
}
5860

59-
Version currentVersion = Assembly.GetExecutingAssembly().GetName().Version ?? new Version(1, 0, 0, 0);
60-
if (updateInfo.Version <= currentVersion)
61+
Version currentVersion = NormalizeVersion(Assembly.GetExecutingAssembly().GetName().Version ?? new Version(1, 0, 0, 0));
62+
Version latestVersion = NormalizeVersion(updateInfo.Version);
63+
if (latestVersion <= currentVersion)
6164
{
62-
VoiceRuntimeLog.Info($"Auto update: no update. Current={currentVersion}, Latest={updateInfo.Version}");
65+
VoiceRuntimeLog.Info($"Auto update: no update. Current={currentVersion}, Latest={latestVersion}");
6366
return;
6467
}
6568

6669
bool shouldInstall = await _dispatcher.InvokeAsync(() =>
6770
{
6871
var result = MessageBox.Show(
69-
$"检测到新版本:{updateInfo.Version}(当前:{currentVersion})。\n\n是否立即下载并在重启后完成更新?",
72+
$"检测到新版本:{latestVersion}(当前:{currentVersion})。\n\n是否立即下载并在重启后完成更新?",
7073
"发现新版本",
7174
MessageBoxButton.YesNo,
7275
MessageBoxImage.Information);
@@ -102,15 +105,16 @@ private async Task<UpdatePackageInfo> TryGetFromGithubReleasesAsync(HttpClient h
102105
string owner = (ConfigurationManager.AppSettings["AutoUpdateGithubOwner"] ?? string.Empty).Trim();
103106
string repo = (ConfigurationManager.AppSettings["AutoUpdateGithubRepo"] ?? string.Empty).Trim();
104107

105-
if (string.IsNullOrWhiteSpace(owner) || string.IsNullOrWhiteSpace(repo))
108+
if (string.IsNullOrWhiteSpace(owner) ||
109+
string.Equals(owner, PlaceholderGithubOwner, StringComparison.OrdinalIgnoreCase))
106110
{
107-
return null;
111+
owner = DefaultGithubOwner;
108112
}
109113

110-
if (string.Equals(owner, PlaceholderGithubOwner, StringComparison.OrdinalIgnoreCase) ||
114+
if (string.IsNullOrWhiteSpace(repo) ||
111115
string.Equals(repo, PlaceholderGithubRepo, StringComparison.OrdinalIgnoreCase))
112116
{
113-
return null;
117+
repo = DefaultGithubRepo;
114118
}
115119

116120
bool includePrerelease = GetBool("AutoUpdateGithubIncludePrerelease", false);
@@ -393,8 +397,27 @@ private static Version ParseVersion(string versionText)
393397
normalized = normalized.Substring(1);
394398
}
395399

396-
Version version;
397-
return Version.TryParse(normalized, out version) ? version : null;
400+
Version version;
401+
if (!Version.TryParse(normalized, out version))
402+
{
403+
return null;
404+
}
405+
406+
return NormalizeVersion(version);
407+
}
408+
409+
private static Version NormalizeVersion(Version version)
410+
{
411+
if (version == null)
412+
{
413+
return new Version(0, 0, 0, 0);
414+
}
415+
416+
int major = Math.Max(0, version.Major);
417+
int minor = Math.Max(0, version.Minor);
418+
int build = version.Build >= 0 ? version.Build : 0;
419+
int revision = version.Revision >= 0 ? version.Revision : 0;
420+
return new Version(major, minor, build, revision);
398421
}
399422

400423
private static bool GetBool(string key, bool defaultValue)

0 commit comments

Comments
 (0)