From e4e42ccc4c8ee2b6b849a4f140786229b77e7217 Mon Sep 17 00:00:00 2001 From: abc123lzf <695199262@qq.com> Date: Wed, 24 Mar 2021 17:44:56 +0800 Subject: [PATCH] [v3.0] i18n --- .../com/lzf/flyingsocks/client/Client.java | 39 +++++ .../lzf/flyingsocks/client/ClientBoot.java | 2 +- .../lzf/flyingsocks/client/GlobalConfig.java | 3 +- .../flyingsocks/client/StandardClient.java | 2 +- .../gui/swt/HttpProxySettingModule.java | 37 ++-- .../client/gui/swt/SWTViewComponent.java | 4 +- .../client/gui/swt/SocksSettingModule.java | 24 +-- .../client/proxy/ProxyAutoConfig.java | 9 +- .../proxy/socks/SocksReceiverComponent.java | 6 +- .../META-INF/i18n/exitmsg_en.properties | 10 ++ .../META-INF/i18n/exitmsg_zh.properties | 10 ++ .../META-INF/i18n/swtui_en.properties | 17 ++ .../META-INF/i18n/swtui_zh.properties | 165 +++++++++--------- 13 files changed, 213 insertions(+), 115 deletions(-) create mode 100644 client/src/main/resources/META-INF/i18n/exitmsg_en.properties create mode 100644 client/src/main/resources/META-INF/i18n/exitmsg_zh.properties diff --git a/client/src/main/java/com/lzf/flyingsocks/client/Client.java b/client/src/main/java/com/lzf/flyingsocks/client/Client.java index a49765d..d267462 100644 --- a/client/src/main/java/com/lzf/flyingsocks/client/Client.java +++ b/client/src/main/java/com/lzf/flyingsocks/client/Client.java @@ -31,6 +31,7 @@ import org.apache.log4j.FileAppender; import org.apache.log4j.Logger; +import javax.swing.JOptionPane; import java.awt.Desktop; import java.io.File; import java.io.IOException; @@ -39,8 +40,11 @@ import java.nio.file.Files; import java.nio.file.Path; import java.nio.file.Paths; +import java.text.MessageFormat; import java.util.Enumeration; +import java.util.Locale; import java.util.Objects; +import java.util.ResourceBundle; public abstract class Client extends TopLevelComponent implements Component, Environment, ClientOperator { @@ -55,6 +59,11 @@ public abstract class Client extends TopLevelComponent */ static final String VERSION = "v3.0"; + + private static final ResourceBundle EXIT_MSG_BUNDLE = + ResourceBundle.getBundle("META-INF/i18n/exitmsg", Locale.getDefault()); + + /** * GUI事件处理循环 */ @@ -153,4 +162,34 @@ boolean runGUITask() { return false; } + + public static void exitWithNotify(int status, String message) { + if (Desktop.isDesktopSupported()) { + JOptionPane.showMessageDialog(null, message != null ? message : "", "ERROR", JOptionPane.ERROR_MESSAGE); + } + System.exit(status); + } + + + public static void exitWithNotify(int status, String string, Object... args) { + if (Desktop.isDesktopSupported()) { + String msg; + if (EXIT_MSG_BUNDLE.containsKey(string)) { + msg = EXIT_MSG_BUNDLE.getString(string); + } else { + msg = string; + } + + if (args == null || args.length == 0) { + JOptionPane.showMessageDialog(null, msg, + EXIT_MSG_BUNDLE.getString("exitmsg.title"), JOptionPane.ERROR_MESSAGE); + } else { + JOptionPane.showMessageDialog(null, MessageFormat.format(msg, args), + EXIT_MSG_BUNDLE.getString("exitmsg.title"), JOptionPane.ERROR_MESSAGE); + } + } + + System.exit(status); + } + } diff --git a/client/src/main/java/com/lzf/flyingsocks/client/ClientBoot.java b/client/src/main/java/com/lzf/flyingsocks/client/ClientBoot.java index b4b7308..c6b5f6e 100644 --- a/client/src/main/java/com/lzf/flyingsocks/client/ClientBoot.java +++ b/client/src/main/java/com/lzf/flyingsocks/client/ClientBoot.java @@ -55,7 +55,7 @@ public static void main(String[] args) { } catch (ComponentException e) { log.error("flyingsocks client {} start failure, cause:", VERSION, e); log.info("submit issue at https://github.com/abc123lzf/flyingsocks"); - System.exit(1); + Client.exitWithNotify(1, "exitmsg.client_boot.start_failure", e.getMessage()); } long ed = System.currentTimeMillis(); diff --git a/client/src/main/java/com/lzf/flyingsocks/client/GlobalConfig.java b/client/src/main/java/com/lzf/flyingsocks/client/GlobalConfig.java index 78722e0..669f570 100644 --- a/client/src/main/java/com/lzf/flyingsocks/client/GlobalConfig.java +++ b/client/src/main/java/com/lzf/flyingsocks/client/GlobalConfig.java @@ -225,7 +225,8 @@ public void save() throws Exception { properties.put("enable-transparent", Boolean.toString(this.enableTransparentProxy)); properties.put("connect-timeout", Integer.toString(this.connectTimeout)); - try (FileWriter writer = new FileWriter(path.toFile())) { + Path path = this.path; + try (FileWriter writer = new FileWriter(path.resolve(FILE_NAME).toFile())) { properties.store(writer, "flyingsocks base configuration"); } catch (IOException e) { throw new ConfigInitializationException("Can not initialize global config file", e); diff --git a/client/src/main/java/com/lzf/flyingsocks/client/StandardClient.java b/client/src/main/java/com/lzf/flyingsocks/client/StandardClient.java index aef7b3a..71a5759 100644 --- a/client/src/main/java/com/lzf/flyingsocks/client/StandardClient.java +++ b/client/src/main/java/com/lzf/flyingsocks/client/StandardClient.java @@ -59,7 +59,7 @@ protected void initInternal() { p.forEach((k, v) -> setSystemProperties((String) k, (String) v)); } catch (IOException e) { log.error("Read config.properties occur a exception", e); - System.exit(1); + exitWithNotify(1, "exitmsg.standard_client.config_load_error", e.getMessage()); } GlobalConfig cfg = new GlobalConfig(getConfigManager()); diff --git a/client/src/main/java/com/lzf/flyingsocks/client/gui/swt/HttpProxySettingModule.java b/client/src/main/java/com/lzf/flyingsocks/client/gui/swt/HttpProxySettingModule.java index f281b73..02d6574 100644 --- a/client/src/main/java/com/lzf/flyingsocks/client/gui/swt/HttpProxySettingModule.java +++ b/client/src/main/java/com/lzf/flyingsocks/client/gui/swt/HttpProxySettingModule.java @@ -27,6 +27,7 @@ import com.lzf.flyingsocks.client.GlobalConfig; import com.lzf.flyingsocks.client.gui.ResourceManager; import com.lzf.flyingsocks.client.proxy.http.HttpProxyConfig; +import org.apache.commons.lang3.StringUtils; import org.eclipse.swt.SWT; import org.eclipse.swt.graphics.Image; import org.eclipse.swt.widgets.Button; @@ -70,21 +71,21 @@ public class HttpProxySettingModule extends AbstractModule { throw new Error(e); } - this.shell = createShell(component.getDisplay(), "HTTP本地代理设置", icon, 600, 280); + this.shell = createShell(component.getDisplay(), "swtui.http.title", icon, 600, 280); initial(); } private void initial() { - createLabel(shell, "开关", 20, 5, 80, 30, SWT.CENTER); - createLabel(shell, "代理端口", 20, 40, 80, 30, SWT.CENTER); - createLabel(shell, "认证", 20, 75, 80, 30, SWT.CENTER); - createLabel(shell, "用户名", 20, 110, 80, 30, SWT.CENTER); - createLabel(shell, "密码", 20, 145, 80, 30, SWT.CENTER); + createLabel(shell, "swtui.http.form.label.switch", 20, 5, 80, 30, SWT.CENTER); + createLabel(shell, "swtui.http.form.label.port", 20, 40, 80, 30, SWT.CENTER); + createLabel(shell, "swtui.http.form.label.validate", 20, 75, 80, 30, SWT.CENTER); + createLabel(shell, "swtui.http.form.label.username", 20, 110, 80, 30, SWT.CENTER); + createLabel(shell, "swtui.http.form.label.password", 20, 145, 80, 30, SWT.CENTER); Composite switchComp = new Composite(shell, SWT.NONE); switchComp.setBounds(20, 5, 380, 30); - Button openRadio = createRadio(switchComp, "开启", 140, 5, 80, 30); - Button closeRadio = createRadio(switchComp, "关闭", 230, 5, 80, 30); + Button openRadio = createRadio(switchComp, "swtui.http.form.button.switch_open", 140, 5, 80, 30); + Button closeRadio = createRadio(switchComp, "swtui.http.form.button.switch_close", 230, 5, 80, 30); addButtonSelectionListener(openRadio, e -> { openRadio.setSelection(true); closeRadio.setSelection(false); @@ -99,8 +100,8 @@ private void initial() { Composite authComp = new Composite(shell, SWT.NONE); authComp.setBounds(20, 75, 380, 30); - Button authOpenRadio = createRadio(authComp, "开启", 140, 0, 80, 30); - Button authCloseRadio = createRadio(authComp, "关闭", 230, 0, 80, 30); + Button authOpenRadio = createRadio(authComp, "swtui.http.form.button.validate_open", 140, 0, 80, 30); + Button authCloseRadio = createRadio(authComp, "swtui.http.form.button.validate_close", 230, 0, 80, 30); addButtonSelectionListener(authCloseRadio, e -> { authCloseRadio.setSelection(true); authOpenRadio.setSelection(false); @@ -116,23 +117,29 @@ private void initial() { Text passText = new Text(shell, SWT.BORDER | SWT.PASSWORD); passText.setBounds(160, 145, 380, 30); - Button enterBtn = createButton(shell, "确认", 140, 180, 150, 35); - Button cancelBtn = createButton(shell, "取消", 330, 180, 150, 35); + Button enterBtn = createButton(shell, "swtui.http.form.button.enter", 140, 180, 150, 35); + Button cancelBtn = createButton(shell, "swtui.http.form.button.cancel", 330, 180, 150, 35); addButtonSelectionListener(enterBtn, e -> { boolean open = openRadio.getSelection(); - boolean auth = authCloseRadio.getSelection(); + boolean auth = authOpenRadio.getSelection(); int port; try { port = Integer.parseInt(portText.getText()); } catch (NumberFormatException nfe) { - showMessageBox(shell, "错误", "端口格式错误", SWT.ICON_ERROR | SWT.OK); + showMessageBox(shell, "swtui.http.notice.error.title", "swtui.http.notice.error.port_error", SWT.ICON_ERROR | SWT.OK); return; } String username = userText.getText(); String password = passText.getText(); + + if (auth && StringUtils.isAnyBlank(username, password)) { + showMessageBox(shell, "swtui.http.notice.error.title", "swtui.http.notice.error.auth_error", SWT.ICON_ERROR | SWT.OK); + return; + } + operator.updateHttpProxyConfig(open, port, auth, username, password); - showMessageBox(shell, "提示", "修改成功", SWT.ICON_INFORMATION | SWT.OK); + showMessageBox(shell, "swtui.http.notice.error.title", "swtui.http.notice.update_success", SWT.ICON_INFORMATION | SWT.OK); }); if (operator.isHttpProxyOpen()) { diff --git a/client/src/main/java/com/lzf/flyingsocks/client/gui/swt/SWTViewComponent.java b/client/src/main/java/com/lzf/flyingsocks/client/gui/swt/SWTViewComponent.java index f231bde..3a0fd23 100644 --- a/client/src/main/java/com/lzf/flyingsocks/client/gui/swt/SWTViewComponent.java +++ b/client/src/main/java/com/lzf/flyingsocks/client/gui/swt/SWTViewComponent.java @@ -86,7 +86,7 @@ protected void initInternal() { addModule(this.httpProxySettingModule = new HttpProxySettingModule(this)); } catch (Throwable t) { log.error("SWT Thread occur a error", t); - System.exit(1); + Client.exitWithNotify(1, "exitmsg.swt_view.init_failure", t.getMessage()); } } @@ -104,7 +104,7 @@ protected void startInternal() { display.dispose(); } catch (RuntimeException | Error t) { log.error("An error occur in SWT-UI-Thread", t); - System.exit(1); + Client.exitWithNotify(1, "exitmsg.swt_view.run_error", t.getMessage()); } }); } diff --git a/client/src/main/java/com/lzf/flyingsocks/client/gui/swt/SocksSettingModule.java b/client/src/main/java/com/lzf/flyingsocks/client/gui/swt/SocksSettingModule.java index 2f3c4f9..d7845ee 100644 --- a/client/src/main/java/com/lzf/flyingsocks/client/gui/swt/SocksSettingModule.java +++ b/client/src/main/java/com/lzf/flyingsocks/client/gui/swt/SocksSettingModule.java @@ -73,13 +73,13 @@ final class SocksSettingModule extends AbstractModule { } private void initial() { - createLabel(shell, "验证", 20, 5, 80, 30, SWT.CENTER); - createLabel(shell, "用户名", 20, 40, 80, 30, SWT.CENTER); - createLabel(shell, "密码", 20, 75, 80, 30, SWT.CENTER); - createLabel(shell, "代理端口", 20, 110, 80, 30, SWT.CENTER); + createLabel(shell, "swtui.socks5.form.label.validate", 20, 5, 80, 30, SWT.CENTER); + createLabel(shell, "swtui.socks5.form.label.username", 20, 40, 80, 30, SWT.CENTER); + createLabel(shell, "swtui.socks5.form.label.password", 20, 75, 80, 30, SWT.CENTER); + createLabel(shell, "swtui.socks5.form.label.port", 20, 110, 80, 30, SWT.CENTER); - Button open = createRadio(shell, "打开", 160, 5, 80, 30); - Button off = createRadio(shell, "关闭", 250, 5, 80, 30); + Button open = createRadio(shell, "swtui.socks5.form.button.open", 160, 5, 80, 30); + Button off = createRadio(shell, "swtui.socks5.form.button.close", 250, 5, 80, 30); Text user = new Text(shell, SWT.BORDER); user.setBounds(160, 40, 380, 30); @@ -88,7 +88,7 @@ private void initial() { Text port = new Text(shell, SWT.BORDER); port.setBounds(160, 110, 130, 30); - Button enter = createButton(shell, "确认", 170, 145, 150, 30); + Button enter = createButton(shell, "swtui.socks5.form.button.enter", 170, 145, 150, 30); addButtonSelectionListener(enter, e -> { boolean auth = open.getSelection(); String username = user.getText(); @@ -97,16 +97,18 @@ private void initial() { if (BaseUtils.isPortString(port.getText())) { p = Integer.parseInt(port.getText()); } else { - showMessageBox(shell, "提示", "端口不合法", SWT.ICON_ERROR | SWT.OK); + showMessageBox(shell, "swtui.socks5.notice.title", "swtui.socks5.notice.port_error", SWT.ICON_ERROR | SWT.OK); return; } operator.updateSocksProxyAuthentication(p, auth, username, password); SocksConfig cfg = operator.getSocksConfig(); if (cfg.getPort() != p) { - showMessageBox(shell, "提示", "修改完成, 代理端口的修改需要重启才可生效", SWT.ICON_INFORMATION | SWT.OK); + showMessageBox(shell, "swtui.socks5.notice.title", "swtui.socks5.notice.update_success", + SWT.ICON_INFORMATION | SWT.OK); } else { - showMessageBox(shell, "提示", "修改完成", SWT.ICON_INFORMATION | SWT.OK); + showMessageBox(shell, "swtui.socks5.notice.title", "swtui.socks5.notice.unchanged", + SWT.ICON_INFORMATION | SWT.OK); } }); @@ -120,7 +122,7 @@ private void initial() { pass.setEditable(false); }); - Button cancel = createButton(shell, "取消", 360, 145, 150, 30); + Button cancel = createButton(shell, "swtui.socks5.form.button.cancel", 360, 145, 150, 30); addButtonSelectionListener(cancel, e -> setVisiable(false)); SocksConfig cfg = operator.getSocksConfig(); diff --git a/client/src/main/java/com/lzf/flyingsocks/client/proxy/ProxyAutoConfig.java b/client/src/main/java/com/lzf/flyingsocks/client/proxy/ProxyAutoConfig.java index 8fe3db2..ea73e12 100644 --- a/client/src/main/java/com/lzf/flyingsocks/client/proxy/ProxyAutoConfig.java +++ b/client/src/main/java/com/lzf/flyingsocks/client/proxy/ProxyAutoConfig.java @@ -25,6 +25,7 @@ import com.lzf.flyingsocks.Config; import com.lzf.flyingsocks.ConfigInitializationException; import com.lzf.flyingsocks.ConfigManager; +import com.lzf.flyingsocks.client.Client; import com.lzf.flyingsocks.client.GlobalConfig; import com.lzf.flyingsocks.misc.BaseUtils; import org.apache.commons.lang3.StringUtils; @@ -104,7 +105,7 @@ protected void initInternal() throws ConfigInitializationException { loadGFWListFile(gfwFile); } catch (IOException e) { log.error("Read GFWList file occur a exception", e); - System.exit(1); + Client.exitWithNotify(1, "exitmsg.pac.gfw_load_error", e.getMessage()); } Path cnipv4file = cfg.configPath().resolve(CNIPV4_FILE); @@ -116,7 +117,7 @@ protected void initInternal() throws ConfigInitializationException { loadIPv4CNAddressFile(cnipv4file); } catch (IOException e) { log.error("Read CN IPv4 file occur a exception", e); - System.exit(1); + Client.exitWithNotify(1, "exitmsg.pac.ipv4_load_error", e.getMessage()); } int proxyMode; @@ -290,7 +291,7 @@ private void copyGFWListConfig() { } } catch (IOException e) { log.error("Can not find default pac file", e); - System.exit(1); + Client.exitWithNotify(1, "exitmsg.pac.gfw_default_load_error", e.getMessage()); } } @@ -307,7 +308,7 @@ private void copyCNIPv4Config() { } } catch (IOException e) { log.error("Can not find default CN IPv4 file", e); - System.exit(1); + Client.exitWithNotify(1, "exitmsg.pac.ipv4_default_load_error", e.getMessage()); } } diff --git a/client/src/main/java/com/lzf/flyingsocks/client/proxy/socks/SocksReceiverComponent.java b/client/src/main/java/com/lzf/flyingsocks/client/proxy/socks/SocksReceiverComponent.java index ccedbc0..cfe9826 100644 --- a/client/src/main/java/com/lzf/flyingsocks/client/proxy/socks/SocksReceiverComponent.java +++ b/client/src/main/java/com/lzf/flyingsocks/client/proxy/socks/SocksReceiverComponent.java @@ -24,6 +24,7 @@ import com.lzf.flyingsocks.AbstractComponent; import com.lzf.flyingsocks.ComponentException; import com.lzf.flyingsocks.Config; +import com.lzf.flyingsocks.client.Client; import com.lzf.flyingsocks.client.proxy.ProxyComponent; import com.lzf.flyingsocks.client.proxy.ProxyRequest; import com.lzf.flyingsocks.misc.BaseUtils; @@ -113,6 +114,9 @@ protected void initInternal() { @Override protected void startInternal() { + EventLoopGroup eventLoopGroup = this.eventLoopGroup; + String bindAddress = this.bindAddress; + int port = this.port; try { ServerBootstrap boot = new ServerBootstrap(); boot.group(eventLoopGroup) @@ -130,7 +134,7 @@ protected void initChannel(SocketChannel channel) { boot.bind(bindAddress, port).addListener(f -> { if (!f.isSuccess()) { log.error("Socks server bind failure, address:[{}:{}]", bindAddress, port, f.cause()); - System.exit(1); + Client.exitWithNotify(1, "exitmsg.socks.bind_error", port, f.cause().getMessage()); } else { log.info("Netty socks server complete"); } diff --git a/client/src/main/resources/META-INF/i18n/exitmsg_en.properties b/client/src/main/resources/META-INF/i18n/exitmsg_en.properties new file mode 100644 index 0000000..83ba551 --- /dev/null +++ b/client/src/main/resources/META-INF/i18n/exitmsg_en.properties @@ -0,0 +1,10 @@ +exitmsg.title = ERROR +exitmsg.client_boot.start_failure = Startup failure, error message\uFF1A{0} +exitmsg.standard_client.config_load_error = Load config file at classpath://config.properties failure, detail message\uFF1A{0} +exitmsg.swt_view.init_failure = UI component startup failure, detail message: {0} +exitmsg.swt_view.run_error = An error occurred during the operation of the UI component, detail message: {0} +exitmsg.pac.gfw_load_error = An error occurred while reading the GFW list file, detail message: {0} +exitmsg.pac.ipv4_load_error = An error occurred while reading the IPv4 whitelist file, detail message: {0} +exitmsg.pac.gfw_default_load_error = Error reading the default GFW list file, detail message: {0} +exitmsg.pac.ipv4_default_load_error = Error reading the default IPv4 list file, detail message: {0} +exitmsg.socks.bind_error = Unable to bind local SOCKS5 proxy port {0}, error message: {1} \ No newline at end of file diff --git a/client/src/main/resources/META-INF/i18n/exitmsg_zh.properties b/client/src/main/resources/META-INF/i18n/exitmsg_zh.properties new file mode 100644 index 0000000..80c9659 --- /dev/null +++ b/client/src/main/resources/META-INF/i18n/exitmsg_zh.properties @@ -0,0 +1,10 @@ +exitmsg.title = \u9519\u8BEF +exitmsg.client_boot.start_failure = \u542F\u52A8\u9519\u8BEF\uFF0C\u9519\u8BEF\u4FE1\u606F\uFF1A{0} +exitmsg.standard_client.config_load_error = \u8BFB\u53D6\u914D\u7F6E\u6587\u4EF6classpath://config.properties\u5931\u8D25\uFF0C\u8BE6\u7EC6\u4FE1\u606F\uFF1A{0} +exitmsg.swt_view.init_failure = UI\u7EC4\u4EF6\u542F\u52A8\u5931\u8D25\uFF0C\u8BE6\u7EC6\u4FE1\u606F\uFF1A{0} +exitmsg.swt_view.run_error = UI\u7EC4\u4EF6\u8FD0\u884C\u671F\u95F4\u53D1\u751F\u9519\u8BEF\uFF0C\u8BE6\u7EC6\u4FE1\u606F\uFF1A{0} +exitmsg.pac.gfw_load_error = \u8BFB\u53D6GFW\u5217\u8868\u6587\u4EF6\u53D1\u751F\u9519\u8BEF\uFF0C\u8BE6\u7EC6\u4FE1\u606F\uFF1A{0} +exitmsg.pac.ipv4_load_error = \u8BFB\u53D6IPv4\u767D\u540D\u5355\u5217\u8868\u6587\u4EF6\u53D1\u751F\u9519\u8BEF\uFF0C\u8BE6\u7EC6\u4FE1\u606F\uFF1A{0} +exitmsg.pac.gfw_default_load_error = \u8BFB\u53D6\u9ED8\u8BA4GFW\u5217\u8868\u6587\u4EF6\u53D1\u751F\u9519\u8BEF\uFF0C\u8BE6\u7EC6\u4FE1\u606F\uFF1A{0} +exitmsg.pac.ipv4_default_load_error = \u8BFB\u53D6\u9ED8\u8BA4IPv4\u5217\u8868\u6587\u4EF6\u53D1\u751F\u9519\u8BEF\uFF0C\u8BE6\u7EC6\u4FE1\u606F\uFF1A{0} +exitmsg.socks.bind_error = \u65E0\u6CD5\u7ED1\u5B9A\u672C\u5730SOCKS5\u4EE3\u7406\u7AEF\u53E3{0}\uFF0C\u9519\u8BEF\u4FE1\u606F\uFF1A{1} \ No newline at end of file diff --git a/client/src/main/resources/META-INF/i18n/swtui_en.properties b/client/src/main/resources/META-INF/i18n/swtui_en.properties index e746d28..1493848 100644 --- a/client/src/main/resources/META-INF/i18n/swtui_en.properties +++ b/client/src/main/resources/META-INF/i18n/swtui_en.properties @@ -74,3 +74,20 @@ swtui.socks5.form.button.cancel = Cancel swtui.socks5.notice.port_error = Port illegal swtui.socks5.notice.update_success = Update success, you need rebot program so that can be done. swtui.socks5.notice.unchanged = Update success + +swtui.http.title = HTTP proxy setup +swtui.http.form.label.switch = Switch +swtui.http.form.label.port = Port +swtui.http.form.label.validate = Validate +swtui.http.form.label.username = Username +swtui.http.form.label.password = Password +swtui.http.form.button.switch_open = Enable +swtui.http.form.button.switch_close = Close +swtui.http.form.button.validate_open = Enable +swtui.http.form.button.validate_close = Close +swtui.http.form.button.enter = Confirm +swtui.http.form.button.cancel = Cancel +swtui.http.notice.error.title = Error +swtui.http.notice.error.port_error = Incorrect port number (A number between 1 and 65535) +swtui.http.notice.error.auth_error = When authentication is turned on, the username and password must not be empty. +swtui.http.notice.update_success = Update successful, some settings need to restart the program to take effect. \ No newline at end of file diff --git a/client/src/main/resources/META-INF/i18n/swtui_zh.properties b/client/src/main/resources/META-INF/i18n/swtui_zh.properties index 798dab4..f98e355 100644 --- a/client/src/main/resources/META-INF/i18n/swtui_zh.properties +++ b/client/src/main/resources/META-INF/i18n/swtui_zh.properties @@ -1,87 +1,94 @@ -swtui.tray.item.open_main_screen_ui = \u6253\u5f00\u4e3b\u754c\u9762 -swtui.tray.item.server_config_ui = \u7f16\u8f91\u670d\u52a1\u5668\u914d\u7f6e... -swtui.tray.item.socks5_config_ui = \u672c\u5730Socks5\u4ee3\u7406\u8bbe\u7f6e... -swtui.tray.item.http_config_ui = \u672c\u5730HTTP\u4ee3\u7406\u8bbe\u7f6e... -swtui.tray.item.exit = \u9000\u51fa -swtui.tray.item.proxy_mode = \u4ee3\u7406\u6a21\u5f0f -swtui.tray.item.proxy_mode.no_proxy = \u4e0d\u4ee3\u7406 -swtui.tray.item.proxy_mode.gfwlist = GFW List\u6a21\u5f0f -swtui.tray.item.proxy_mode.ipwhitelist = \u4ec5\u4ee3\u7406\u5883\u5916\u5730\u5740 -swtui.tray.item.proxy_mode.global = \u5168\u5c40\u4ee3\u7406 -swtui.tray.item.help = \u5e2e\u52a9/\u5173\u4e8e -swtui.tray.item.help.open_config_dir = \u6253\u5f00\u914d\u7f6e\u6587\u4ef6\u76ee\u5f55 -swtui.tray.item.help.open_log_dir = \u6253\u5f00\u65e5\u5fd7\u6587\u4ef6\u76ee\u5f55 -swtui.tray.item.help.clean_log = \u6e05\u7a7a\u65e5\u5fd7 +swtui.tray.item.open_main_screen_ui = \u6253\u5F00\u4E3B\u754C\u9762 +swtui.tray.item.server_config_ui = \u7F16\u8F91\u670D\u52A1\u5668\u914D\u7F6E... +swtui.tray.item.socks5_config_ui = \u672C\u5730Socks5\u4EE3\u7406\u8BBE\u7F6E... +swtui.tray.item.http_config_ui = \u672C\u5730HTTP\u4EE3\u7406\u8BBE\u7F6E... +swtui.tray.item.exit = \u9000\u51FA +swtui.tray.item.proxy_mode = \u4EE3\u7406\u6A21\u5F0F +swtui.tray.item.proxy_mode.no_proxy = \u4E0D\u4EE3\u7406 +swtui.tray.item.proxy_mode.gfwlist = GFW List\u6A21\u5F0F +swtui.tray.item.proxy_mode.ipwhitelist = \u4EC5\u4EE3\u7406\u5883\u5916\u5730\u5740 +swtui.tray.item.proxy_mode.global = \u5168\u5C40\u4EE3\u7406 +swtui.tray.item.help = \u5E2E\u52A9/\u5173\u4E8E +swtui.tray.item.help.open_config_dir = \u6253\u5F00\u914D\u7F6E\u6587\u4EF6\u76EE\u5F55 +swtui.tray.item.help.open_log_dir = \u6253\u5F00\u65E5\u5FD7\u6587\u4EF6\u76EE\u5F55 +swtui.tray.item.help.clean_log = \u6E05\u7A7A\u65E5\u5FD7 swtui.tray.item.help.open_github = GitHub\u9875\u9762 -swtui.tray.item.help.open_issue = \u95ee\u9898\u53cd\u9988 +swtui.tray.item.help.open_issue = \u95EE\u9898\u53CD\u9988 -swtui.main.title = \u4e3b\u754c\u9762 -swtui.main.serverlist.label = \u9009\u62e9\u670d\u52a1\u5668 -swtui.main.status.not_connect = \u672a\u8fde\u63a5 -swtui.main.status.new = \u521d\u59cb\u5316\u4e2d... -swtui.main.status.ssl_initial = \u51c6\u5907SSL\u8bc1\u4e66\u8fde\u63a5... -swtui.main.status.ssl_connecting = \u6b63\u5728\u53d1\u8d77SSL\u8bc1\u4e66\u8fde\u63a5... -swtui.main.status.ssl_connect_timeout = SSL\u8bc1\u4e66\u8fde\u63a5\u8d85\u65f6,\u8bf7\u68c0\u67e5\u670d\u52a1\u5668\u914d\u7f6e -swtui.main.status.ssl_connect_auth_failure = \u672a\u901a\u8fc7\u670d\u52a1\u5668\u8ba4\u8bc1,\u8bf7\u68c0\u67e5\u8ba4\u8bc1\u4fe1\u606f\u662f\u5426\u6b63\u786e -swtui.main.status.ssl_connect = \u6b63\u5728\u83b7\u53d6SSL\u8bc1\u4e66... -swtui.main.status.ssl_connect_done = SSL\u8bc1\u4e66\u83b7\u53d6\u5b8c\u6210 -swtui.main.status.ssl_connect_error = SSL\u8bc1\u4e66\u83b7\u53d6\u9519\u8bef -swtui.main.status.proxy_initial = \u51c6\u5907\u53d1\u8d77\u4ee3\u7406\u8fde\u63a5... -swtui.main.status.proxy_connecting = \u6b63\u5728\u8fde\u63a5\u4ee3\u7406\u670d\u52a1... -swtui.main.status.proxy_connect_timeout = \u4ee3\u7406\u670d\u52a1\u8fde\u63a5\u8d85\u65f6 -swtui.main.status.proxy_connect = \u6210\u529f\u4e0e\u670d\u52a1\u5668\u5efa\u7acb\u4ee3\u7406\u670d\u52a1\u8fde\u63a5 -swtui.main.status.proxy_connect_auth_failure = \u4ee3\u7406\u670d\u52a1\u8ba4\u8bc1\u5931\u8d25,\u8bf7\u68c0\u67e5\u8ba4\u8bc1\u4fe1\u606f\u662f\u5426\u6b63\u786e -swtui.main.status.proxy_connect_error = \u4e0e\u4ee3\u7406\u670d\u52a1\u8fde\u63a5\u53d1\u751f\u9519\u8bef -swtui.main.status.proxy_disconnect = \u6682\u65f6\u4e0e\u670d\u52a1\u5668\u65ad\u5f00\u8fde\u63a5,\u5c1d\u8bd5\u8fdb\u884c\u91cd\u8fde... -swtui.main.status.proxy_unused = \u4ee3\u7406\u670d\u52a1\u5668\u8fde\u63a5\u5df2\u505c\u6b62 +swtui.main.title = \u4E3B\u754C\u9762 +swtui.main.serverlist.label = \u9009\u62E9\u670D\u52A1\u5668 +swtui.main.status.not_connect = \u672A\u8FDE\u63A5 +swtui.main.status.new = \u521D\u59CB\u5316\u4E2D... +swtui.main.status.ssl_initial = \u51C6\u5907SSL\u8BC1\u4E66\u8FDE\u63A5... +swtui.main.status.ssl_connecting = \u6B63\u5728\u53D1\u8D77SSL\u8BC1\u4E66\u8FDE\u63A5... +swtui.main.status.ssl_connect_timeout = SSL\u8BC1\u4E66\u8FDE\u63A5\u8D85\u65F6,\u8BF7\u68C0\u67E5\u670D\u52A1\u5668\u914D\u7F6E +swtui.main.status.ssl_connect_auth_failure = \u672A\u901A\u8FC7\u670D\u52A1\u5668\u8BA4\u8BC1,\u8BF7\u68C0\u67E5\u8BA4\u8BC1\u4FE1\u606F\u662F\u5426\u6B63\u786E +swtui.main.status.ssl_connect = \u6B63\u5728\u83B7\u53D6SSL\u8BC1\u4E66... +swtui.main.status.ssl_connect_done = SSL\u8BC1\u4E66\u83B7\u53D6\u5B8C\u6210 +swtui.main.status.ssl_connect_error = SSL\u8BC1\u4E66\u83B7\u53D6\u9519\u8BEF +swtui.main.status.proxy_initial = \u51C6\u5907\u53D1\u8D77\u4EE3\u7406\u8FDE\u63A5... +swtui.main.status.proxy_connecting = \u6B63\u5728\u8FDE\u63A5\u4EE3\u7406\u670D\u52A1... +swtui.main.status.proxy_connect_timeout = \u4EE3\u7406\u670D\u52A1\u8FDE\u63A5\u8D85\u65F6 +swtui.main.status.proxy_connect = \u6210\u529F\u4E0E\u670D\u52A1\u5668\u5EFA\u7ACB\u4EE3\u7406\u670D\u52A1\u8FDE\u63A5 +swtui.main.status.proxy_connect_auth_failure = \u4EE3\u7406\u670D\u52A1\u8BA4\u8BC1\u5931\u8D25,\u8BF7\u68C0\u67E5\u8BA4\u8BC1\u4FE1\u606F\u662F\u5426\u6B63\u786E +swtui.main.status.proxy_connect_error = \u4E0E\u4EE3\u7406\u670D\u52A1\u8FDE\u63A5\u53D1\u751F\u9519\u8BEF +swtui.main.status.proxy_disconnect = \u6682\u65F6\u4E0E\u670D\u52A1\u5668\u65AD\u5F00\u8FDE\u63A5,\u5C1D\u8BD5\u8FDB\u884C\u91CD\u8FDE... +swtui.main.status.proxy_unused = \u4EE3\u7406\u670D\u52A1\u5668\u8FDE\u63A5\u5DF2\u505C\u6B62 -swtui.serverconfig.title = \u670d\u52a1\u5668\u8bbe\u7f6e -swtui.serverconfig.list.title = \u670d\u52a1\u5668\u5217\u8868 -swtui.serverconfig.list.first = \u70b9\u51fb\u6b64\u5904\u8fdb\u884c\u6dfb\u52a0 +swtui.serverconfig.title = \u670D\u52A1\u5668\u8BBE\u7F6E +swtui.serverconfig.list.title = \u670D\u52A1\u5668\u5217\u8868 +swtui.serverconfig.list.first = \u70B9\u51FB\u6B64\u5904\u8FDB\u884C\u6DFB\u52A0 swtui.serverconfig.form.label.address = \u5730\u5740 -swtui.serverconfig.form.label.port = \u7aef\u53e3 -swtui.serverconfig.form.label.ssl_port = \u8bc1\u4e66\u7aef\u53e3 -swtui.serverconfig.form.label.encrypt_type = \u52a0\u5bc6\u65b9\u5f0f -swtui.serverconfig.form.label.auth_type = \u8ba4\u8bc1\u65b9\u5f0f -swtui.serverconfig.form.label.username = \u7528\u6237\u540d -swtui.serverconfig.form.label.password = \u5bc6\u7801 -swtui.serverconfig.form.encrypt.none = \u65e0\u52a0\u5bc6 +swtui.serverconfig.form.label.port = \u7AEF\u53E3 +swtui.serverconfig.form.label.ssl_port = \u8BC1\u4E66\u7AEF\u53E3 +swtui.serverconfig.form.label.encrypt_type = \u52A0\u5BC6\u65B9\u5F0F +swtui.serverconfig.form.label.auth_type = \u8BA4\u8BC1\u65B9\u5F0F +swtui.serverconfig.form.label.username = \u7528\u6237\u540D +swtui.serverconfig.form.label.password = \u5BC6\u7801 +swtui.serverconfig.form.encrypt.none = \u65E0\u52A0\u5BC6 swtui.serverconfig.form.encrypt.ssl = TLS v1.2 -swtui.serverconfig.form.auth.normal = \u666e\u901a\u8ba4\u8bc1 -swtui.serverconfig.form.auth.user = \u7528\u6237\u8ba4\u8bc1 -swtui.serverconfig.form.save = \u4fdd\u5b58 +swtui.serverconfig.form.auth.normal = \u666E\u901A\u8BA4\u8BC1 +swtui.serverconfig.form.auth.user = \u7528\u6237\u8BA4\u8BC1 +swtui.serverconfig.form.save = \u4FDD\u5B58 swtui.serverconfig.form.delete = \u5220\u9664 -swtui.serverconfig.notice.error.title = \u9519\u8bef -swtui.serverconfig.notice.error.host_error = \u670d\u52a1\u5668\u4e3b\u673a\u540d\u683c\u5f0f\u6709\u8bef:\u9700\u8981\u4e3aIPv4\u5730\u5740\u6216\u662f\u5408\u6cd5\u4e3b\u673a\u540d/\u57df\u540d -swtui.serverconfig.notice.error.port_error = \u7aef\u53e3\u53f7\u6709\u8bef,\u5fc5\u987b\u4e3a1~65535\u4e4b\u95f4\u7684\u6570\u5b57 -swtui.serverconfig.notice.error.ssl_port_error = \u8bc1\u4e66\u7aef\u53e3\u53f7\u6709\u8bef,\u5fc5\u987b\u4e3a1~65535\u4e4b\u95f4\u7684\u6570\u5b57 -swtui.serverconfig.notice.info.title = \u63d0\u793a -swtui.serverconfig.notice.info.server_exists = \u5df2\u7ecf\u5305\u542b\u670d\u52a1\u5668 {0}:{1} \u914d\u7f6e -swtui.serverconfig.notice.info.no_server_select = \u8bf7\u9009\u62e9\u9700\u8981\u5220\u9664\u7684\u670d\u52a1\u5668\u914d\u7f6e -swtui.serverconfig.notice.success.title = \u6210\u529f -swtui.serverconfig.notice.success.server_added = \u6210\u529f\u6dfb\u52a0\u670d\u52a1\u5668\u914d\u7f6e {0}:{1} -swtui.serverconfig.notice.success.server_updated = \u6210\u529f\u4fee\u6539\u670d\u52a1\u5668\u914d\u7f6e {0}:{1} +swtui.serverconfig.notice.error.title = \u9519\u8BEF +swtui.serverconfig.notice.error.host_error = \u670D\u52A1\u5668\u4E3B\u673A\u540D\u683C\u5F0F\u6709\u8BEF:\u9700\u8981\u4E3AIPv4\u5730\u5740\u6216\u662F\u5408\u6CD5\u4E3B\u673A\u540D/\u57DF\u540D +swtui.serverconfig.notice.error.port_error = \u7AEF\u53E3\u53F7\u6709\u8BEF,\u5FC5\u987B\u4E3A1~65535\u4E4B\u95F4\u7684\u6570\u5B57 +swtui.serverconfig.notice.error.ssl_port_error = \u8BC1\u4E66\u7AEF\u53E3\u53F7\u6709\u8BEF,\u5FC5\u987B\u4E3A1~65535\u4E4B\u95F4\u7684\u6570\u5B57 +swtui.serverconfig.notice.info.title = \u63D0\u793A +swtui.serverconfig.notice.info.server_exists = \u5DF2\u7ECF\u5305\u542B\u670D\u52A1\u5668 {0}:{1} \u914D\u7F6E +swtui.serverconfig.notice.info.no_server_select = \u8BF7\u9009\u62E9\u9700\u8981\u5220\u9664\u7684\u670D\u52A1\u5668\u914D\u7F6E +swtui.serverconfig.notice.success.title = \u6210\u529F +swtui.serverconfig.notice.success.server_added = \u6210\u529F\u6DFB\u52A0\u670D\u52A1\u5668\u914D\u7F6E {0}:{1} +swtui.serverconfig.notice.success.server_updated = \u6210\u529F\u4FEE\u6539\u670D\u52A1\u5668\u914D\u7F6E {0}:{1} -swtui.socks5.title = Socks5\u672c\u5730\u4ee3\u7406\u8bbe\u7f6e -swtui.socks5.form.label.validate = 验证 -swtui.socks5.form.label.username = 用户名 -swtui.socks5.form.label.password = 密码 -swtui.socks5.form.label.port = 代理端口 -swtui.socks5.form.button.open = 打开 -swtui.socks5.form.button.close = 关闭 -swtui.socks5.form.button.enter = 确认 -swtui.socks5.form.button.cancel = 取消 -swtui.socks5.notice.port_error = 端口不合法 -swtui.socks5.notice.update_success = 修改完成, 代理端口的修改需要重启才可生效 -swtui.socks5.notice.unchanged = 修改完成 +swtui.socks5.title = Socks5\u672C\u5730\u4EE3\u7406\u8BBE\u7F6E +swtui.socks5.form.label.validate = \u9A8C\u8BC1 +swtui.socks5.form.label.username = \u7528\u6237\u540D +swtui.socks5.form.label.password = \u5BC6\u7801 +swtui.socks5.form.label.port = \u4EE3\u7406\u7AEF\u53E3 +swtui.socks5.form.button.open = \u6253\u5F00 +swtui.socks5.form.button.close = \u5173\u95ED +swtui.socks5.form.button.enter = \u786E\u8BA4 +swtui.socks5.form.button.cancel = \u53D6\u6D88 +swtui.socks5.notice.title = \u63D0\u793A +swtui.socks5.notice.port_error = \u7AEF\u53E3\u4E0D\u5408\u6CD5 +swtui.socks5.notice.update_success = \u4FEE\u6539\u5B8C\u6210, \u4EE3\u7406\u7AEF\u53E3\u7684\u4FEE\u6539\u9700\u8981\u91CD\u542F\u624D\u53EF\u751F\u6548 +swtui.socks5.notice.unchanged = \u4FEE\u6539\u5B8C\u6210 -swtui.http.title = HTTP代理设置 -swtui.http.form.label.switch = 开关 -swtui.http.form.label.port = 代理端口 -swtui.http.form.label.validate = 认证 -swtui.http.form.label.username = 用户名 -swtui.http.form.label.password = 密码 -swtui.http.form.button.switch_open = 开启 -swtui.http.form.button.switch_close = 关闭 -swtui.http.form.button.validate_open = 开启 -swtui.http.form.button.validate_close = 关闭 +swtui.http.title = HTTP\u4EE3\u7406\u8BBE\u7F6E +swtui.http.form.label.switch = \u5F00\u5173 +swtui.http.form.label.port = \u4EE3\u7406\u7AEF\u53E3 +swtui.http.form.label.validate = \u8BA4\u8BC1 +swtui.http.form.label.username = \u7528\u6237\u540D +swtui.http.form.label.password = \u5BC6\u7801 +swtui.http.form.button.switch_open = \u5F00\u542F +swtui.http.form.button.switch_close = \u5173\u95ED +swtui.http.form.button.validate_open = \u5F00\u542F +swtui.http.form.button.validate_close = \u5173\u95ED +swtui.http.form.button.enter = \u786E\u8BA4 +swtui.http.form.button.cancel = \u53D6\u6D88 +swtui.http.notice.error.title = \u9519\u8BEF +swtui.http.notice.error.port_error = \u7AEF\u53E3\u53F7\u6709\u8BEF,\u5FC5\u987B\u4E3A1~65535\u4E4B\u95F4\u7684\u6570\u5B57 +swtui.http.notice.error.auth_error = \u8BA4\u8BC1\u5F00\u542F\u65F6\uFF0C\u7528\u6237\u540D\u548C\u5BC6\u7801\u4E0D\u5F97\u4E3A\u7A7A +swtui.http.notice.update_success = \u4FEE\u6539\u6210\u529F\uFF0C\u90E8\u5206\u8BBE\u7F6E\u9700\u8981\u91CD\u542F\u7A0B\u5E8F\u751F\u6548