From 32524195d474b74e48916867b2a6c2f022a40d98 Mon Sep 17 00:00:00 2001
From: 张世豪 <979909237@qq.com>
Date: 星期二, 09 十二月 2025 19:36:32 +0800
Subject: [PATCH] 20251209

---
 src/denglu/Denglu.java |   95 +++++++++++++++++++++++++++--------------------
 1 files changed, 54 insertions(+), 41 deletions(-)

diff --git a/src/denglu/Denglu.java b/src/denglu/Denglu.java
index 93078df..82e306a 100644
--- a/src/denglu/Denglu.java
+++ b/src/denglu/Denglu.java
@@ -1,6 +1,7 @@
 package denglu;
 
 import homein.WenJianSuo;
+import ui.UIConfig;
 import javax.swing.*;
 import java.awt.*;
 import java.awt.event.*;
@@ -35,7 +36,7 @@
 
     private void initializeTranslations() {
         translations = new HashMap<>();
-        
+
         // 涓枃缈昏瘧
         Map<String, String> zh = new HashMap<>();
         zh.put("username_label", "鐢ㄦ埛鍚嶆垨閭");
@@ -45,7 +46,9 @@
         zh.put("login_button", "鐧诲綍");
         zh.put("no_account", "杩樻病鏈夎处鎴凤紵");
         zh.put("sign_up", "绔嬪嵆娉ㄥ唽");
-        zh.put("app_info", "AutoMow 漏 2023 - 鏅鸿兘鍓茶崏瑙e喅鏂规");
+        zh.put("app_title", "鏅鸿兘鍓茶崏绯荤粺");
+        zh.put("window_title", "鏅鸿兘鍓茶崏绯荤粺 - 鐧诲綍");
+        zh.put("app_info", "鏅鸿兘鍓茶崏绯荤粺 漏 2023 - 鏅鸿兘鍓茶崏瑙e喅鏂规");
         zh.put("register_button", "娉ㄥ唽鏂拌处鎴�");
         translations.put("zh", zh);
 
@@ -58,7 +61,9 @@
         en.put("login_button", "Sign In");
         en.put("no_account", "Don't have an account?");
         en.put("sign_up", "Sign Up");
-        en.put("app_info", "AutoMow 漏 2023 - Smart Mowing Solutions");
+        en.put("app_title", "Smart Mowing System");
+        en.put("window_title", "Smart Mowing System - Login");
+        en.put("app_info", "Smart Mowing System 漏 2023 - Intelligent Lawn Care");
         en.put("register_button", "Create New Account");
         translations.put("en", en);
 
@@ -71,7 +76,9 @@
         es.put("login_button", "Iniciar Sesi贸n");
         es.put("no_account", "驴No tienes una cuenta?");
         es.put("sign_up", "Reg铆strate");
-        es.put("app_info", "AutoMow 漏 2023 - Soluciones de Corte Inteligente");
+        es.put("app_title", "Sistema de Corte Inteligente");
+        es.put("window_title", "Sistema de Corte Inteligente - Iniciar Sesi贸n");
+        es.put("app_info", "Sistema de Corte Inteligente 漏 2023 - Soluciones Inteligentes");
         es.put("register_button", "Crear Nueva Cuenta");
         translations.put("es", es);
 
@@ -84,8 +91,10 @@
         fr.put("login_button", "Se connecter");
         fr.put("no_account", "Vous n'avez pas de compte?");
         fr.put("sign_up", "S'inscrire");
-        fr.put("app_info", "AutoMow 漏 2023 - Solutions de Tonte Intelligente");
-        es.put("register_button", "Cr茅er un Nouveau Compte");
+        fr.put("app_title", "Syst猫me de Tonte Intelligent");
+        fr.put("window_title", "Syst猫me de Tonte Intelligent - Connexion");
+        fr.put("app_info", "Syst猫me de Tonte Intelligent 漏 2023 - Solutions de Tonte");
+        fr.put("register_button", "Cr茅er un Nouveau Compte");
         translations.put("fr", fr);
 
         // 寰疯缈昏瘧
@@ -97,18 +106,20 @@
         de.put("login_button", "Anmelden");
         de.put("no_account", "Sie haben noch kein Konto?");
         de.put("sign_up", "Registrieren");
-        de.put("app_info", "AutoMow 漏 2023 - Intelligente M盲h-L枚sungen");
+        de.put("app_title", "Intelligentes M盲hsystem");
+        de.put("window_title", "Intelligentes M盲hsystem - Anmeldung");
+        de.put("app_info", "Intelligentes M盲hsystem 漏 2023 - M盲hl枚sungen");
         de.put("register_button", "Neues Konto Erstellen");
         translations.put("de", de);
     }
 
     private void initializeUI() {
-        setTitle("AutoMow - 鐧诲綍");
+        setTitle(getTranslationValue(currentLanguageCode, "window_title", "绯荤粺鐧诲綍"));
         setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
         
         // 璁剧疆绱у噾甯冨眬灏哄
-        setSize(320, 520);
-        setMinimumSize(new Dimension(300, 500));
+        setSize(UIConfig.DIALOG_WIDTH, UIConfig.DIALOG_HEIGHT);
+        setMinimumSize(new Dimension(UIConfig.DIALOG_WIDTH, UIConfig.DIALOG_HEIGHT));
         setResizable(false);
         
         setupCompactLayout();
@@ -159,11 +170,6 @@
         ));
         
         // 鐧诲綍鏍囬
