Skip to content

Force Proxy to any Windows/MacOS/Linux Application TCP and UDP traffic

#11 WIP Added Language Support - Added Chinese

Sourav Kalal6965b591fdf1
diff --git a/gui/ProxyBridge.GUI.csproj b/gui/ProxyBridge.GUI.csproj
index 91bdf39..103f7f2 100644
--- a/gui/ProxyBridge.GUI.csproj
+++ b/gui/ProxyBridge.GUI.csproj
@@ -20,6 +20,24 @@
<AvaloniaResource Include="Assets\logo.ico" />
</ItemGroup>
+ <ItemGroup>
+ <EmbeddedResource Update="Resources\Resources.resx">
+ <Generator>ResXFileCodeGenerator</Generator>
+ <LastGenOutput>Resources.Designer.cs</LastGenOutput>
+ </EmbeddedResource>
+ <EmbeddedResource Update="Resources\Resources.zh.resx">
+ <DependentUpon>Resources.resx</DependentUpon>
+ </EmbeddedResource>
+ </ItemGroup>
+
+ <ItemGroup>
+ <Compile Update="Resources\Resources.Designer.cs">
+ <DesignTime>True</DesignTime>
+ <AutoGen>True</AutoGen>
+ <DependentUpon>Resources.resx</DependentUpon>
+ </Compile>
+ </ItemGroup>
+
<ItemGroup>
<PackageReference Include="Avalonia" Version="11.2.0" />
<PackageReference Include="Avalonia.Desktop" Version="11.2.0" />
diff --git a/gui/Resources/Resources.Designer.cs b/gui/Resources/Resources.Designer.cs
new file mode 100644
index 0000000..cbab28e
--- /dev/null
+++ b/gui/Resources/Resources.Designer.cs
@@ -0,0 +1,416 @@
+//------------------------------------------------------------------------------
+// <auto-generated>
+// This code was generated by a tool.
+// Runtime Version:4.0.30319.42000
+//
+// Changes to this file may cause incorrect behavior and will be lost if
+// the code is regenerated.
+// </auto-generated>
+//------------------------------------------------------------------------------
+
+namespace ProxyBridge.GUI.Resources {
+ using System;
+
+
+ /// <summary>
+ /// A strongly-typed resource class, for looking up localized strings, etc.
+ /// </summary>
+ [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "17.0.0.0")]
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
+ internal class Resources {
+
+ private static global::System.Resources.ResourceManager resourceMan;
+
+ private static global::System.Globalization.CultureInfo resourceCulture;
+
+ [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
+ internal Resources() {
+ }
+
+ /// <summary>
+ /// Returns the cached ResourceManager instance used by this class.
+ /// </summary>
+ [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
+ internal static global::System.Resources.ResourceManager ResourceManager {
+ get {
+ if (object.ReferenceEquals(resourceMan, null)) {
+ global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("ProxyBridge.GUI.Resources.Resources", typeof(Resources).Assembly);
+ resourceMan = temp;
+ }
+ return resourceMan;
+ }
+ }
+
+ /// <summary>
+ /// Overrides the current thread's CurrentUICulture property for all
+ /// resource lookups using this strongly typed resource class.
+ /// </summary>
+ [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
+ public static global::System.Globalization.CultureInfo Culture {
+ get {
+ return resourceCulture;
+ }
+ set {
+ resourceCulture = value;
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Proxy.
+ /// </summary>
+ internal static string MenuProxy {
+ get {
+ return ResourceManager.GetString("MenuProxy", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Proxy Settings.
+ /// </summary>
+ internal static string MenuProxySettings {
+ get {
+ return ResourceManager.GetString("MenuProxySettings", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Proxy Rules.
+ /// </summary>
+ internal static string MenuProxyRules {
+ get {
+ return ResourceManager.GetString("MenuProxyRules", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to DNS via Proxy.
+ /// </summary>
+ internal static string MenuDnsViaProxy {
+ get {
+ return ResourceManager.GetString("MenuDnsViaProxy", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Language.
+ /// </summary>
+ internal static string MenuLanguage {
+ get {
+ return ResourceManager.GetString("MenuLanguage", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to About.
+ /// </summary>
+ internal static string MenuAbout {
+ get {
+ return ResourceManager.GetString("MenuAbout", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to About ProxyBridge.
+ /// </summary>
+ internal static string MenuAboutProxyBridge {
+ get {
+ return ResourceManager.GetString("MenuAboutProxyBridge", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Check for Updates.
+ /// </summary>
+ internal static string MenuCheckUpdates {
+ get {
+ return ResourceManager.GetString("MenuCheckUpdates", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to 🔌 Connections.
+ /// </summary>
+ internal static string TabConnections {
+ get {
+ return ResourceManager.GetString("TabConnections", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to 📝 Activity Logs.
+ /// </summary>
+ internal static string TabActivity {
+ get {
+ return ResourceManager.GetString("TabActivity", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Clear.
+ /// </summary>
+ internal static string ButtonClear {
+ get {
+ return ResourceManager.GetString("ButtonClear", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Save.
+ /// </summary>
+ internal static string ButtonSave {
+ get {
+ return ResourceManager.GetString("ButtonSave", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Cancel.
+ /// </summary>
+ internal static string ButtonCancel {
+ get {
+ return ResourceManager.GetString("ButtonCancel", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Close.
+ /// </summary>
+ internal static string ButtonClose {
+ get {
+ return ResourceManager.GetString("ButtonClose", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Add.
+ /// </summary>
+ internal static string ButtonAdd {
+ get {
+ return ResourceManager.GetString("ButtonAdd", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Edit.
+ /// </summary>
+ internal static string ButtonEdit {
+ get {
+ return ResourceManager.GetString("ButtonEdit", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Delete.
+ /// </summary>
+ internal static string ButtonDelete {
+ get {
+ return ResourceManager.GetString("ButtonDelete", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to 🔍 Search connections....
+ /// </summary>
+ internal static string SearchConnectionsPlaceholder {
+ get {
+ return ResourceManager.GetString("SearchConnectionsPlaceholder", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to 🔍 Search activity logs....
+ /// </summary>
+ internal static string SearchActivityPlaceholder {
+ get {
+ return ResourceManager.GetString("SearchActivityPlaceholder", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to ProxyBridge initialized successfully.
+ /// </summary>
+ internal static string LogInitialized {
+ get {
+ return ResourceManager.GetString("LogInitialized", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to ProxyBridge service started successfully.
+ /// </summary>
+ internal static string LogServiceStarted {
+ get {
+ return ResourceManager.GetString("LogServiceStarted", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to ERROR: Failed to start ProxyBridge service.
+ /// </summary>
+ internal static string LogServiceStartFailed {
+ get {
+ return ResourceManager.GetString("LogServiceStartFailed", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Restored proxy settings.
+ /// </summary>
+ internal static string LogRestoredProxySettings {
+ get {
+ return ResourceManager.GetString("LogRestoredProxySettings", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Restored {0} proxy rule(s).
+ /// </summary>
+ internal static string LogRestoredRules {
+ get {
+ return ResourceManager.GetString("LogRestoredRules", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Configuration saved successfully.
+ /// </summary>
+ internal static string LogConfigSaved {
+ get {
+ return ResourceManager.GetString("LogConfigSaved", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Failed to load configuration.
+ /// </summary>
+ internal static string LogConfigLoadFailed {
+ get {
+ return ResourceManager.GetString("LogConfigLoadFailed", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Failed to save configuration.
+ /// </summary>
+ internal static string LogConfigSaveFailed {
+ get {
+ return ResourceManager.GetString("LogConfigSaveFailed", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Saved proxy settings.
+ /// </summary>
+ internal static string LogProxySettingsSaved {
+ get {
+ return ResourceManager.GetString("LogProxySettingsSaved", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to ERROR: Failed to set proxy config.
+ /// </summary>
+ internal static string LogProxySettingsFailed {
+ get {
+ return ResourceManager.GetString("LogProxySettingsFailed", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Added rule.
+ /// </summary>
+ internal static string LogRuleAdded {
+ get {
+ return ResourceManager.GetString("LogRuleAdded", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to ERROR: Failed to add rule.
+ /// </summary>
+ internal static string LogRuleAddFailed {
+ get {
+ return ResourceManager.GetString("LogRuleAddFailed", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to DNS via Proxy: Enabled.
+ /// </summary>
+ internal static string LogDnsViaProxyEnabled {
+ get {
+ return ResourceManager.GetString("LogDnsViaProxyEnabled", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to DNS via Proxy: Disabled.
+ /// </summary>
+ internal static string LogDnsViaProxyDisabled {
+ get {
+ return ResourceManager.GetString("LogDnsViaProxyDisabled", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Language changed to.
+ /// </summary>
+ internal static string LogLanguageChanged {
+ get {
+ return ResourceManager.GetString("LogLanguageChanged", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to with auth.
+ /// </summary>
+ internal static string LogWithAuth {
+ get {
+ return ResourceManager.GetString("LogWithAuth", resourceCulture);
+ }
+ }
+
+ // Proxy Settings Window
+ internal static string WindowProxySettings => ResourceManager.GetString("WindowProxySettings", resourceCulture);
+ internal static string LabelProxyType => ResourceManager.GetString("LabelProxyType", resourceCulture);
+ internal static string LabelProxyIp => ResourceManager.GetString("LabelProxyIp", resourceCulture);
+ internal static string LabelProxyPort => ResourceManager.GetString("LabelProxyPort", resourceCulture);
+ internal static string LabelUsername => ResourceManager.GetString("LabelUsername", resourceCulture);
+ internal static string LabelPassword => ResourceManager.GetString("LabelPassword", resourceCulture);
+ internal static string LabelRequiredFields => ResourceManager.GetString("LabelRequiredFields", resourceCulture);
+ internal static string LabelTestConnection => ResourceManager.GetString("LabelTestConnection", resourceCulture);
+ internal static string ButtonTestProxy => ResourceManager.GetString("ButtonTestProxy", resourceCulture);
+ internal static string LabelTargetHost => ResourceManager.GetString("LabelTargetHost", resourceCulture);
+ internal static string LabelPort => ResourceManager.GetString("LabelPort", resourceCulture);
+ internal static string ButtonStartTest => ResourceManager.GetString("ButtonStartTest", resourceCulture);
+ internal static string LabelOutput => ResourceManager.GetString("LabelOutput", resourceCulture);
+ internal static string ButtonSaveChanges => ResourceManager.GetString("ButtonSaveChanges", resourceCulture);
+ internal static string PlaceholderIpAddress => ResourceManager.GetString("PlaceholderIpAddress", resourceCulture);
+ internal static string PlaceholderPort => ResourceManager.GetString("PlaceholderPort", resourceCulture);
+ internal static string PlaceholderNoAuth => ResourceManager.GetString("PlaceholderNoAuth", resourceCulture);
+
+ // Proxy Rules Window
+ internal static string WindowProxyRules => ResourceManager.GetString("WindowProxyRules", resourceCulture);
+ internal static string LabelEnabled => ResourceManager.GetString("LabelEnabled", resourceCulture);
+ internal static string LabelActions => ResourceManager.GetString("LabelActions", resourceCulture);
+ internal static string LabelSR => ResourceManager.GetString("LabelSR", resourceCulture);
+ internal static string LabelProcess => ResourceManager.GetString("LabelProcess", resourceCulture);
+ internal static string LabelTargetHosts => ResourceManager.GetString("LabelTargetHosts", resourceCulture);
+ internal static string LabelTargetPorts => ResourceManager.GetString("LabelTargetPorts", resourceCulture);
+ internal static string LabelProtocol => ResourceManager.GetString("LabelProtocol", resourceCulture);
+ internal static string LabelAction => ResourceManager.GetString("LabelAction", resourceCulture);
+ internal static string LabelApplications => ResourceManager.GetString("LabelApplications", resourceCulture);
+ internal static string ButtonBrowse => ResourceManager.GetString("ButtonBrowse", resourceCulture);
+ internal static string ExampleApplications => ResourceManager.GetString("ExampleApplications", resourceCulture);
+ internal static string ExampleTargetHosts => ResourceManager.GetString("ExampleTargetHosts", resourceCulture);
+ internal static string ExampleTargetPorts => ResourceManager.GetString("ExampleTargetPorts", resourceCulture);
+ internal static string ProtocolTCP => ResourceManager.GetString("ProtocolTCP", resourceCulture);
+ internal static string ProtocolUDP => ResourceManager.GetString("ProtocolUDP", resourceCulture);
+ internal static string ProtocolBoth => ResourceManager.GetString("ProtocolBoth", resourceCulture);
+ internal static string ActionProxy => ResourceManager.GetString("ActionProxy", resourceCulture);
+ internal static string ActionDirect => ResourceManager.GetString("ActionDirect", resourceCulture);
+ internal static string ActionBlock => ResourceManager.GetString("ActionBlock", resourceCulture);
+ internal static string ButtonSaveRule => ResourceManager.GetString("ButtonSaveRule", resourceCulture);
+ }
+}
diff --git a/gui/Resources/Resources.resx b/gui/Resources/Resources.resx
new file mode 100644
index 0000000..4644b2b
--- /dev/null
+++ b/gui/Resources/Resources.resx
@@ -0,0 +1,248 @@
+<?xml version="1.0" encoding="utf-8"?>
+<root>
+ <resheader name="resmimetype">
+ <value>text/microsoft-resx</value>
+ </resheader>
+ <resheader name="version">
+ <value>2.0</value>
+ </resheader>
+ <resheader name="reader">
+ <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+ </resheader>
+ <resheader name="writer">
+ <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+ </resheader>
+
+ <!-- Menu Items -->
+ <data name="MenuProxy" xml:space="preserve">
+ <value>Proxy</value>
+ </data>
+ <data name="MenuProxySettings" xml:space="preserve">
+ <value>Proxy Settings</value>
+ </data>
+ <data name="MenuProxyRules" xml:space="preserve">
+ <value>Proxy Rules</value>
+ </data>
+ <data name="MenuDnsViaProxy" xml:space="preserve">
+ <value>DNS via Proxy</value>
+ </data>
+ <data name="MenuLanguage" xml:space="preserve">
+ <value>Language</value>
+ </data>
+ <data name="MenuAbout" xml:space="preserve">
+ <value>About</value>
+ </data>
+ <data name="MenuAboutProxyBridge" xml:space="preserve">
+ <value>About ProxyBridge</value>
+ </data>
+ <data name="MenuCheckUpdates" xml:space="preserve">
+ <value>Check for Updates</value>
+ </data>
+
+ <!-- Tabs -->
+ <data name="TabConnections" xml:space="preserve">
+ <value>🔌 Connections</value>
+ </data>
+ <data name="TabActivity" xml:space="preserve">
+ <value>📝 Activity Logs</value>
+ </data>
+
+ <!-- Buttons -->
+ <data name="ButtonClear" xml:space="preserve">
+ <value>Clear</value>
+ </data>
+ <data name="ButtonSave" xml:space="preserve">
+ <value>Save</value>
+ </data>
+ <data name="ButtonCancel" xml:space="preserve">
+ <value>Cancel</value>
+ </data>
+ <data name="ButtonClose" xml:space="preserve">
+ <value>Close</value>
+ </data>
+ <data name="ButtonAdd" xml:space="preserve">
+ <value>Add</value>
+ </data>
+ <data name="ButtonEdit" xml:space="preserve">
+ <value>Edit</value>
+ </data>
+ <data name="ButtonDelete" xml:space="preserve">
+ <value>Delete</value>
+ </data>
+
+ <!-- Search Placeholders -->
+ <data name="SearchConnectionsPlaceholder" xml:space="preserve">
+ <value>🔍 Search connections...</value>
+ </data>
+ <data name="SearchActivityPlaceholder" xml:space="preserve">
+ <value>🔍 Search activity logs...</value>
+ </data>
+
+ <!-- Log Messages -->
+ <data name="LogInitialized" xml:space="preserve">
+ <value>ProxyBridge initialized successfully</value>
+ </data>
+ <data name="LogServiceStarted" xml:space="preserve">
+ <value>ProxyBridge service started successfully</value>
+ </data>
+ <data name="LogServiceStartFailed" xml:space="preserve">
+ <value>ERROR: Failed to start ProxyBridge service</value>
+ </data>
+ <data name="LogRestoredProxySettings" xml:space="preserve">
+ <value>Restored proxy settings</value>
+ </data>
+ <data name="LogRestoredRules" xml:space="preserve">
+ <value>Restored {0} proxy rule(s)</value>
+ </data>
+ <data name="LogConfigSaved" xml:space="preserve">
+ <value>Configuration saved successfully</value>
+ </data>
+ <data name="LogConfigLoadFailed" xml:space="preserve">
+ <value>Failed to load configuration</value>
+ </data>
+ <data name="LogConfigSaveFailed" xml:space="preserve">
+ <value>Failed to save configuration</value>
+ </data>
+ <data name="LogProxySettingsSaved" xml:space="preserve">
+ <value>Saved proxy settings</value>
+ </data>
+ <data name="LogProxySettingsFailed" xml:space="preserve">
+ <value>ERROR: Failed to set proxy config</value>
+ </data>
+ <data name="LogRuleAdded" xml:space="preserve">
+ <value>Added rule</value>
+ </data>
+ <data name="LogRuleAddFailed" xml:space="preserve">
+ <value>ERROR: Failed to add rule</value>
+ </data>
+ <data name="LogDnsViaProxyEnabled" xml:space="preserve">
+ <value>DNS via Proxy: Enabled</value>
+ </data>
+ <data name="LogDnsViaProxyDisabled" xml:space="preserve">
+ <value>DNS via Proxy: Disabled</value>
+ </data>
+ <data name="LogLanguageChanged" xml:space="preserve">
+ <value>Language changed to</value>
+ </data>
+ <data name="LogWithAuth" xml:space="preserve">
+ <value>with auth</value>
+ </data>
+
+ <!-- Proxy Settings Window -->
+ <data name="WindowProxySettings" xml:space="preserve">
+ <value>Proxy Settings</value>
+ </data>
+ <data name="LabelProxyType" xml:space="preserve">
+ <value>Proxy Type</value>
+ </data>
+ <data name="LabelProxyIp" xml:space="preserve">
+ <value>Proxy IP Address *</value>
+ </data>
+ <data name="LabelProxyPort" xml:space="preserve">
+ <value>Proxy Port *</value>
+ </data>
+ <data name="LabelUsername" xml:space="preserve">
+ <value>Username (Optional)</value>
+ </data>
+ <data name="LabelPassword" xml:space="preserve">
+ <value>Password (Optional)</value>
+ </data>
+ <data name="LabelRequiredFields" xml:space="preserve">
+ <value>* Required fields</value>
+ </data>
+ <data name="LabelTestConnection" xml:space="preserve">
+ <value>Test Connection</value>
+ </data>
+ <data name="ButtonTestProxy" xml:space="preserve">
+ <value>Test Proxy Connection</value>
+ </data>
+ <data name="LabelTargetHost" xml:space="preserve">
+ <value>Target Host</value>
+ </data>
+ <data name="LabelPort" xml:space="preserve">
+ <value>Port</value>
+ </data>
+ <data name="ButtonStartTest" xml:space="preserve">
+ <value>▶ Start Test</value>
+ </data>
+ <data name="LabelOutput" xml:space="preserve">
+ <value>Output</value>
+ </data>
+ <data name="ButtonSaveChanges" xml:space="preserve">
+ <value>Save Changes</value>
+ </data>
+ <data name="PlaceholderIpAddress" xml:space="preserve">
+ <value>e.g., 127.0.0.1</value>
+ </data>
+ <data name="PlaceholderPort" xml:space="preserve">
+ <value>e.g., 1080</value>
+ </data>
+ <data name="PlaceholderNoAuth" xml:space="preserve">
+ <value>Leave empty if no auth required</value>
+ </data>
+
+ <!-- Proxy Rules Window -->
+ <data name="WindowProxyRules" xml:space="preserve">
+ <value>Process Rules</value>
+ </data>
+ <data name="LabelEnabled" xml:space="preserve">
+ <value>Enabled</value>
+ </data>
+ <data name="LabelActions" xml:space="preserve">
+ <value>Actions</value>
+ </data>
+ <data name="LabelSR" xml:space="preserve">
+ <value>SR</value>
+ </data>
+ <data name="LabelProcess" xml:space="preserve">
+ <value>Process</value>
+ </data>
+ <data name="LabelTargetHosts" xml:space="preserve">
+ <value>Target Hosts</value>
+ </data>
+ <data name="LabelTargetPorts" xml:space="preserve">
+ <value>Target Ports</value>
+ </data>
+ <data name="LabelProtocol" xml:space="preserve">
+ <value>Protocol</value>
+ </data>
+ <data name="LabelAction" xml:space="preserve">
+ <value>Action</value>
+ </data>
+ <data name="LabelApplications" xml:space="preserve">
+ <value>Applications</value>
+ </data>
+ <data name="ButtonBrowse" xml:space="preserve">
+ <value>Browse...</value>
+ </data>
+ <data name="ExampleApplications" xml:space="preserve">
+ <value>Example: iexplore.exe; "C:\some app.exe"; fire*.exe; *.bin</value>
+ </data>
+ <data name="ExampleTargetHosts" xml:space="preserve">
+ <value>Example: 127.0.0.1; *.example.com; 192.168.1.*; 10.1.0.0-10.5.255.255</value>
+ </data>
+ <data name="ExampleTargetPorts" xml:space="preserve">
+ <value>Example: 80; 8000-9000; 3128</value>
+ </data>
+ <data name="ProtocolTCP" xml:space="preserve">
+ <value>TCP</value>
+ </data>
+ <data name="ProtocolUDP" xml:space="preserve">
+ <value>UDP</value>
+ </data>
+ <data name="ProtocolBoth" xml:space="preserve">
+ <value>Both (TCP + UDP)</value>
+ </data>
+ <data name="ActionProxy" xml:space="preserve">
+ <value>PROXY</value>
+ </data>
+ <data name="ActionDirect" xml:space="preserve">
+ <value>DIRECT</value>
+ </data>
+ <data name="ActionBlock" xml:space="preserve">
+ <value>BLOCK</value>
+ </data>
+ <data name="ButtonSaveRule" xml:space="preserve">
+ <value>Save Rule</value>
+ </data>
+</root>
diff --git a/gui/Resources/Resources.zh.resx b/gui/Resources/Resources.zh.resx
new file mode 100644
index 0000000..3b07056
--- /dev/null
+++ b/gui/Resources/Resources.zh.resx
@@ -0,0 +1,248 @@
+<?xml version="1.0" encoding="utf-8"?>
+<root>
+ <resheader name="resmimetype">
+ <value>text/microsoft-resx</value>
+ </resheader>
+ <resheader name="version">
+ <value>2.0</value>
+ </resheader>
+ <resheader name="reader">
+ <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+ </resheader>
+ <resheader name="writer">
+ <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+ </resheader>
+
+ <!-- Menu Items -->
+ <data name="MenuProxy" xml:space="preserve">
+ <value>代理</value>
+ </data>
+ <data name="MenuProxySettings" xml:space="preserve">
+ <value>代理设置</value>
+ </data>
+ <data name="MenuProxyRules" xml:space="preserve">
+ <value>代理规则</value>
+ </data>
+ <data name="MenuDnsViaProxy" xml:space="preserve">
+ <value>DNS通过代理</value>
+ </data>
+ <data name="MenuLanguage" xml:space="preserve">
+ <value>语言</value>
+ </data>
+ <data name="MenuAbout" xml:space="preserve">
+ <value>关于</value>
+ </data>
+ <data name="MenuAboutProxyBridge" xml:space="preserve">
+ <value>关于ProxyBridge</value>
+ </data>
+ <data name="MenuCheckUpdates" xml:space="preserve">
+ <value>检查更新</value>
+ </data>
+
+ <!-- Tabs -->
+ <data name="TabConnections" xml:space="preserve">
+ <value>🔌 网络连接</value>
+ </data>
+ <data name="TabActivity" xml:space="preserve">
+ <value>📝 活动日志</value>
+ </data>
+
+ <!-- Buttons -->
+ <data name="ButtonClear" xml:space="preserve">
+ <value>清除</value>
+ </data>
+ <data name="ButtonSave" xml:space="preserve">
+ <value>保存</value>
+ </data>
+ <data name="ButtonCancel" xml:space="preserve">
+ <value>取消</value>
+ </data>
+ <data name="ButtonClose" xml:space="preserve">
+ <value>关闭</value>
+ </data>
+ <data name="ButtonAdd" xml:space="preserve">
+ <value>添加</value>
+ </data>
+ <data name="ButtonEdit" xml:space="preserve">
+ <value>编辑</value>
+ </data>
+ <data name="ButtonDelete" xml:space="preserve">
+ <value>删除</value>
+ </data>
+
+ <!-- Search Placeholders -->
+ <data name="SearchConnectionsPlaceholder" xml:space="preserve">
+ <value>🔍 搜索连接...</value>
+ </data>
+ <data name="SearchActivityPlaceholder" xml:space="preserve">
+ <value>🔍 搜索活动日志...</value>
+ </data>
+
+ <!-- Log Messages -->
+ <data name="LogInitialized" xml:space="preserve">
+ <value>ProxyBridge初始化成功</value>
+ </data>
+ <data name="LogServiceStarted" xml:space="preserve">
+ <value>ProxyBridge服务启动成功</value>
+ </data>
+ <data name="LogServiceStartFailed" xml:space="preserve">
+ <value>错误: ProxyBridge服务启动失败</value>
+ </data>
+ <data name="LogRestoredProxySettings" xml:space="preserve">
+ <value>已恢复代理设置</value>
+ </data>
+ <data name="LogRestoredRules" xml:space="preserve">
+ <value>已恢复 {0} 条代理规则</value>
+ </data>
+ <data name="LogConfigSaved" xml:space="preserve">
+ <value>配置保存成功</value>
+ </data>
+ <data name="LogConfigLoadFailed" xml:space="preserve">
+ <value>配置加载失败</value>
+ </data>
+ <data name="LogConfigSaveFailed" xml:space="preserve">
+ <value>配置保存失败</value>
+ </data>
+ <data name="LogProxySettingsSaved" xml:space="preserve">
+ <value>已保存代理设置</value>
+ </data>
+ <data name="LogProxySettingsFailed" xml:space="preserve">
+ <value>错误: 代理配置设置失败</value>
+ </data>
+ <data name="LogRuleAdded" xml:space="preserve">
+ <value>已添加规则</value>
+ </data>
+ <data name="LogRuleAddFailed" xml:space="preserve">
+ <value>错误: 添加规则失败</value>
+ </data>
+ <data name="LogDnsViaProxyEnabled" xml:space="preserve">
+ <value>DNS通过代理: 已启用</value>
+ </data>
+ <data name="LogDnsViaProxyDisabled" xml:space="preserve">
+ <value>DNS通过代理: 已禁用</value>
+ </data>
+ <data name="LogLanguageChanged" xml:space="preserve">
+ <value>语言已更改为</value>
+ </data>
+ <data name="LogWithAuth" xml:space="preserve">
+ <value>带认证</value>
+ </data>
+
+ <!-- Proxy Settings Window -->
+ <data name="WindowProxySettings" xml:space="preserve">
+ <value>代理设置</value>
+ </data>
+ <data name="LabelProxyType" xml:space="preserve">
+ <value>代理类型</value>
+ </data>
+ <data name="LabelProxyIp" xml:space="preserve">
+ <value>代理IP地址 *</value>
+ </data>
+ <data name="LabelProxyPort" xml:space="preserve">
+ <value>代理端口 *</value>
+ </data>
+ <data name="LabelUsername" xml:space="preserve">
+ <value>用户名(可选)</value>
+ </data>
+ <data name="LabelPassword" xml:space="preserve">
+ <value>密码(可选)</value>
+ </data>
+ <data name="LabelRequiredFields" xml:space="preserve">
+ <value>* 必填字段</value>
+ </data>
+ <data name="LabelTestConnection" xml:space="preserve">
+ <value>测试连接</value>
+ </data>
+ <data name="ButtonTestProxy" xml:space="preserve">
+ <value>测试代理连接</value>
+ </data>
+ <data name="LabelTargetHost" xml:space="preserve">
+ <value>目标主机</value>
+ </data>
+ <data name="LabelPort" xml:space="preserve">
+ <value>端口</value>
+ </data>
+ <data name="ButtonStartTest" xml:space="preserve">
+ <value>▶ 开始测试</value>
+ </data>
+ <data name="LabelOutput" xml:space="preserve">
+ <value>输出</value>
+ </data>
+ <data name="ButtonSaveChanges" xml:space="preserve">
+ <value>保存更改</value>
+ </data>
+ <data name="PlaceholderIpAddress" xml:space="preserve">
+ <value>例如: 127.0.0.1</value>
+ </data>
+ <data name="PlaceholderPort" xml:space="preserve">
+ <value>例如: 1080</value>
+ </data>
+ <data name="PlaceholderNoAuth" xml:space="preserve">
+ <value>如不需要认证请留空</value>
+ </data>
+
+ <!-- Proxy Rules Window -->
+ <data name="WindowProxyRules" xml:space="preserve">
+ <value>进程规则</value>
+ </data>
+ <data name="LabelEnabled" xml:space="preserve">
+ <value>启用</value>
+ </data>
+ <data name="LabelActions" xml:space="preserve">
+ <value>操作</value>
+ </data>
+ <data name="LabelSR" xml:space="preserve">
+ <value>序号</value>
+ </data>
+ <data name="LabelProcess" xml:space="preserve">
+ <value>进程</value>
+ </data>
+ <data name="LabelTargetHosts" xml:space="preserve">
+ <value>目标主机</value>
+ </data>
+ <data name="LabelTargetPorts" xml:space="preserve">
+ <value>目标端口</value>
+ </data>
+ <data name="LabelProtocol" xml:space="preserve">
+ <value>协议</value>
+ </data>
+ <data name="LabelAction" xml:space="preserve">
+ <value>动作</value>
+ </data>
+ <data name="LabelApplications" xml:space="preserve">
+ <value>应用程序</value>
+ </data>
+ <data name="ButtonBrowse" xml:space="preserve">
+ <value>浏览...</value>
+ </data>
+ <data name="ExampleApplications" xml:space="preserve">
+ <value>示例: iexplore.exe; "C:\某个应用.exe"; fire*.exe; *.bin</value>
+ </data>
+ <data name="ExampleTargetHosts" xml:space="preserve">
+ <value>示例: 127.0.0.1; *.example.com; 192.168.1.*; 10.1.0.0-10.5.255.255</value>
+ </data>
+ <data name="ExampleTargetPorts" xml:space="preserve">
+ <value>示例: 80; 8000-9000; 3128</value>
+ </data>
+ <data name="ProtocolTCP" xml:space="preserve">
+ <value>TCP</value>
+ </data>
+ <data name="ProtocolUDP" xml:space="preserve">
+ <value>UDP</value>
+ </data>
+ <data name="ProtocolBoth" xml:space="preserve">
+ <value>两者 (TCP + UDP)</value>
+ </data>
+ <data name="ActionProxy" xml:space="preserve">
+ <value>代理</value>
+ </data>
+ <data name="ActionDirect" xml:space="preserve">
+ <value>直连</value>
+ </data>
+ <data name="ActionBlock" xml:space="preserve">
+ <value>阻止</value>
+ </data>
+ <data name="ButtonSaveRule" xml:space="preserve">
+ <value>保存规则</value>
+ </data>
+</root>
diff --git a/gui/Services/ConfigManager.cs b/gui/Services/ConfigManager.cs
index d47e127..d6d67c0 100644
--- a/gui/Services/ConfigManager.cs
+++ b/gui/Services/ConfigManager.cs
@@ -15,6 +15,7 @@ public class AppConfig
public string ProxyUsername { get; set; } = "";
public string ProxyPassword { get; set; } = "";
public bool DnsViaProxy { get; set; } = true;
+ public string Language { get; set; } = "en";
public List<ProxyRuleConfig> ProxyRules { get; set; } = new();
}
diff --git a/gui/Services/Loc.cs b/gui/Services/Loc.cs
new file mode 100644
index 0000000..bbaac59
--- /dev/null
+++ b/gui/Services/Loc.cs
@@ -0,0 +1,126 @@
+using System;
+using System.ComponentModel;
+using System.Globalization;
+using System.Runtime.CompilerServices;
+
+namespace ProxyBridge.GUI.Services;
+
+public class Loc : INotifyPropertyChanged
+{
+ private static readonly Loc _instance = new();
+ public static Loc Instance => _instance;
+
+ private CultureInfo _currentCulture = CultureInfo.CurrentUICulture;
+
+ public event PropertyChangedEventHandler? PropertyChanged;
+
+ public CultureInfo CurrentCulture
+ {
+ get => _currentCulture;
+ set
+ {
+ if (_currentCulture.Equals(value)) return;
+ _currentCulture = value;
+
+ CultureInfo.CurrentUICulture = value;
+ CultureInfo.CurrentCulture = value;
+ Resources.Resources.Culture = value;
+
+ // refresh UI
+ OnPropertyChanged(string.Empty);
+ }
+ }
+
+ private void OnPropertyChanged([CallerMemberName] string? propertyName = null)
+ {
+ PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
+ }
+
+ // Menu Items
+ public string MenuProxy => Resources.Resources.MenuProxy;
+ public string MenuProxySettings => Resources.Resources.MenuProxySettings;
+ public string MenuProxyRules => Resources.Resources.MenuProxyRules;
+ public string MenuDnsViaProxy => Resources.Resources.MenuDnsViaProxy;
+ public string MenuLanguage => Resources.Resources.MenuLanguage;
+ public string MenuAbout => Resources.Resources.MenuAbout;
+ public string MenuAboutProxyBridge => Resources.Resources.MenuAboutProxyBridge;
+ public string MenuCheckUpdates => Resources.Resources.MenuCheckUpdates;
+
+ // Tabs
+ public string TabConnections => Resources.Resources.TabConnections;
+ public string TabActivity => Resources.Resources.TabActivity;
+
+ // Buttons
+ public string ButtonClear => Resources.Resources.ButtonClear;
+ public string ButtonSave => Resources.Resources.ButtonSave;
+ public string ButtonCancel => Resources.Resources.ButtonCancel;
+ public string ButtonClose => Resources.Resources.ButtonClose;
+ public string ButtonAdd => Resources.Resources.ButtonAdd;
+ public string ButtonEdit => Resources.Resources.ButtonEdit;
+ public string ButtonDelete => Resources.Resources.ButtonDelete;
+
+ // Search Placeholders
+ public string SearchConnectionsPlaceholder => Resources.Resources.SearchConnectionsPlaceholder;
+ public string SearchActivityPlaceholder => Resources.Resources.SearchActivityPlaceholder;
+
+ // Log Messages
+ public string LogInitialized => Resources.Resources.LogInitialized;
+ public string LogServiceStarted => Resources.Resources.LogServiceStarted;
+ public string LogServiceStartFailed => Resources.Resources.LogServiceStartFailed;
+ public string LogRestoredProxySettings => Resources.Resources.LogRestoredProxySettings;
+ public string LogRestoredRules => Resources.Resources.LogRestoredRules;
+ public string LogConfigSaved => Resources.Resources.LogConfigSaved;
+ public string LogConfigLoadFailed => Resources.Resources.LogConfigLoadFailed;
+ public string LogConfigSaveFailed => Resources.Resources.LogConfigSaveFailed;
+ public string LogProxySettingsSaved => Resources.Resources.LogProxySettingsSaved;
+ public string LogProxySettingsFailed => Resources.Resources.LogProxySettingsFailed;
+ public string LogRuleAdded => Resources.Resources.LogRuleAdded;
+ public string LogRuleAddFailed => Resources.Resources.LogRuleAddFailed;
+ public string LogDnsViaProxyEnabled => Resources.Resources.LogDnsViaProxyEnabled;
+ public string LogDnsViaProxyDisabled => Resources.Resources.LogDnsViaProxyDisabled;
+ public string LogLanguageChanged => Resources.Resources.LogLanguageChanged;
+ public string LogWithAuth => Resources.Resources.LogWithAuth;
+
+ // Proxy Settings Window
+ public string ProxySettingsTitle => Resources.Resources.WindowProxySettings;
+ public string ProxyTypeLabel => Resources.Resources.LabelProxyType;
+ public string ProxyIpLabel => Resources.Resources.LabelProxyIp;
+ public string ProxyPortLabel => Resources.Resources.LabelProxyPort;
+ public string UsernameLabel => Resources.Resources.LabelUsername;
+ public string PasswordLabel => Resources.Resources.LabelPassword;
+ public string RequiredFieldsNote => Resources.Resources.LabelRequiredFields;
+ public string TestConnectionTitle => Resources.Resources.LabelTestConnection;
+ public string TestConnectionButton => Resources.Resources.ButtonTestProxy;
+ public string TargetHostLabel => Resources.Resources.LabelTargetHost;
+ public string PortLabel => Resources.Resources.LabelPort;
+ public string StartTestButton => Resources.Resources.ButtonStartTest;
+ public string OutputLabel => Resources.Resources.LabelOutput;
+ public string SaveChangesButton => Resources.Resources.ButtonSaveChanges;
+ public string ProxyIpPlaceholder => Resources.Resources.PlaceholderIpAddress;
+ public string ProxyPortPlaceholder => Resources.Resources.PlaceholderPort;
+ public string UsernamePlaceholder => Resources.Resources.PlaceholderNoAuth;
+ public string PasswordPlaceholder => Resources.Resources.PlaceholderNoAuth;
+
+ // Proxy Rules Window
+ public string ProxyRulesTitle => Resources.Resources.WindowProxyRules;
+ public string EnabledLabel => Resources.Resources.LabelEnabled;
+ public string ActionsLabel => Resources.Resources.LabelActions;
+ public string SRLabel => Resources.Resources.LabelSR;
+ public string ProcessLabel => Resources.Resources.LabelProcess;
+ public string TargetHostsLabel => Resources.Resources.LabelTargetHosts;
+ public string TargetPortsLabel => Resources.Resources.LabelTargetPorts;
+ public string ProtocolLabel => Resources.Resources.LabelProtocol;
+ public string ActionLabel => Resources.Resources.LabelAction;
+ public string ApplicationsLabel => Resources.Resources.LabelApplications;
+ public string BrowseButton => Resources.Resources.ButtonBrowse;
+ public string ExampleApplications => Resources.Resources.ExampleApplications;
+ public string ExampleTargetHosts => Resources.Resources.ExampleTargetHosts;
+ public string ExampleTargetPorts => Resources.Resources.ExampleTargetPorts;
+ public string ProtocolTCP => Resources.Resources.ProtocolTCP;
+ public string ProtocolUDP => Resources.Resources.ProtocolUDP;
+ public string ProtocolBoth => Resources.Resources.ProtocolBoth;
+ public string ActionProxy => Resources.Resources.ActionProxy;
+ public string ActionDirect => Resources.Resources.ActionDirect;
+ public string ActionBlock => Resources.Resources.ActionBlock;
+ public string SaveRuleButton => Resources.Resources.ButtonSaveRule;
+}
diff --git a/gui/ViewModels/MainWindowViewModel.cs b/gui/ViewModels/MainWindowViewModel.cs
index b17fe95..cb2358b 100644
--- a/gui/ViewModels/MainWindowViewModel.cs
+++ b/gui/ViewModels/MainWindowViewModel.cs
@@ -262,6 +262,25 @@ public class MainWindowViewModel : ViewModelBase
}
}
+ private readonly Loc _loc = Loc.Instance;
+ public Loc Loc => _loc;
+
+ private string _currentLanguage = "en";
+ private string _englishCheckmark = "✓";
+ private string _chineseCheckmark = "";
+
+ public string EnglishCheckmark
+ {
+ get => _englishCheckmark;
+ set => SetProperty(ref _englishCheckmark, value);
+ }
+
+ public string ChineseCheckmark
+ {
+ get => _chineseCheckmark;
+ set => SetProperty(ref _chineseCheckmark, value);
+ }
+
// Commands
public ICommand ShowProxySettingsCommand { get; }
public ICommand ShowProxyRulesCommand { get; }
@@ -466,6 +485,23 @@ public class MainWindowViewModel : ViewModelBase
});
}
+ public void ChangeLanguage(string languageCode)
+ {
+ if (string.IsNullOrEmpty(languageCode)) return;
+
+ _currentLanguage = languageCode;
+ EnglishCheckmark = languageCode == "en" ? "✓" : "";
+ ChineseCheckmark = languageCode == "zh" ? "✓" : "";
+
+ var config = ConfigManager.LoadConfig();
+ config.Language = languageCode;
+ ConfigManager.SaveConfig(config);
+
+ _loc.CurrentCulture = new System.Globalization.CultureInfo(languageCode);
+
+ ActivityLog += $"[{DateTime.Now:HH:mm:ss}] {_loc.LogLanguageChanged}: {languageCode}\n";
+ }
+
private void FilterConnectionsLog()
{
if (string.IsNullOrWhiteSpace(_connectionsSearchText))
@@ -570,6 +606,11 @@ public class MainWindowViewModel : ViewModelBase
DnsViaProxy = config.DnsViaProxy;
+ _currentLanguage = config.Language;
+ _loc.CurrentCulture = new System.Globalization.CultureInfo(config.Language);
+ EnglishCheckmark = config.Language == "en" ? "✓" : "";
+ ChineseCheckmark = config.Language == "zh" ? "✓" : "";
+
foreach (var ruleConfig in config.ProxyRules)
{
var rule = new ProxyRule
diff --git a/gui/ViewModels/ProxyRulesViewModel.cs b/gui/ViewModels/ProxyRulesViewModel.cs
index 07aefe5..d688bcd 100644
--- a/gui/ViewModels/ProxyRulesViewModel.cs
+++ b/gui/ViewModels/ProxyRulesViewModel.cs
@@ -9,6 +9,9 @@ namespace ProxyBridge.GUI.ViewModels;
public class ProxyRulesViewModel : ViewModelBase
{
+ private readonly Loc _loc = Loc.Instance;
+ public Loc Loc => _loc;
+
private bool _isAddRuleViewOpen;
private bool _isEditMode;
private uint _currentEditingRuleId;
diff --git a/gui/ViewModels/ProxySettingsViewModel.cs b/gui/ViewModels/ProxySettingsViewModel.cs
index 762082d..5197dd5 100644
--- a/gui/ViewModels/ProxySettingsViewModel.cs
+++ b/gui/ViewModels/ProxySettingsViewModel.cs
@@ -2,11 +2,15 @@ using System;
using System.Net;
using System.Text.RegularExpressions;
using System.Windows.Input;
+using ProxyBridge.GUI.Services;
namespace ProxyBridge.GUI.ViewModels;
public class ProxySettingsViewModel : ViewModelBase
{
+ private readonly Loc _loc = Loc.Instance;
+ public Loc Loc => _loc;
+
private string _proxyIp = "";
private string _proxyPort = "";
private string _proxyType = "SOCKS5";
diff --git a/gui/Views/MainWindow.axaml b/gui/Views/MainWindow.axaml
index d8800b0..43ea58d 100644
--- a/gui/Views/MainWindow.axaml
+++ b/gui/Views/MainWindow.axaml
@@ -1,6 +1,7 @@
<Window xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:vm="using:ProxyBridge.GUI.ViewModels"
+ xmlns:services="using:ProxyBridge.GUI.Services"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d" d:DesignWidth="1100" d:DesignHeight="650"
@@ -200,11 +201,11 @@
<!-- Menu Bar -->
<Menu DockPanel.Dock="Top" Background="#FF2D2D30">
- <MenuItem Header="Proxy">
- <MenuItem Header="Proxy Settings" Command="{Binding ShowProxySettingsCommand}"/>
- <MenuItem Header="Proxy Rules" Command="{Binding ShowProxyRulesCommand}"/>
+ <MenuItem Header="{Binding Loc.MenuProxy}">
+ <MenuItem Header="{Binding Loc.MenuProxySettings}" Command="{Binding ShowProxySettingsCommand}"/>
+ <MenuItem Header="{Binding Loc.MenuProxyRules}" Command="{Binding ShowProxyRulesCommand}"/>
<Separator/>
- <MenuItem Header="DNS via Proxy"
+ <MenuItem Header="{Binding Loc.MenuDnsViaProxy}"
Command="{Binding ToggleDnsViaProxyCommand}">
<MenuItem.Icon>
<CheckBox IsChecked="{Binding DnsViaProxy}"
@@ -213,15 +214,27 @@
</MenuItem.Icon>
</MenuItem>
</MenuItem>
- <MenuItem Header="About">
- <MenuItem Header="About ProxyBridge" Command="{Binding ShowAboutCommand}"/>
- <MenuItem Header="Check for Updates" Command="{Binding CheckForUpdatesCommand}"/>
+ <MenuItem Header="{Binding Loc.MenuLanguage}">
+ <MenuItem Header="English" Click="OnChangeLanguageEnglish">
+ <MenuItem.Icon>
+ <TextBlock Text="{Binding EnglishCheckmark}" FontSize="14"/>
+ </MenuItem.Icon>
+ </MenuItem>
+ <MenuItem Header="中文 (Chinese)" Click="OnChangeLanguageChinese">
+ <MenuItem.Icon>
+ <TextBlock Text="{Binding ChineseCheckmark}" FontSize="14"/>
+ </MenuItem.Icon>
+ </MenuItem>
+ </MenuItem>
+ <MenuItem Header="{Binding Loc.MenuAbout}">
+ <MenuItem Header="{Binding Loc.MenuAboutProxyBridge}" Command="{Binding ShowAboutCommand}"/>
+ <MenuItem Header="{Binding Loc.MenuCheckUpdates}" Command="{Binding CheckForUpdatesCommand}"/>
</MenuItem>
</Menu>
<!-- Tab Control -->
<TabControl SelectedIndex="{Binding SelectedTabIndex}" Background="#FF1E1E1E" Padding="0">
- <TabItem Header="🔌 Connections">
+ <TabItem Header="{Binding Loc.TabConnections}">
<Border Background="#FF252526" Margin="8" CornerRadius="4" BorderBrush="#FF3F3F46" BorderThickness="1">
<DockPanel>
<!-- Search and Clear Bar -->
@@ -229,10 +242,10 @@
<Grid ColumnDefinitions="*,Auto,Auto">
<TextBox Grid.Column="0"
Text="{Binding ConnectionsSearchText}"
- Watermark="🔍 Search connections..."
+ Watermark="{Binding Loc.SearchConnectionsPlaceholder}"
Margin="0,0,8,0"/>
<Button Grid.Column="1"
- Content="Clear"
+ Content="{Binding Loc.ButtonClear}"
Classes="secondary"
Command="{Binding ClearConnectionsLogCommand}"
Padding="12,6"
@@ -254,7 +267,7 @@
</DockPanel>
</Border>
</TabItem>
- <TabItem Header="📋 Activity Logs">
+ <TabItem Header="{Binding Loc.TabActivity}">
<Border Background="#FF252526" Margin="8" CornerRadius="4" BorderBrush="#FF3F3F46" BorderThickness="1">
<DockPanel>
<!-- Search and Clear Bar -->
@@ -262,10 +275,10 @@
<Grid ColumnDefinitions="*,Auto,Auto">
<TextBox Grid.Column="0"
Text="{Binding ActivitySearchText}"
- Watermark="🔍 Search activity logs..."
+ Watermark="{Binding Loc.SearchActivityPlaceholder}"
Margin="0,0,8,0"/>
<Button Grid.Column="1"
- Content="Clear"
+ Content="{Binding Loc.ButtonClear}"
Classes="secondary"
Command="{Binding ClearActivityLogCommand}"
Padding="12,6"
diff --git a/gui/Views/MainWindow.axaml.cs b/gui/Views/MainWindow.axaml.cs
index 0bae2fa..390278b 100644
--- a/gui/Views/MainWindow.axaml.cs
+++ b/gui/Views/MainWindow.axaml.cs
@@ -2,6 +2,7 @@ using Avalonia.Controls;
using ProxyBridge.GUI.ViewModels;
using System;
using System.ComponentModel;
+using Avalonia.Interactivity;
namespace ProxyBridge.GUI.Views;
@@ -28,6 +29,22 @@ public partial class MainWindow : Window
};
}
+ private void OnChangeLanguageEnglish(object? sender, RoutedEventArgs e)
+ {
+ if (DataContext is MainWindowViewModel vm)
+ {
+ vm.ChangeLanguage("en");
+ }
+ }
+
+ private void OnChangeLanguageChinese(object? sender, RoutedEventArgs e)
+ {
+ if (DataContext is MainWindowViewModel vm)
+ {
+ vm.ChangeLanguage("zh");
+ }
+ }
+
protected override void OnClosing(WindowClosingEventArgs e)
{
if (e.CloseReason == WindowCloseReason.ApplicationShutdown)
diff --git a/gui/Views/ProxyRulesWindow.axaml b/gui/Views/ProxyRulesWindow.axaml
index 76df5a8..07d1d81 100644
--- a/gui/Views/ProxyRulesWindow.axaml
+++ b/gui/Views/ProxyRulesWindow.axaml
@@ -7,7 +7,7 @@
x:Class="ProxyBridge.GUI.Views.ProxyRulesWindow"
x:DataType="vm:ProxyRulesViewModel"
x:CompileBindings="True"
- Title="Process Rules"
+ Title="{Binding Loc.ProxyRulesTitle}"
Icon="/Assets/logo.ico"
Width="1000" Height="550"
MinWidth="900" MinHeight="400"
@@ -97,14 +97,14 @@
<Grid ColumnDefinitions="*,Auto">
<StackPanel Orientation="Horizontal" Spacing="10">
<TextBlock Text="⚙" FontSize="22" VerticalAlignment="Center"/>
- <TextBlock Text="Process Rules"
+ <TextBlock Text="{Binding Loc.ProxyRulesTitle}"
FontSize="18"
FontWeight="SemiBold"
Foreground="#FFE0E0E0"
VerticalAlignment="Center"/>
</StackPanel>
<Button Grid.Column="1"
- Content="➕ Add Rule"
+ Content="{Binding Loc.ButtonAdd}"
Command="{Binding AddRuleCommand}"
IsVisible="{Binding !IsAddRuleViewOpen}"/>
</Grid>
@@ -125,49 +125,49 @@
Padding="20,12">
<Grid ColumnDefinitions="80,140,60,200,150,120,80,*">
<TextBlock Grid.Column="0"
- Text="Enabled"
+ Text="{Binding Loc.EnabledLabel}"
FontSize="13"
FontWeight="SemiBold"
Foreground="#FFB0B0B0"
Margin="0,0,10,0"/>
<TextBlock Grid.Column="1"
- Text="Actions"
+ Text="{Binding Loc.ActionsLabel}"
FontSize="13"
FontWeight="SemiBold"
Foreground="#FFB0B0B0"
Margin="0,0,10,0"/>
<TextBlock Grid.Column="2"
- Text="SR"
+ Text="{Binding Loc.SRLabel}"
FontSize="13"
FontWeight="SemiBold"
Foreground="#FFB0B0B0"
Margin="0,0,10,0"/>
<TextBlock Grid.Column="3"
- Text="Process"
+ Text="{Binding Loc.ProcessLabel}"
FontSize="13"
FontWeight="SemiBold"
Foreground="#FFB0B0B0"
Margin="0,0,10,0"/>
<TextBlock Grid.Column="4"
- Text="Target Hosts"
+ Text="{Binding Loc.TargetHostsLabel}"
FontSize="13"
FontWeight="SemiBold"
Foreground="#FFB0B0B0"
Margin="0,0,10,0"/>
<TextBlock Grid.Column="5"
- Text="Target Ports"
+ Text="{Binding Loc.TargetPortsLabel}"
FontSize="13"
FontWeight="SemiBold"
Foreground="#FFB0B0B0"
Margin="0,0,10,0"/>
<TextBlock Grid.Column="6"
- Text="Protocol"
+ Text="{Binding Loc.ProtocolLabel}"
FontSize="13"
FontWeight="SemiBold"
Foreground="#FFB0B0B0"
Margin="0,0,10,0"/>
<TextBlock Grid.Column="7"
- Text="Action"
+ Text="{Binding Loc.ActionLabel}"
FontSize="13"
FontWeight="SemiBold"
Foreground="#FFB0B0B0"/>
@@ -195,13 +195,13 @@
Spacing="8"
VerticalAlignment="Center"
Margin="0,0,10,0">
- <Button Content="✏ Edit"
+ <Button Content="{Binding $parent[ItemsControl].((vm:ProxyRulesViewModel)DataContext).Loc.ButtonEdit, StringFormat='✏ {0}'}"
Command="{Binding $parent[ItemsControl].((vm:ProxyRulesViewModel)DataContext).EditRuleCommand}"
CommandParameter="{Binding}"
Padding="8,4"
MinWidth="60"
FontSize="12"/>
- <Button Content="🗑 Delete"
+ <Button Content="{Binding $parent[ItemsControl].((vm:ProxyRulesViewModel)DataContext).Loc.ButtonDelete, StringFormat='🗑 {0}'}"
Command="{Binding $parent[ItemsControl].((vm:ProxyRulesViewModel)DataContext).DeleteRuleCommand}"
CommandParameter="{Binding}"
Padding="8,4"
@@ -265,19 +265,19 @@
Spacing="20">
<!-- Applications Section -->
<StackPanel Spacing="6">
- <TextBlock Text="Applications" Classes="label"/>
+ <TextBlock Text="{Binding Loc.ApplicationsLabel}" Classes="label"/>
<Grid ColumnDefinitions="*,Auto">
<TextBox Grid.Column="0"
Text="{Binding NewProcessName}"
Watermark="Any"
Margin="0,0,8,0"/>
<Button Grid.Column="1"
- Content="Browse..."
+ Content="{Binding Loc.BrowseButton}"
Command="{Binding BrowseProcessCommand}"
Padding="12,8"
MinWidth="100"/>
</Grid>
- <TextBlock Text="Example: iexplore.exe; &quot;C:\some app.exe&quot;; fire*.exe; *.bin"
+ <TextBlock Text="{Binding Loc.ExampleApplications}"
FontSize="11"
Foreground="#FF999999"
TextWrapping="Wrap"
@@ -286,10 +286,10 @@
<!-- Target Hosts Section -->
<StackPanel Spacing="6">
- <TextBlock Text="Target hosts" Classes="label"/>
+ <TextBlock Text="{Binding Loc.TargetHostsLabel}" Classes="label"/>
<TextBox Text="{Binding NewTargetHosts}"
Watermark="Any"/>
- <TextBlock Text="Example: 127.0.0.1; *.example.com; 192.168.1.*; 10.1.0.0-10.5.255.255"
+ <TextBlock Text="{Binding Loc.ExampleTargetHosts}"
FontSize="11"
Foreground="#FF999999"
TextWrapping="Wrap"
@@ -298,10 +298,10 @@
<!-- Target Ports Section -->
<StackPanel Spacing="6">
- <TextBlock Text="Target ports" Classes="label"/>
+ <TextBlock Text="{Binding Loc.TargetPortsLabel}" Classes="label"/>
<TextBox Text="{Binding NewTargetPorts}"
Watermark="Any"/>
- <TextBlock Text="Example: 80; 8000-9000; 3128"
+ <TextBlock Text="{Binding Loc.ExampleTargetPorts}"
FontSize="11"
Foreground="#FF999999"
TextWrapping="Wrap"
@@ -310,24 +310,24 @@
<!-- Protocol Section -->
<StackPanel Spacing="6">
- <TextBlock Text="Protocol" Classes="label"/>
+ <TextBlock Text="{Binding Loc.ProtocolLabel}" Classes="label"/>
<ComboBox HorizontalAlignment="Stretch"
x:Name="ProtocolComboBox">
- <ComboBoxItem Content="TCP" Tag="TCP"/>
- <ComboBoxItem Content="UDP" Tag="UDP"/>
- <ComboBoxItem Content="Both (TCP + UDP)" Tag="BOTH"/>
+ <ComboBoxItem Content="{Binding Loc.ProtocolTCP}" Tag="TCP"/>
+ <ComboBoxItem Content="{Binding Loc.ProtocolUDP}" Tag="UDP"/>
+ <ComboBoxItem Content="{Binding Loc.ProtocolBoth}" Tag="BOTH"/>
</ComboBox>
</StackPanel>
<!-- Action Section -->
<StackPanel Spacing="6">
- <TextBlock Text="Action" Classes="label"/>
+ <TextBlock Text="{Binding Loc.ActionLabel}" Classes="label"/>
<ComboBox HorizontalAlignment="Stretch"
x:Name="ActionComboBox"
SelectionChanged="ActionComboBox_SelectionChanged">
- <ComboBoxItem Content="PROXY" Tag="PROXY"/>
- <ComboBoxItem Content="DIRECT" Tag="DIRECT"/>
- <ComboBoxItem Content="BLOCK" Tag="BLOCK"/>
+ <ComboBoxItem Content="{Binding Loc.ActionProxy}" Tag="PROXY"/>
+ <ComboBoxItem Content="{Binding Loc.ActionDirect}" Tag="DIRECT"/>
+ <ComboBoxItem Content="{Binding Loc.ActionBlock}" Tag="BLOCK"/>
</ComboBox>
</StackPanel>
@@ -343,11 +343,11 @@
HorizontalAlignment="Right"
Spacing="12"
Margin="0,16,0,0">
- <Button Content="Cancel"
+ <Button Content="{Binding Loc.ButtonCancel}"
Classes="secondary"
Command="{Binding CancelAddRuleCommand}"
Width="100"/>
- <Button Content="Save Rule"
+ <Button Content="{Binding Loc.SaveRuleButton}"
Command="{Binding SaveNewRuleCommand}"
Width="130"/>
</StackPanel>
diff --git a/gui/Views/ProxySettingsWindow.axaml b/gui/Views/ProxySettingsWindow.axaml
index 2b82418..0d2ccb5 100644
--- a/gui/Views/ProxySettingsWindow.axaml
+++ b/gui/Views/ProxySettingsWindow.axaml
@@ -7,7 +7,7 @@
x:Class="ProxyBridge.GUI.Views.ProxySettingsWindow"
x:DataType="vm:ProxySettingsViewModel"
x:CompileBindings="True"
- Title="Proxy Settings"
+ Title="{Binding Loc.ProxySettingsTitle}"
Icon="/Assets/logo.ico"
Width="500" Height="650"
MinHeight="550"
@@ -76,7 +76,7 @@
<Border DockPanel.Dock="Top" Background="#FF1E1E1E" Padding="20,16">
<StackPanel Orientation="Horizontal" Spacing="10">
<TextBlock Text="🔧" FontSize="22" VerticalAlignment="Center"/>
- <TextBlock Text="Proxy Settings"
+ <TextBlock Text="{Binding Loc.ProxySettingsTitle}"
FontSize="18"
FontWeight="SemiBold"
Foreground="#FFE0E0E0"
@@ -89,7 +89,7 @@
HorizontalScrollBarVisibility="Disabled">
<StackPanel Margin="24,20" Spacing="20">
<StackPanel Spacing="6">
- <TextBlock Text="Proxy Type" Classes="label"/>
+ <TextBlock Text="{Binding Loc.ProxyTypeLabel}" Classes="label"/>
<ComboBox HorizontalAlignment="Stretch"
x:Name="ProxyTypeComboBox">
<ComboBoxItem Content="SOCKS5" Tag="SOCKS5"/>
@@ -98,37 +98,37 @@
</StackPanel>
<StackPanel Spacing="6">
- <TextBlock Text="Proxy IP Address *" Classes="label"/>
+ <TextBlock Text="{Binding Loc.ProxyIpLabel}" Classes="label"/>
<TextBox Text="{Binding ProxyIp}"
- Watermark="e.g., 127.0.0.1"/>
+ Watermark="{Binding Loc.ProxyIpPlaceholder}"/>
<TextBlock Text="{Binding IpError}"
Classes="error"
IsVisible="{Binding IpError, Converter={x:Static StringConverters.IsNotNullOrEmpty}}"/>
</StackPanel>
<StackPanel Spacing="6">
- <TextBlock Text="Proxy Port *" Classes="label"/>
+ <TextBlock Text="{Binding Loc.ProxyPortLabel}" Classes="label"/>
<TextBox Text="{Binding ProxyPort}"
- Watermark="e.g., 1080"/>
+ Watermark="{Binding Loc.ProxyPortPlaceholder}"/>
<TextBlock Text="{Binding PortError}"
Classes="error"
IsVisible="{Binding PortError, Converter={x:Static StringConverters.IsNotNullOrEmpty}}"/>
</StackPanel>
<StackPanel Spacing="6">
- <TextBlock Text="Username (Optional)" Classes="label"/>
+ <TextBlock Text="{Binding Loc.UsernameLabel}" Classes="label"/>
<TextBox Text="{Binding ProxyUsername}"
- Watermark="Leave empty if no auth required"/>
+ Watermark="{Binding Loc.UsernamePlaceholder}"/>
</StackPanel>
<StackPanel Spacing="6">
- <TextBlock Text="Password (Optional)" Classes="label"/>
+ <TextBlock Text="{Binding Loc.PasswordLabel}" Classes="label"/>
<TextBox Text="{Binding ProxyPassword}"
- Watermark="Leave empty if no auth required"
+ Watermark="{Binding Loc.PasswordPlaceholder}"
PasswordChar="●"/>
</StackPanel>
- <TextBlock Text="* Required fields"
+ <TextBlock Text="{Binding Loc.RequiredFieldsNote}"
Foreground="#FF999999"
FontSize="12"
Margin="0,8,0,0"/>
@@ -140,11 +140,11 @@
Margin="0,16,0,0"
IsVisible="{Binding !IsTestViewOpen}">
<StackPanel Spacing="12">
- <TextBlock Text="Test Connection"
+ <TextBlock Text="{Binding Loc.TestConnectionTitle}"
FontSize="14"
FontWeight="SemiBold"
Foreground="#FFE0E0E0"/>
- <Button Content="Test Proxy Connection"
+ <Button Content="{Binding Loc.TestConnectionButton}"
Command="{Binding OpenTestCommand}"
Classes="secondary"
HorizontalAlignment="Left"/>
@@ -159,7 +159,7 @@
IsVisible="{Binding IsTestViewOpen}">
<StackPanel Spacing="12">
<Grid ColumnDefinitions="*,Auto">
- <TextBlock Text="Test Connection"
+ <TextBlock Text="{Binding Loc.TestConnectionTitle}"
FontSize="14"
FontWeight="SemiBold"
Foreground="#FFE0E0E0"
@@ -175,22 +175,22 @@
<Grid ColumnDefinitions="3*,2*">
<StackPanel Grid.Column="0" Spacing="6" Margin="0,0,6,0">
- <TextBlock Text="Target Host" Classes="label"/>
+ <TextBlock Text="{Binding Loc.TargetHostLabel}" Classes="label"/>
<TextBox Text="{Binding TestTargetHost}"/>
</StackPanel>
<StackPanel Grid.Column="1" Spacing="6" Margin="6,0,0,0">
- <TextBlock Text="Port" Classes="label"/>
+ <TextBlock Text="{Binding Loc.PortLabel}" Classes="label"/>
<TextBox Text="{Binding TestTargetPort}"/>
</StackPanel>
</Grid>
- <Button Content="▶ Start Test"
+ <Button Content="{Binding Loc.StartTestButton}"
Command="{Binding StartTestCommand}"
IsEnabled="{Binding !IsTesting}"
HorizontalAlignment="Left"/>
<StackPanel Spacing="6">
- <TextBlock Text="Output" Classes="label"/>
+ <TextBlock Text="{Binding Loc.OutputLabel}" Classes="label"/>
<Border Background="#FF1E1E1E"
BorderBrush="#FF3F3F46"
BorderThickness="1"
@@ -213,11 +213,11 @@
HorizontalAlignment="Right"
Spacing="12"
Margin="0,16,0,20">
- <Button Content="Cancel"
+ <Button Content="{Binding Loc.ButtonCancel}"
Classes="secondary"
Command="{Binding CancelCommand}"
Width="100"/>
- <Button Content="Save Changes"
+ <Button Content="{Binding Loc.SaveChangesButton}"
Command="{Binding SaveCommand}"
Width="130"/>
</StackPanel>