| | |
| | | package denglu; |
| | | |
| | | import ui.UIConfig; |
| | | import javax.swing.*; |
| | | import java.awt.*; |
| | | import java.awt.event.*; |
| | |
| | | |
| | | // 中文翻译 |
| | | Map<String, String> zh = new HashMap<>(); |
| | | zh.put("title", "用户注册"); |
| | | zh.put("title", "用户注册"); |
| | | zh.put("window_title", "智能割草系统 - 用户注册"); |
| | | zh.put("username_label", "用户名"); |
| | | zh.put("email_label", "邮箱地址"); |
| | | zh.put("verification_code_label", "验证码"); |
| | |
| | | |
| | | // 英文翻译 |
| | | Map<String, String> en = new HashMap<>(); |
| | | en.put("title", "User Registration"); |
| | | en.put("title", "User Registration"); |
| | | en.put("window_title", "Smart Mowing System - User Registration"); |
| | | en.put("username_label", "Username"); |
| | | en.put("email_label", "Email Address"); |
| | | en.put("verification_code_label", "Verification Code"); |
| | |
| | | |
| | | // 西班牙语翻译 |
| | | Map<String, String> es = new HashMap<>(); |
| | | es.put("title", "Registro de Usuario"); |
| | | es.put("title", "Registro de Usuario"); |
| | | es.put("window_title", "Sistema de Corte Inteligente - Registro de Usuario"); |
| | | es.put("username_label", "Usuario"); |
| | | es.put("email_label", "Correo Electrónico"); |
| | | es.put("verification_code_label", "Código de Verificación"); |
| | |
| | | |
| | | // 法语翻译 |
| | | Map<String, String> fr = new HashMap<>(); |
| | | fr.put("title", "Inscription Utilisateur"); |
| | | fr.put("title", "Inscription Utilisateur"); |
| | | fr.put("window_title", "Système de Tonte Intelligent - Inscription"); |
| | | fr.put("username_label", "Nom d'utilisateur"); |
| | | fr.put("email_label", "Adresse Email"); |
| | | fr.put("verification_code_label", "Code de Vérification"); |
| | |
| | | |
| | | // 德语翻译 |
| | | Map<String, String> de = new HashMap<>(); |
| | | de.put("title", "Benutzerregistrierung"); |
| | | de.put("title", "Benutzerregistrierung"); |
| | | de.put("window_title", "Intelligentes Mähsystem - Registrierung"); |
| | | de.put("username_label", "Benutzername"); |
| | | de.put("email_label", "E-Mail-Adresse"); |
| | | de.put("verification_code_label", "Verifizierungscode"); |
| | |
| | | translations.put("de", de); |
| | | } |
| | | |
| | | private String getTranslationValue(String languageCode, String key, String defaultValue) { |
| | | Map<String, String> translation = translations.get(languageCode); |
| | | if (translation != null) { |
| | | String value = translation.get(key); |
| | | if (value != null && !value.trim().isEmpty()) { |
| | | return value; |
| | | } |
| | | } |
| | | return defaultValue; |
| | | } |
| | | |
| | | private void initializeUI() { |
| | | setTitle("AutoMow - 用户注册"); |
| | | setTitle(getTranslationValue(currentLanguageCode, "window_title", "用户注册")); |
| | | setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); |
| | | setSize(350, 500); |
| | | setSize(UIConfig.DIALOG_WIDTH, UIConfig.DIALOG_HEIGHT); |
| | | setMinimumSize(new Dimension(UIConfig.DIALOG_WIDTH, UIConfig.DIALOG_HEIGHT)); |
| | | setLocationRelativeTo(parentFrame); |
| | | setResizable(false); |
| | | |
| | |
| | | |
| | | if (translation != null) { |
| | | // 更新所有界面文本 |
| | | setTitle("AutoMow - " + translation.get("title")); |
| | | userLabel.setText(translation.get("username_label")); |
| | | emailLabel.setText(translation.get("email_label")); |
| | | verificationCodeLabel.setText(translation.get("verification_code_label")); |
| | | passLabel.setText(translation.get("password_label")); |
| | | confirmPassLabel.setText(translation.get("confirm_password_label")); |
| | | registerButton.setText(translation.get("register_button")); |
| | | cancelButton.setText(translation.get("cancel_button")); |
| | | sendCodeButton.setText(translation.get("send_code_button")); |
| | | setTitle(getTranslationValue(languageCode, "window_title", getTitle())); |
| | | userLabel.setText(getTranslationValue(languageCode, "username_label", userLabel.getText())); |
| | | emailLabel.setText(getTranslationValue(languageCode, "email_label", emailLabel.getText())); |
| | | verificationCodeLabel.setText(getTranslationValue(languageCode, "verification_code_label", verificationCodeLabel.getText())); |
| | | passLabel.setText(getTranslationValue(languageCode, "password_label", passLabel.getText())); |
| | | confirmPassLabel.setText(getTranslationValue(languageCode, "confirm_password_label", confirmPassLabel.getText())); |
| | | registerButton.setText(getTranslationValue(languageCode, "register_button", registerButton.getText())); |
| | | cancelButton.setText(getTranslationValue(languageCode, "cancel_button", cancelButton.getText())); |
| | | sendCodeButton.setText(getTranslationValue(languageCode, "send_code_button", sendCodeButton.getText())); |
| | | } |
| | | } |
| | | |