-        JLabel loginTitle = new JLabel("AutoMow", SwingConstants.CENTER);
-        loginTitle.setFont(new Font("PingFang SC", Font.BOLD, 24));
-        loginTitle.setForeground(THEME_COLOR);
-        loginTitle.setAlignmentX(Component.CENTER_ALIGNMENT);
-        
         // 鐢ㄦ埛鍚嶈緭鍏�
         usernameLabel = new JLabel("鐢ㄦ埛鍚嶆垨閭", SwingConstants.CENTER);
         usernameLabel.setFont(new Font("PingFang SC", Font.BOLD, 13));
@@ -212,7 +218,7 @@
         rememberForgotPanel.add(rememberMe, BorderLayout.WEST);
         rememberForgotPanel.add(forgotPassword, BorderLayout.EAST);
         
-        // 鐧诲綍鎸夐挳 - 姘村钩灞呬腑锛岄暱搴︿笌鏂囨湰妗嗙浉鍚�
+        // 鐧诲綍鎸夐挳 - 姘村钩灞呬腑锛岄暱搴︿笌鏂囨湰妗嗗搴︿繚鎸佺浉杩�
         JPanel buttonPanel = new JPanel(new FlowLayout(FlowLayout.CENTER));
         buttonPanel.setBackground(Color.WHITE);
         buttonPanel.setMaximumSize(new Dimension(Integer.MAX_VALUE, 50));
@@ -221,8 +227,8 @@
         loginButton.setBackground(THEME_COLOR);
         loginButton.setForeground(Color.WHITE);
         loginButton.setFont(new Font("PingFang SC", Font.BOLD, 15));
-        // 璁剧疆鐧诲綍鎸夐挳闀垮害涓庢枃鏈鐩稿悓
-        loginButton.setPreferredSize(new Dimension(260, 42));
+        // 璁剧疆鐧诲綍鎸夐挳闀垮害鎺ヨ繎鏂囨湰妗嗗搴�
+        loginButton.setPreferredSize(new Dimension(300, 48));
         loginButton.setBorderPainted(false);
         loginButton.setFocusPainted(false);
         loginButton.setCursor(new Cursor(Cursor.HAND_CURSOR));
@@ -248,7 +254,7 @@
         registerButton.setBackground(Color.WHITE);
         registerButton.setForeground(THEME_COLOR);
         registerButton.setFont(new Font("PingFang SC", Font.BOLD, 14));
