mirror of
https://github.com/microsoft/PowerToys.git
synced 2024-12-14 19:49:15 +08:00
add translation for crash reporter
This commit is contained in:
parent
5be6511529
commit
acfad7ec5b
@ -2,6 +2,7 @@
|
||||
import json
|
||||
import sys
|
||||
import inspect
|
||||
import chardet
|
||||
|
||||
class Wox(object):
|
||||
"""
|
||||
@ -9,7 +10,7 @@ class Wox(object):
|
||||
"""
|
||||
|
||||
def __init__(self):
|
||||
rpc_request = json.loads(sys.argv[1],encoding="gb2312")
|
||||
rpc_request = json.loads(sys.argv[1],encoding=chardet.detect(sys.argv[1])["encoding"])
|
||||
self.proxy = rpc_request.get("proxy",{})
|
||||
request_method_name = rpc_request.get("method")
|
||||
request_parameters = rpc_request.get("parameters")
|
||||
|
@ -9,11 +9,12 @@
|
||||
Topmost="True"
|
||||
ResizeMode="NoResize"
|
||||
Width="600"
|
||||
Height="450"
|
||||
Height="455"
|
||||
Title="{DynamicResource reportWindow_wox_got_an_error}"
|
||||
d:DesignHeight="300" d:DesignWidth="600" x:ClassModifier="internal">
|
||||
<StackPanel>
|
||||
<TabControl >
|
||||
<TabItem Header="General">
|
||||
<TabItem Header="{DynamicResource reportWindow_general}">
|
||||
<Grid>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="100"></ColumnDefinition>
|
||||
@ -29,15 +30,15 @@
|
||||
</Grid.RowDefinitions>
|
||||
<Image Source="Images/crash_warning.png" Width="64"></Image>
|
||||
<RichTextBox Grid.Row="0" Grid.ColumnSpan="3" Grid.Column="1" IsReadOnly="True" x:Name="tbSummary"></RichTextBox>
|
||||
<TextBlock Padding="0 5 0 0" Grid.Row="1" Grid.Column="0" Text="Version"></TextBlock>
|
||||
<TextBlock Padding="0 5 0 0" Grid.Row="1" Grid.Column="0" Text="{DynamicResource reportWindow_version}"></TextBlock>
|
||||
<TextBlock Padding="0 5 0 0" Grid.Row="1" Grid.Column="1" Text="Version" x:Name="tbVersion"></TextBlock>
|
||||
<TextBlock Padding="0 5 0 0" Grid.Row="1" Grid.Column="2" Text="Time"></TextBlock>
|
||||
<TextBlock Padding="0 5 0 0" Grid.Row="1" Grid.Column="2" Text="{DynamicResource reportWindow_time}"></TextBlock>
|
||||
<TextBlock Padding="0 5 0 0" Grid.Row="1" Grid.Column="3" Text="10201211-21-21" x:Name="tbDatetime"></TextBlock>
|
||||
<TextBlock Padding="0 5 0 0" Grid.ColumnSpan="4" Grid.Row="2" Grid.Column="0" Text="Please tell us how application crashed so we can fix it"></TextBlock>
|
||||
<TextBlock Padding="0 5 0 5" Grid.ColumnSpan="4" Grid.Row="2" Grid.Column="0" Text="{DynamicResource reportWindow_reproduce}"></TextBlock>
|
||||
<RichTextBox Grid.Row="3" Grid.ColumnSpan="4" Grid.Column="0" Background="#FFFFE1"></RichTextBox>
|
||||
</Grid>
|
||||
</TabItem>
|
||||
<TabItem Header="Exceptions">
|
||||
<TabItem Header="{DynamicResource reportWindow_exceptions}">
|
||||
<Grid>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="37*"/>
|
||||
@ -51,12 +52,12 @@
|
||||
<RowDefinition></RowDefinition>
|
||||
<RowDefinition></RowDefinition>
|
||||
</Grid.RowDefinitions>
|
||||
<TextBlock Grid.Row="0" Text="Exception Type" Padding="5" Grid.ColumnSpan="2"></TextBlock>
|
||||
<TextBlock Grid.Row="0" Text="{DynamicResource reportWindow_exception_type}" Padding="5" Grid.ColumnSpan="2"></TextBlock>
|
||||
<TextBox IsReadOnly="True" Grid.Row="1" Padding="5" x:Name="tbType" Grid.ColumnSpan="2"></TextBox>
|
||||
<TextBlock Grid.Row="2" Text="Source" Padding="5" Grid.ColumnSpan="2"></TextBlock>
|
||||
<TextBlock Grid.Row="2" Text="{DynamicResource reportWindow_source}" Padding="5" Grid.ColumnSpan="2"></TextBlock>
|
||||
<TextBox IsReadOnly="True" Grid.Row="3" Padding="5" x:Name="tbSource" Grid.ColumnSpan="2"></TextBox>
|
||||
<TextBlock Grid.Row="4" Text="Stack Trace" Padding="5" Grid.ColumnSpan="2"></TextBlock>
|
||||
<RichTextBox Grid.Row="5" x:Name="tbStackTrace" Height="185" Grid.ColumnSpan="2" Margin="0,0,0,-0.001"></RichTextBox>
|
||||
<TextBlock Grid.Row="4" Text="{DynamicResource reportWindow_stack_trace}" Padding="5" Grid.ColumnSpan="2"></TextBlock>
|
||||
<RichTextBox Grid.Row="5" x:Name="tbStackTrace" Height="190" Grid.ColumnSpan="2" Margin="0,0,0,-0.001"></RichTextBox>
|
||||
</Grid>
|
||||
</TabItem>
|
||||
</TabControl>
|
||||
@ -64,13 +65,13 @@
|
||||
<Button x:Name="btnSend" Padding="8 3" Margin="8" Click="btnSend_Click">
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<Image Source="Images/crash_go.png" Margin="0 5 5 0"/>
|
||||
<Label Padding="0" Margin="0 10 0 0" x:Name="tbSendReport">Send Report</Label>
|
||||
<Label Padding="0" Margin="0 10 0 0" x:Name="tbSendReport" Content="{DynamicResource reportWindow_send_report}"></Label>
|
||||
</StackPanel>
|
||||
</Button>
|
||||
<Button x:Name="btnCancel" Padding="8 3" Margin="8" Click="btnCancel_Click">
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<Image Source="Images/crash_stop.png" Margin="0 5 5 0"/>
|
||||
<Label Padding="0" Margin="0 10 0 0">Cancel</Label>
|
||||
<Label Padding="0" Margin="0 10 0 0" Content="{DynamicResource reportWindow_cancel}"></Label>
|
||||
</StackPanel>
|
||||
</Button>
|
||||
</StackPanel>
|
||||
|
@ -13,6 +13,7 @@ using System.Windows.Navigation;
|
||||
using System.Windows.Shapes;
|
||||
using Wox.Core;
|
||||
using Wox.Core.Exception;
|
||||
using Wox.Core.i18n;
|
||||
using Wox.Core.UI;
|
||||
using Wox.Core.UserSettings;
|
||||
using Wox.Core.Version;
|
||||
@ -20,7 +21,7 @@ using Wox.Infrastructure.Http;
|
||||
|
||||
namespace Wox.CrashReporter
|
||||
{
|
||||
internal partial class ReportWindow : IUIResource
|
||||
internal partial class ReportWindow
|
||||
{
|
||||
private Exception exception;
|
||||
|
||||
@ -41,17 +42,22 @@ namespace Wox.CrashReporter
|
||||
tbType.Text = exception.GetType().ToString();
|
||||
}
|
||||
|
||||
public ResourceDictionary GetResourceDictionary()
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
private void btnSend_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
tbSendReport.Content = "Sending";
|
||||
string sendingMsg = InternationalizationManager.Internationalization.GetTranslation("reportWindow_sending");
|
||||
tbSendReport.Content = sendingMsg;
|
||||
btnSend.IsEnabled = false;
|
||||
string error = string.Format("{{\"data\":{0}}}", ExceptionFormatter.FormatExcpetion(exception));
|
||||
string response = HttpRequest.Post(APIServer.ErrorReportURL, error, HttpProxy.Instance);
|
||||
if (response.ToLower() == "ok")
|
||||
{
|
||||
MessageBox.Show(InternationalizationManager.Internationalization.GetTranslation("reportWindow_report_succeed"));
|
||||
}
|
||||
else
|
||||
{
|
||||
MessageBox.Show(InternationalizationManager.Internationalization.GetTranslation("reportWindow_report_failed"));
|
||||
}
|
||||
Close();
|
||||
}
|
||||
|
||||
private void btnCancel_Click(object sender, RoutedEventArgs e)
|
||||
|
@ -81,4 +81,21 @@
|
||||
<!--Hotkey Control-->
|
||||
<system:String x:Key="hotkeyUnavailable">Hotkey unavailable</system:String>
|
||||
|
||||
|
||||
<!--Crash Reporter-->
|
||||
<system:String x:Key="reportWindow_version">Version</system:String>
|
||||
<system:String x:Key="reportWindow_time">Time</system:String>
|
||||
<system:String x:Key="reportWindow_reproduce">Please tell us how application crashed so we can fix it</system:String>
|
||||
<system:String x:Key="reportWindow_send_report">Send Report</system:String>
|
||||
<system:String x:Key="reportWindow_cancel">Cancel</system:String>
|
||||
<system:String x:Key="reportWindow_general">General</system:String>
|
||||
<system:String x:Key="reportWindow_exceptions">Exceptions</system:String>
|
||||
<system:String x:Key="reportWindow_exception_type">Exception Type</system:String>
|
||||
<system:String x:Key="reportWindow_source">Source</system:String>
|
||||
<system:String x:Key="reportWindow_stack_trace">Stack Trace</system:String>
|
||||
<system:String x:Key="reportWindow_sending">Sending</system:String>
|
||||
<system:String x:Key="reportWindow_report_succeed">Report succeed</system:String>
|
||||
<system:String x:Key="reportWindow_report_failed">Report failed</system:String>
|
||||
<system:String x:Key="reportWindow_wox_got_an_error">Wox got an error</system:String>
|
||||
|
||||
</ResourceDictionary>
|
@ -82,4 +82,19 @@
|
||||
<!--Hotkey 控件-->
|
||||
<system:String x:Key="hotkeyUnavailable">热键不可用</system:String>
|
||||
|
||||
<!--崩溃报告窗体-->
|
||||
<system:String x:Key="reportWindow_version">版本</system:String>
|
||||
<system:String x:Key="reportWindow_time">时间</system:String>
|
||||
<system:String x:Key="reportWindow_reproduce">请告诉我们如何重现此问题,以便我们进行修复</system:String>
|
||||
<system:String x:Key="reportWindow_send_report">发送报告</system:String>
|
||||
<system:String x:Key="reportWindow_cancel">取消</system:String>
|
||||
<system:String x:Key="reportWindow_general">基本信息</system:String>
|
||||
<system:String x:Key="reportWindow_exceptions">异常信息</system:String>
|
||||
<system:String x:Key="reportWindow_exception_type">异常类型</system:String>
|
||||
<system:String x:Key="reportWindow_source">异常源</system:String>
|
||||
<system:String x:Key="reportWindow_stack_trace">堆栈信息</system:String>
|
||||
<system:String x:Key="reportWindow_sending">发送中</system:String>
|
||||
<system:String x:Key="reportWindow_report_succeed">发送成功</system:String>
|
||||
<system:String x:Key="reportWindow_report_failed">发送失败</system:String>
|
||||
<system:String x:Key="reportWindow_wox_got_an_error">Wox出错啦</system:String>
|
||||
</ResourceDictionary>
|
@ -82,4 +82,20 @@
|
||||
<!--Hotkey 控件-->
|
||||
<system:String x:Key="hotkeyUnavailable">熱鍵不可用</system:String>
|
||||
|
||||
<!--崩潰報告窗體-->
|
||||
<system:String x:Key="reportWindow_version">版本</system:String>
|
||||
<system:String x:Key="reportWindow_time">時間</system:String>
|
||||
<system:String x:Key="reportWindow_reproduce">請告訴我們如何重現此問題,以便我們進行修復</system:String>
|
||||
<system:String x:Key="reportWindow_send_report">發送報告</system:String>
|
||||
<system:String x:Key="reportWindow_cancel">取消</system:String>
|
||||
<system:String x:Key="reportWindow_general">基本信息</system:String>
|
||||
<system:String x:Key="reportWindow_exceptions">異常信息</system:String>
|
||||
<system:String x:Key="reportWindow_exception_type">異常類型</system:String>
|
||||
<system:String x:Key="reportWindow_source">異常源</system:String>
|
||||
<system:String x:Key="reportWindow_stack_trace">堆棧信息</system:String>
|
||||
<system:String x:Key="reportWindow_sending">發送中</system:String>
|
||||
<system:String x:Key="reportWindow_report_succeed">發送成功</system:String>
|
||||
<system:String x:Key="reportWindow_report_failed">發送失敗</system:String>
|
||||
<system:String x:Key="reportWindow_wox_got_an_error">Wox出錯啦</system:String>
|
||||
|
||||
</ResourceDictionary>
|
Loading…
Reference in New Issue
Block a user