-        registerButton.setPreferredSize(new Dimension(140, 38));
+        registerButton.setPreferredSize(new Dimension(180, 42));
         registerButton.setBorder(BorderFactory.createCompoundBorder(
             BorderFactory.createLineBorder(THEME_COLOR),
             BorderFactory.createEmptyBorder(5, 15, 5, 15)
@@ -282,12 +288,11 @@
         signupPanel.add(signupLink);
         
         // 缁勮琛ㄥ崟
-        formPanel.add(loginTitle);
-        formPanel.add(Box.createRigidArea(new Dimension(0, 25)));
+    formPanel.add(Box.createRigidArea(new Dimension(0, 15)));
         formPanel.add(usernameLabel);
         formPanel.add(Box.createRigidArea(new Dimension(0, 5)));
         formPanel.add(usernameField);
-        formPanel.add(Box.createRigidArea(new Dimension(0, 15)));
+    formPanel.add(Box.createRigidArea(new Dimension(0, 30)));
         formPanel.add(passwordLabel);
         formPanel.add(Box.createRigidArea(new Dimension(0, 5)));
         formPanel.add(passwordField);
@@ -307,7 +312,9 @@
         JPanel appInfoPanel = new JPanel();
         appInfoPanel.setBackground(Color.WHITE);
         appInfoPanel.setBorder(BorderFactory.createEmptyBorder(10, 0, 5, 0));
-        appInfoLabel = new JLabel("AutoMow 漏 2023 - 鏅鸿兘鍓茶崏瑙e喅鏂规");
+        appInfoLabel = new JLabel(
+            getTranslationValue(currentLanguageCode, "app_info", "鏅鸿兘鍓茶崏绯荤粺 漏 2023")
+        );
         appInfoLabel.setFont(new Font("PingFang SC", Font.PLAIN, 10));
         appInfoLabel.setForeground(new Color(150, 150, 150));
         appInfoPanel.add(appInfoLabel);
@@ -356,20 +363,20 @@
         
         if (translation != null) {
             // 鏇存柊鎵�鏈夌晫闈㈡枃鏈�
-            usernameLabel.setText(translation.get("username_label"));
-            passwordLabel.setText(translation.get("password_label"));
-            rememberMe.setText(translation.get("remember_me"));
-            forgotPassword.setText(translation.get("forgot_password"));
-            loginButton.setText(translation.get("login_button"));
-            noAccountLabel.setText(translation.get("no_account"));
-            signupLink.setText(translation.get("sign_up"));
-            appInfoLabel.setText(translation.get("app_info"));
-            
+            usernameLabel.setText(getTranslationValue(langCode, "username_label", usernameLabel.getText()));
+            passwordLabel.setText(getTranslationValue(langCode, "password_label", passwordLabel.getText()));
+            rememberMe.setText(getTranslationValue(langCode, "remember_me", rememberMe.getText()));
+            forgotPassword.setText(getTranslationValue(langCode, "forgot_password", forgotPassword.getText()));
+            loginButton.setText(getTranslationValue(langCode, "login_button", loginButton.getText()));
+            noAccountLabel.setText(getTranslationValue(langCode, "no_account", noAccountLabel.getText()));
+            signupLink.setText(getTranslationValue(langCode, "sign_up", signupLink.getText()));
+            appInfoLabel.setText(getTranslationValue(langCode, "app_info", appInfoLabel.getText()));
+
             // 鏇存柊娉ㄥ唽鎸夐挳鏂囨湰
-            registerButton.setText(translation.get("register_button"));
-            
+            registerButton.setText(getTranslationValue(langCode, "register_button", registerButton.getText()));
+
             // 鏇存柊绐楀彛鏍囬
-            setTitle("AutoMow - " + (langCode.equals("zh") ? "鐧诲綍" : "Login"));
+            setTitle(getTranslationValue(langCode, "window_title", getTitle()));
             
             // 鏇存柊璇█璁剧疆鍒版枃浠�
             updateLanguagePreference(langCode);
@@ -387,6 +394,17 @@
         }
     }
 
+    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 updateLanguagePreference(String languageCode) {
         String currentLanguage = UserChuShiHua.getProperty("language");
         if (!languageCode.equals(currentLanguage)) {
@@ -512,10 +530,5 @@
         RegistrationFrame registerFrame = new RegistrationFrame(this, currentLanguageCode);
         registerFrame.setVisible(true);
     }
-
-    public static void main(String[] args) {
-        SwingUtilities.invokeLater(() -> {
-            new Denglu().setVisible(true);
-        });
-    }
+   
 }
\ No newline at end of file

--
Gitblit v1.10.0