diff --git a/Battify/App.xaml.cs b/Battify/App.xaml.cs index c780c0d..1fe8d92 100644 --- a/Battify/App.xaml.cs +++ b/Battify/App.xaml.cs @@ -14,6 +14,8 @@ public partial class App : System.Windows.Application protected override void OnStartup(StartupEventArgs e) { + Localizer.ApplyConfiguredCulture(); + // 뮤텍스 생성 시도 _mutex = new Mutex(true, MutexName, out bool createdNew); @@ -22,7 +24,7 @@ protected override void OnStartup(StartupEventArgs e) // 이미 실행 중인 인스턴스가 있음 /* System.Windows.MessageBox.Show( - "Battify가 이미 실행 중입니다.\n시스템 트레이를 확인해주세요.", + Localizer.Get("App.AlreadyRunning"), "Battify", MessageBoxButton.OK, MessageBoxImage.Information); diff --git a/Battify/AssemblyInfo.cs b/Battify/AssemblyInfo.cs index b0ec827..db1e1cf 100644 --- a/Battify/AssemblyInfo.cs +++ b/Battify/AssemblyInfo.cs @@ -1,5 +1,4 @@ using System.Windows; - [assembly: ThemeInfo( ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located //(used if a resource is not found in the page, diff --git a/Battify/BatteryInfoWindow.xaml b/Battify/BatteryInfoWindow.xaml index 68afbae..b29515b 100644 --- a/Battify/BatteryInfoWindow.xaml +++ b/Battify/BatteryInfoWindow.xaml @@ -1,7 +1,8 @@ + + + + + @@ -143,7 +252,7 @@ - \ No newline at end of file + diff --git a/Battify/BatteryInfoWindow.xaml.cs b/Battify/BatteryInfoWindow.xaml.cs index 2afcada..0cbdd79 100644 --- a/Battify/BatteryInfoWindow.xaml.cs +++ b/Battify/BatteryInfoWindow.xaml.cs @@ -34,6 +34,31 @@ public BatteryInfoWindow() // 창이 로드된 후 DWM 속성 설정 this.Loaded += BatteryInfoWindow_Loaded; + + LanguageSelector.Items.Add(new System.Windows.Controls.ComboBoxItem + { + Tag = "system", + Content = Localizer.Get("Language.System") + }); + + foreach (var language in Localizer.GetAvailableLanguages()) + { + var culture = System.Globalization.CultureInfo.GetCultureInfo(language); + LanguageSelector.Items.Add(new System.Windows.Controls.ComboBoxItem + { + Tag = language, + Content = culture.NativeName + }); + } + + foreach (var item in LanguageSelector.Items.OfType()) + { + if ((string)item.Tag == Settings.Default.language) + { + LanguageSelector.SelectedItem = item; + break; + } + } } private async void BatteryInfoWindow_Loaded(object sender, RoutedEventArgs e) @@ -47,12 +72,12 @@ private async void BatteryInfoWindow_Loaded(object sender, RoutedEventArgs e) this.Top = workArea.Bottom - this.Height; // 버전 정보 갱신해서 표시 - AppVersionLabel.Content = "배티파이, v" + assmblyVersion; + AppVersionLabel.Content = Localizer.Format("Battery.AppVersion", assmblyVersion); // StatusTextBox를 비활성화하고 로딩 메시지 표시 StatusTextBox.IsEnabled = false; - StatusTextBox.Text = "로드 중..."; + StatusTextBox.Text = Localizer.Get("Common.Loading"); // 시작프로그램 설정 확인 및 디버깅 정보 출력 SetStartupChk.IsChecked = await MsixStartupSetter.IsStartupEnabledAsync(); @@ -99,7 +124,7 @@ private async void UpdateButton_Click(object sender, RoutedEventArgs e) { // 업데이트 버튼도 비동기로 처리 StatusTextBox.IsEnabled = false; - StatusTextBox.Text = "로드 중..."; + StatusTextBox.Text = Localizer.Get("Common.Loading"); await LoadBatteryInfoAsync(); } @@ -113,36 +138,36 @@ private void UpdateText() // voltage string voltage = BatteryInfoGetter.Get("Voltage"); - resultString += "전압: " + voltage + " mV" + Environment.NewLine; + resultString += Localizer.Format("Battery.Voltage", voltage) + Environment.NewLine; // DesignVoltage string designVoltage = BatteryInfoGetter.Get("DesignVoltage"); - resultString += "지정 전압: " + designVoltage + " mV" + Environment.NewLine; + resultString += Localizer.Format("Battery.DesignVoltage", designVoltage) + Environment.NewLine; // ChargeRate string chargeRate = BatteryInfoGetter.Get("ChargeRate"); - resultString += "충전율: " + chargeRate + " mW" + Environment.NewLine; + resultString += Localizer.Format("Battery.ChargeRate", chargeRate) + Environment.NewLine; // DischargeRate string dischargeRate = BatteryInfoGetter.Get("DischargeRate"); - resultString += "방전율: " + dischargeRate + " mW" + Environment.NewLine; + resultString += Localizer.Format("Battery.DischargeRate", dischargeRate) + Environment.NewLine; // DesignCapacity string designCapacity = BatteryInfoGetter.Get("DesignCapacity"); - resultString += "지정 용량: " + designCapacity + " mWh" + Environment.NewLine; + resultString += Localizer.Format("Battery.DesignCapacity", designCapacity) + Environment.NewLine; // MaxCapacity uint maxCapacity = BatteryInfoGetter.MaxCapacity(); - resultString += "완충 용량: " + maxCapacity + " mWh" + Environment.NewLine; + resultString += Localizer.Format("Battery.MaxCapacity", maxCapacity) + Environment.NewLine; // RemainingCapacity string remainingCapacity = BatteryInfoGetter.Get("RemainingCapacity"); uint remainingCapacityUint = BatteryInfoGetter.RemainingCapacity(); - resultString += "남은 용량 (레거시): " + remainingCapacity + "(" + remainingCapacityUint.ToString() + ") mWh" + Environment.NewLine; + resultString += Localizer.Format("Battery.RemainingCapacity", remainingCapacity, remainingCapacityUint) + Environment.NewLine; // Name string name = BatteryInfoGetter.Get("Name"); - resultString += "모델명: " + name + Environment.NewLine; + resultString += Localizer.Format("Battery.ModelName", name) + Environment.NewLine; // EstimatedChargeRemaining string estimatedChargeRemaining = BatteryInfoGetter.Get("EstimatedChargeRemaining"); @@ -151,19 +176,14 @@ private void UpdateText() { int hours = estimatedChargeRemainingInt / 3600; int minutes = estimatedChargeRemainingInt % 3600 / 60; - estimatedChargeRemaining = ""; - - if (hours > 0) - { - estimatedChargeRemaining = hours + "시간 "; - } - - estimatedChargeRemaining += minutes + "분"; + estimatedChargeRemaining = hours > 0 + ? Localizer.Format("Battery.TimeHoursMinutes", hours, minutes) + : Localizer.Format("Battery.TimeMinutes", minutes); } - resultString += "충전 예상 시간: " + estimatedChargeRemaining + Environment.NewLine; + resultString += Localizer.Format("Battery.EstimatedChargeTime", estimatedChargeRemaining) + Environment.NewLine; - resultString += "레거시 예상 시간: " + BatteryInfoGetter.EstimatedTime().ToString() + Environment.NewLine; + resultString += Localizer.Format("Battery.LegacyEstimatedTime", BatteryInfoGetter.EstimatedTime()) + Environment.NewLine; // 계산 @@ -172,25 +192,25 @@ private void UpdateText() { // 충전 퍼센트 계산 double percentage = (double)remainingCapacityInt / maxCapacity * 100; - resultString += "충전 퍼센트: " + percentage.ToString("0.00") + "%" + Environment.NewLine; + resultString += Localizer.Format("Battery.ChargePercentage", percentage) + Environment.NewLine; // 지정 용량이 숫자로 변환 가능한 경우 if (int.TryParse(designCapacity, out int designCapacityInt)) { // 웨어율 계산 double wear = (double)(designCapacityInt - maxCapacity) / designCapacityInt * 100; - resultString += "웨어율: " + wear.ToString("0.00") + "%" + Environment.NewLine; + resultString += Localizer.Format("Battery.WearRate", wear) + Environment.NewLine; } } // PowerOnline string powerOnline = BatteryInfoGetter.Get("PowerOnline"); - resultString += "전원 연결: " + powerOnline; + resultString += Localizer.Format("Battery.PowerOnline", powerOnline); } catch (Exception ex) { - resultString = "배터리 정보 로드 실패: " + ex.Message; + resultString = Localizer.Format("Battery.LoadFailed", ex.Message); } // 이제 프로그램 정보 덧대기 @@ -198,10 +218,10 @@ private void UpdateText() resultString += Environment.NewLine + Environment.NewLine; // 프로그램 정보 - resultString += "Battify v" + assmblyVersion + Environment.NewLine; - resultString += "Made by PBJSoftware (박동준)" + Environment.NewLine; + resultString += Localizer.Format("Battery.AppVersion", assmblyVersion) + Environment.NewLine; + resultString += Localizer.Get("Battery.Author") + Environment.NewLine; resultString += "Source: https://github.com/pdjdev/Battify" + Environment.NewLine; - resultString += "본 프로그램은 MIT License 하에 자유롭게 이용이 가능합니다." + Environment.NewLine; + resultString += Localizer.Get("Battery.License") + Environment.NewLine; // StatusTextBox 출력 StatusTextBox.Text = resultString; @@ -270,7 +290,7 @@ private async Task HandleStartupSettingChange(bool isChecked) { SetStartupCheckbox(!isChecked); var errorMessage = MsixStartupSetter.LastError - ?? "시작 프로그램 설정을 변경하지 못했습니다."; + ?? Localizer.Get("Startup.ChangeFailed"); global::System.Windows.MessageBox.Show(errorMessage, "Battify", MessageBoxButton.OK, MessageBoxImage.Information); return; @@ -284,7 +304,7 @@ private async Task HandleStartupSettingChange(bool isChecked) SetStartupCheckbox(!isChecked); Debug.WriteLine($"SetStartupChk 변경 예외: {ex}"); - global::System.Windows.MessageBox.Show("시작 프로그램 설정 중 오류가 발생했습니다." + Environment.NewLine + ex.Message, + global::System.Windows.MessageBox.Show(Localizer.Format("Startup.ChangeError", ex.Message), "Battify", MessageBoxButton.OK, MessageBoxImage.Error); } } @@ -301,5 +321,18 @@ private void SetStartupCheckbox(bool isChecked) isUpdatingStartupSetting = false; } } + + private void LanguageSelector_SelectionChanged(object sender, System.Windows.Controls.SelectionChangedEventArgs e) + { + if (LanguageSelector.SelectedValue is not string language || language == Settings.Default.language) + return; + + Settings.Default.language = language; + Settings.Default.Save(); + Localizer.ApplyCulture(language); + AppVersionLabel.Content = Localizer.Format("Battery.AppVersion", assmblyVersion); + UpdateText(); + ((MainWindow)System.Windows.Application.Current.MainWindow).RefreshLocalizedTexts(); + } } } diff --git a/Battify/Battify.csproj b/Battify/Battify.csproj index 443901a..0969244 100644 --- a/Battify/Battify.csproj +++ b/Battify/Battify.csproj @@ -86,6 +86,12 @@ + + + false + Battify.Localization.%(Filename).resources + ResXFileCodeGenerator AppIcon.Designer.cs diff --git a/Battify/Localization/README.md b/Battify/Localization/README.md new file mode 100644 index 0000000..8e909e1 --- /dev/null +++ b/Battify/Localization/README.md @@ -0,0 +1,23 @@ +# Localization + +All translation resources are embedded in `Battify.exe`. + +To add a language, copy `Strings.en.resx` to `Strings..resx` (for example, `Strings.fr.resx`) and translate every value. + +The language is automatically included in the language selector and is used when it matches the Windows display language. + +Use `Strings.ko.resx` for Korean; every supported language follows the same filename convention. +If Windows uses an unsupported language, Battify falls back to English. + +--- + +# 다국어 지원 + +모든 번역 리소스는 `Battify.exe`에 내장되어 있습니다. + +새로운 언어를 추가하기 위해서는, 기존에 존재하는 언어 파일을 `Strings..resx`로 복사하고 (예: `Strings.fr.resx`) 모든 값을 번역하시면 됩니다. + +추가한 언어 파일은 자동으로 언어 선택기에 포함되며, Windows 표시 언어와 일치할 경우 사용됩니다. + +한국어는 `Strings.ko.resx`를 사용하며, 지원되는 모든 언어는 동일한 파일명 규칙을 따릅니다. +지원하지 않는 언어의 Windows 환경일 경우, Battify는 영어로 대체됩니다. \ No newline at end of file diff --git a/Battify/Localization/Strings.de.resx b/Battify/Localization/Strings.de.resx new file mode 100644 index 0000000..fef7193 --- /dev/null +++ b/Battify/Localization/Strings.de.resx @@ -0,0 +1,335 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + Battify wird bereits ausgeführt. +Überprüfen Sie den Infobereich der Taskleiste. + + + Battify-Informationen + + + Battify-Installation abgeschlossen + + + Bättifai, v{0} + + + Akku- und App-Informationen + + + Aktualisieren + + + Schließen + + + Wird geladen... + + + Beim Start ausführen + + + Nach Updates suchen + + + (Store) + + + Entwicklerseite (pbj.kr) + + + Spannung: {0} mV + + + Nennspannung: {0} mV + + + Laderate: {0} mW + + + Entladerate: {0} mW + + + Nennkapazität: {0} mWh + + + Volle Ladekapazität: {0} mWh + + + Verbleibende Kapazität (Legacy): {0} ({1}) mWh + + + Modell: {0} + + + {0} Std. {1} Min. + + + {0} Min. + + + Geschätzte Ladezeit: {0} + + + Geschätzte Legacy-Zeit: {0} + + + Ladezustand: {0:0.00}% + + + Verschleißgrad: {0:0.00}% + + + Netzteil angeschlossen: {0} + + + Akkuinformationen konnten nicht geladen werden: {0} + + + Erstellt von PBJSoftware (Dongjun Park) + + + Dieses Programm ist unter der MIT-Lizenz frei verfügbar. + + + Die Starteinstellung konnte nicht geändert werden. + + + Beim Ändern der Starteinstellung ist ein Fehler aufgetreten. +{0} + + + Der MSIX-Startstatus konnte nicht überprüft werden: {0} + + + Die Start-Registrierungseinstellung konnte nicht geändert werden: {0} + + + Der Start wurde vom Benutzer im Task-Manager deaktiviert. Aktivieren Sie Battify auf der Registerkarte „Autostart-Apps“ erneut. + + + Der Start ist durch die Organisation oder eine Windows-Richtlinie deaktiviert. + + + Unbekannter Startstatus: {0} + + + Die MSIX-Starteinstellung konnte nicht geändert werden: {0} + + + Der Start-Registrierungsschlüssel konnte nicht geöffnet werden. + + + Einrichtung abgeschlossen + + + Zu den Autostart-Apps hinzugefügt. + + + Einrichtung fehlgeschlagen + + + Konnte nicht zu den Autostart-Apps hinzugefügt werden. + + + Start nicht konfiguriert + + + Klicken Sie hier, um Battify beim Start auszuführen. + + + Battify beenden + + + Darstellung + + + Benachrichtigungen + + + Info / Einstellungen + + + Ton aktivieren + + + Ton deaktivieren + + + Popup aktivieren + + + Popup deaktivieren + + + Popup-Farbe: Automatisch + + + Popup-Farbe: Hell + + + Popup-Farbe: Dunkel + + + Symbolfarbe: Automatisch + + + Symbolfarbe: Hell + + + Symbolfarbe: Dunkel + + + Kein Akku + + + {0} %, wird geladen + + + {0} % verbleibend + + + Battify wurde installiert! + + + Wenn das Akkuprozent-Symbol nicht sichtbar ist, + + + ziehen Sie das Prozent-Symbol ( + + + ) heraus, um es anzuheften. + + + Verstanden + + + Sprache + + + Systemstandard + + + Die Sprachänderung wird nach dem Neustart von Battify übernommen. + + + Sprache geändert + + diff --git a/Battify/Localization/Strings.en.resx b/Battify/Localization/Strings.en.resx new file mode 100644 index 0000000..0c8464e --- /dev/null +++ b/Battify/Localization/Strings.en.resx @@ -0,0 +1,335 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + Battify is already running. +Check the system tray. + + + Battify information + + + Battify installation complete + + + Battify, v{0} + + + Battery & app information + + + Refresh + + + Close + + + Loading... + + + Run at startup + + + Check for updates + + + (Store) + + + Developer site (pbj.kr) + + + Voltage: {0} mV + + + Design voltage: {0} mV + + + Charge rate: {0} mW + + + Discharge rate: {0} mW + + + Design capacity: {0} mWh + + + Full charge capacity: {0} mWh + + + Remaining capacity (legacy): {0} ({1}) mWh + + + Model: {0} + + + {0}h {1}m + + + {0}m + + + Estimated charge time: {0} + + + Legacy estimated time: {0} + + + Charge percentage: {0:0.00}% + + + Wear level: {0:0.00}% + + + Power connected: {0} + + + Failed to load battery information: {0} + + + Made by PBJSoftware (Dongjun Park) + + + This program is freely available under the MIT License. + + + Could not change the startup setting. + + + An error occurred while changing the startup setting. +{0} + + + Could not check MSIX startup status: {0} + + + Could not change the startup registry setting: {0} + + + Startup was disabled by the user in Task Manager. Re-enable Battify in the Startup apps tab. + + + Startup is disabled by organization or Windows policy. + + + Unknown startup state: {0} + + + Could not change MSIX startup setting: {0} + + + Could not open the startup registry key. + + + Setup complete + + + Added to startup apps. + + + Setup failed + + + Could not add to startup apps. + + + Startup not configured + + + Click here to run Battify at startup. + + + Exit Battify + + + Appearance + + + Notifications + + + Info / Settings + + + Enable sound + + + Disable sound + + + Enable popup + + + Disable popup + + + Popup color: Auto + + + Popup color: Light + + + Popup color: Dark + + + Icon color: Auto + + + Icon color: Light + + + Icon color: Dark + + + No battery + + + {0}%, charging + + + {0}% remaining + + + Battify has been installed! + + + If the battery percentage icon is not visible, + + + drag the percentage ( + + + ) icon out to pin it. + + + Got it + + + Language + + + System default + + + The language change will apply after restarting Battify. + + + Language changed + + \ No newline at end of file diff --git a/Battify/Localization/Strings.es.resx b/Battify/Localization/Strings.es.resx new file mode 100644 index 0000000..b6fcc87 --- /dev/null +++ b/Battify/Localization/Strings.es.resx @@ -0,0 +1,335 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + Battify ya se está ejecutando. +Comprueba la bandeja del sistema. + + + Información de Battify + + + Instalación de Battify completada + + + Batifái, v{0} + + + Información de la batería y la aplicación + + + Actualizar + + + Cerrar + + + Cargando... + + + Ejecutar al iniciar + + + Buscar actualizaciones + + + (Tienda) + + + Sitio del desarrollador (pbj.kr) + + + Voltaje: {0} mV + + + Voltaje de diseño: {0} mV + + + Tasa de carga: {0} mW + + + Tasa de descarga: {0} mW + + + Capacidad de diseño: {0} mWh + + + Capacidad de carga completa: {0} mWh + + + Capacidad restante (heredada): {0} ({1}) mWh + + + Modelo: {0} + + + {0} h {1} min + + + {0} min + + + Tiempo de carga estimado: {0} + + + Tiempo estimado heredado: {0} + + + Porcentaje de carga: {0:0.00}% + + + Nivel de desgaste: {0:0.00}% + + + Alimentación conectada: {0} + + + No se pudo cargar la información de la batería: {0} + + + Creado por PBJSoftware (Dongjun Park) + + + Este programa está disponible gratuitamente bajo la licencia MIT. + + + No se pudo cambiar la configuración de inicio. + + + Se produjo un error al cambiar la configuración de inicio. +{0} + + + No se pudo comprobar el estado de inicio de MSIX: {0} + + + No se pudo cambiar la configuración de inicio del Registro: {0} + + + El usuario deshabilitó el inicio en el Administrador de tareas. Vuelve a habilitar Battify en la pestaña Aplicaciones de inicio. + + + El inicio está deshabilitado por la organización o la política de Windows. + + + Estado de inicio desconocido: {0} + + + No se pudo cambiar la configuración de inicio de MSIX: {0} + + + No se pudo abrir la clave del Registro de inicio. + + + Configuración completada + + + Agregado a las aplicaciones de inicio. + + + Error de configuración + + + No se pudo agregar a las aplicaciones de inicio. + + + Inicio no configurado + + + Haz clic aquí para ejecutar Battify al iniciar. + + + Salir de Battify + + + Apariencia + + + Notificaciones + + + Información / Configuración + + + Activar sonido + + + Desactivar sonido + + + Activar ventana emergente + + + Desactivar ventana emergente + + + Color de ventana emergente: Automático + + + Color de ventana emergente: Claro + + + Color de ventana emergente: Oscuro + + + Color del icono: Automático + + + Color del icono: Claro + + + Color del icono: Oscuro + + + Sin batería + + + {0} %, cargando + + + {0} % restante + + + ¡Battify se ha instalado! + + + Si el icono de porcentaje de batería no está visible, + + + arrastra el icono de porcentaje ( + + + ) hacia fuera para fijarlo. + + + Entendido + + + Idioma + + + Predeterminado del sistema + + + El cambio de idioma se aplicará al reiniciar Battify. + + + Idioma cambiado + + diff --git a/Battify/Localization/Strings.fr.resx b/Battify/Localization/Strings.fr.resx new file mode 100644 index 0000000..5501632 --- /dev/null +++ b/Battify/Localization/Strings.fr.resx @@ -0,0 +1,335 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + Battify est déjà en cours d’exécution. +Vérifiez la zone de notification. + + + Informations sur Battify + + + Installation de Battify terminée + + + Battifaï, v{0} + + + Informations sur la batterie et l’application + + + Actualiser + + + Fermer + + + Chargement... + + + Exécuter au démarrage + + + Rechercher des mises à jour + + + (Store) + + + Site du développeur (pbj.kr) + + + Tension : {0} mV + + + Tension nominale : {0} mV + + + Vitesse de charge : {0} mW + + + Vitesse de décharge : {0} mW + + + Capacité nominale : {0} mWh + + + Capacité à pleine charge : {0} mWh + + + Capacité restante (historique) : {0} ({1}) mWh + + + Modèle : {0} + + + {0} h {1} min + + + {0} min + + + Temps de charge estimé : {0} + + + Temps estimé historique : {0} + + + Pourcentage de charge : {0:0.00}% + + + Niveau d’usure : {0:0.00}% + + + Alimentation connectée : {0} + + + Échec du chargement des informations sur la batterie : {0} + + + Créé par PBJSoftware (Dongjun Park) + + + Ce programme est disponible gratuitement sous licence MIT. + + + Impossible de modifier le paramètre de démarrage. + + + Une erreur s’est produite lors de la modification du paramètre de démarrage. +{0} + + + Impossible de vérifier l’état de démarrage MSIX : {0} + + + Impossible de modifier le paramètre de démarrage dans le Registre : {0} + + + Le démarrage a été désactivé par l’utilisateur dans le Gestionnaire des tâches. Réactivez Battify dans l’onglet Applications de démarrage. + + + Le démarrage est désactivé par l’organisation ou une stratégie Windows. + + + État de démarrage inconnu : {0} + + + Impossible de modifier le paramètre de démarrage MSIX : {0} + + + Impossible d’ouvrir la clé de Registre de démarrage. + + + Configuration terminée + + + Ajouté aux applications de démarrage. + + + Échec de la configuration + + + Impossible d’ajouter aux applications de démarrage. + + + Démarrage non configuré + + + Cliquez ici pour exécuter Battify au démarrage. + + + Quitter Battify + + + Apparence + + + Notifications + + + Informations / Paramètres + + + Activer le son + + + Désactiver le son + + + Activer la fenêtre contextuelle + + + Désactiver la fenêtre contextuelle + + + Couleur de la fenêtre : Automatique + + + Couleur de la fenêtre : Claire + + + Couleur de la fenêtre : Sombre + + + Couleur de l’icône : Automatique + + + Couleur de l’icône : Claire + + + Couleur de l’icône : Sombre + + + Aucune batterie + + + {0} %, en charge + + + {0} % restants + + + Battify a été installé ! + + + Si l’icône de pourcentage de batterie n’est pas visible, + + + faites glisser l’icône de pourcentage ( + + + ) vers l’extérieur pour l’épingler. + + + Compris + + + Langue + + + Par défaut du système + + + Le changement de langue sera appliqué après le redémarrage de Battify. + + + Langue modifiée + + diff --git a/Battify/Localization/Strings.ja.resx b/Battify/Localization/Strings.ja.resx new file mode 100644 index 0000000..34390ff --- /dev/null +++ b/Battify/Localization/Strings.ja.resx @@ -0,0 +1,333 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + Battify はすでに起動しています。\nシステム トレイを確認してください。 + + + Battify 情報 + + + Battify のインストールが完了しました + + + バッティファイ、v{0} + + + バッテリーとアプリの情報 + + + 更新 + + + 閉じる + + + 読み込み中... + + + スタートアップ時に実行する + + + 更新プログラムを確認 + + + (ストア) + + + 開発者サイト(pbj.kr) + + + 電圧: {0} mV + + + 設計電圧: {0} mV + + + 充電率: {0} mW + + + 放電率: {0} mW + + + 設計容量: {0} mWh + + + 満充電容量: {0} mWh + + + 残り容量(旧方式): {0} ({1}) mWh + + + モデル: {0} + + + {0}時間 {1}分 + + + {0}分 + + + 推定充電時間: {0} + + + 推定時間(旧方式): {0} + + + 充電率: {0:0.00}% + + + 劣化度: {0:0.00}% + + + 電源接続: {0} + + + バッテリー情報の読み込みに失敗しました: {0} + + + PBJSoftware(Dongjun Park)製作 + + + このプログラムは MIT ライセンスのもとで無償提供されています。 + + + スタートアップ設定を変更できませんでした。 + + + スタートアップ設定の変更中にエラーが発生しました。\n{0} + + + MSIX のスタートアップ状態を確認できませんでした: {0} + + + スタートアップのレジストリ設定を変更できませんでした: {0} + + + タスク マネージャーでスタートアップが無効にされています。[スタートアップ アプリ]タブで Battify を再度有効にしてください。 + + + 組織または Windows ポリシーによりスタートアップが無効になっています。 + + + 不明なスタートアップ状態: {0} + + + MSIX のスタートアップ設定を変更できませんでした: {0} + + + スタートアップのレジストリ キーを開けませんでした。 + + + 設定完了 + + + スタートアップ アプリに追加しました。 + + + 設定に失敗しました + + + スタートアップ アプリに追加できませんでした。 + + + スタートアップ未設定 + + + ここをクリックして、Battify をスタートアップ時に実行します。 + + + Battify を終了 + + + 外観 + + + 通知 + + + 情報 / 設定 + + + サウンドを有効にする + + + サウンドを無効にする + + + ポップアップを有効にする + + + ポップアップを無効にする + + + ポップアップの色: 自動 + + + ポップアップの色: ライト + + + ポップアップの色: ダーク + + + アイコンの色: 自動 + + + アイコンの色: ライト + + + アイコンの色: ダーク + + + バッテリーなし + + + {0}%、充電中 + + + 残り {0}% + + + Battify がインストールされました! + + + バッテリー残量アイコンが表示されない場合は、 + + + 残量表示( + + + )アイコンをドラッグしてピン留めしてください。 + + + 了解 + + + 言語 + + + システムの既定 + + + 言語の変更は Battify を再起動すると適用されます。 + + + 言語を変更しました + + diff --git a/Battify/Localization/Strings.ko.resx b/Battify/Localization/Strings.ko.resx new file mode 100644 index 0000000..e233e87 --- /dev/null +++ b/Battify/Localization/Strings.ko.resx @@ -0,0 +1,335 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + Battify가 이미 실행 중입니다. +시스템 트레이를 확인해주세요. + + + Battify 정보 + + + Battify 설치 완료 + + + 배티파이, v{0} + + + 배터리 & 앱 정보 + + + 새로 고침 + + + 닫기 + + + 로드 중... + + + 시작프로그램 설정 + + + 최신 버전 확인 + + + (스토어) + + + 제작자 사이트 (pbj.kr) + + + 전압: {0} mV + + + 지정 전압: {0} mV + + + 충전율: {0} mW + + + 방전율: {0} mW + + + 지정 용량: {0} mWh + + + 완충 용량: {0} mWh + + + 남은 용량 (레거시): {0} ({1}) mWh + + + 모델명: {0} + + + {0}시간 {1}분 + + + {0}분 + + + 충전 예상 시간: {0} + + + 레거시 예상 시간: {0} + + + 충전 퍼센트: {0:0.00}% + + + 웨어율: {0:0.00}% + + + 전원 연결: {0} + + + 배터리 정보 로드 실패: {0} + + + Made by PBJSoftware (박동준) + + + 본 프로그램은 MIT License 하에 자유롭게 이용이 가능합니다. + + + 시작 프로그램 설정을 변경하지 못했습니다. + + + 시작 프로그램 설정 중 오류가 발생했습니다. +{0} + + + MSIX 시작 프로그램 상태를 확인하지 못했습니다: {0} + + + 시작 프로그램 레지스트리를 변경하지 못했습니다: {0} + + + 작업 관리자에서 사용자가 시작 프로그램을 해제했습니다. 작업 관리자의 시작 앱 탭에서 Battify를 다시 활성화해주세요. + + + 조직 또는 Windows 정책에 의해 시작 프로그램이 비활성화되어 있습니다. + + + 알 수 없는 시작 프로그램 상태입니다: {0} + + + MSIX 시작 프로그램을 변경하지 못했습니다: {0} + + + 시작 프로그램 레지스트리 키를 열 수 없습니다. + + + 설정 완료 + + + 시작 프로그램으로 설정되었습니다. + + + 설정 실패 + + + 시작 프로그램 설정에 실패했습니다. + + + 시작 프로그램 설정 안됨 + + + 여기를 눌러 시작프로그램으로 설정하세요. + + + Battify 종료 + + + 모양 + + + 알림 + + + 정보 / 설정 + + + 알림음 켜기 + + + 알림음 끄기 + + + 팝업 켜기 + + + 팝업 끄기 + + + 팝업 색: 자동 + + + 팝업 색: 라이트 + + + 팝업 색: 다크 + + + 아이콘 색: 자동 + + + 아이콘 색: 라이트 + + + 아이콘 색: 다크 + + + 배터리 없음 + + + {0}%, 충전중 + + + {0}% 남음 + + + Battify가 설치되었습니다! + + + 배터리 퍼센트 아이콘이 보이지 않는다면, + + + 퍼센트 숫자( + + + ) 아이콘을 밖으로 드래그하여 고정해 주세요. + + + 확인했어요 + + + 언어 + + + 시스템 기본값 + + + 언어 변경은 Battify를 다시 시작한 후 적용됩니다. + + + 언어 변경 + + \ No newline at end of file diff --git a/Battify/Localization/Strings.zh-Hans.resx b/Battify/Localization/Strings.zh-Hans.resx new file mode 100644 index 0000000..673902e --- /dev/null +++ b/Battify/Localization/Strings.zh-Hans.resx @@ -0,0 +1,335 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + Battify 已在运行。 +请查看系统托盘。 + + + Battify 信息 + + + Battify 安装完成 + + + 巴蒂法伊,v{0} + + + 电池和应用信息 + + + 刷新 + + + 关闭 + + + 正在加载... + + + 开机启动 + + + 检查更新 + + + (商店) + + + 开发者网站 (pbj.kr) + + + 电压:{0} mV + + + 设计电压:{0} mV + + + 充电速率:{0} mW + + + 放电速率:{0} mW + + + 设计容量:{0} mWh + + + 满充容量:{0} mWh + + + 剩余容量(旧版):{0} ({1}) mWh + + + 型号:{0} + + + {0}小时 {1}分钟 + + + {0}分钟 + + + 预计充电时间:{0} + + + 旧版预计时间:{0} + + + 充电百分比:{0:0.00}% + + + 损耗程度:{0:0.00}% + + + 已连接电源:{0} + + + 加载电池信息失败:{0} + + + 由 PBJSoftware(Dongjun Park)制作 + + + 本程序根据 MIT 许可证免费提供。 + + + 无法更改开机启动设置。 + + + 更改开机启动设置时出错。 +{0} + + + 无法检查 MSIX 开机启动状态:{0} + + + 无法更改开机启动注册表设置:{0} + + + 用户已在任务管理器中禁用开机启动。请在“启动应用”选项卡中重新启用 Battify。 + + + 开机启动已被组织或 Windows 策略禁用。 + + + 未知的开机启动状态:{0} + + + 无法更改 MSIX 开机启动设置:{0} + + + 无法打开开机启动注册表项。 + + + 设置完成 + + + 已添加到启动应用。 + + + 设置失败 + + + 无法添加到启动应用。 + + + 未配置开机启动 + + + 单击此处以开机启动 Battify。 + + + 退出 Battify + + + 外观 + + + 通知 + + + 信息 / 设置 + + + 启用声音 + + + 禁用声音 + + + 启用弹窗 + + + 禁用弹窗 + + + 弹窗颜色:自动 + + + 弹窗颜色:浅色 + + + 弹窗颜色:深色 + + + 图标颜色:自动 + + + 图标颜色:浅色 + + + 图标颜色:深色 + + + 未检测到电池 + + + {0}%,正在充电 + + + 剩余 {0}% + + + Battify 已安装! + + + 如果看不到电池百分比图标, + + + 请将百分比( + + + )图标拖出以固定。 + + + 知道了 + + + 语言 + + + 系统默认 + + + 重启 Battify 后将应用语言更改。 + + + 语言已更改 + + diff --git a/Battify/Localizer.cs b/Battify/Localizer.cs new file mode 100644 index 0000000..a687515 --- /dev/null +++ b/Battify/Localizer.cs @@ -0,0 +1,125 @@ +using System.Collections.Generic; +using System.ComponentModel; +using System.Globalization; +using System.Linq; +using System.Reflection; +using System.Resources; +using System.Threading; +using System.Windows.Data; +using System.Windows.Markup; + +namespace Battify +{ + internal static class Localizer + { + private const string ResourceBaseName = "Battify.Localization.Strings"; + private static readonly Assembly Assembly = typeof(Localizer).Assembly; + private static readonly ResourceManager EnglishResourceManager = new ResourceManager($"{ResourceBaseName}.en", Assembly); + private static readonly HashSet EmbeddedLanguages = Assembly.GetManifestResourceNames() + .Where(name => name.StartsWith($"{ResourceBaseName}.", StringComparison.Ordinal) && name.EndsWith(".resources", StringComparison.Ordinal)) + .Select(name => name.Substring(ResourceBaseName.Length + 1, name.Length - ResourceBaseName.Length - ".resources".Length - 1)) + .ToHashSet(StringComparer.OrdinalIgnoreCase); + private static readonly Dictionary TranslationResourceManagers = new(StringComparer.OrdinalIgnoreCase); + + public static event EventHandler? CultureChanged; + + public static string Get(string key) + { + var language = ResolveLanguage(CultureInfo.CurrentUICulture); + var resourceManager = GetTranslationResourceManager(language); + + // Translations are embedded in the main assembly, so they are read + // as invariant resource sets rather than as satellite assemblies. + return resourceManager.GetString(key, CultureInfo.InvariantCulture) ?? key; + } + + public static string Format(string key, params object[] arguments) => + string.Format(CultureInfo.CurrentCulture, Get(key), arguments); + + public static IEnumerable GetAvailableLanguages() => + EmbeddedLanguages.OrderBy(language => language); + + public static void ApplyConfiguredCulture() + { + ApplyCulture(Settings.Default.language); + } + + public static void ApplyCulture(string language) + { + if (language == "system") + { + var systemLanguage = ResolveLanguage(CultureInfo.InstalledUICulture); + language = EmbeddedLanguages.Contains(systemLanguage) + ? systemLanguage + : "en"; + } + + if (EmbeddedLanguages.Contains(language)) + { + var culture = CultureInfo.GetCultureInfo(language); + CultureInfo.DefaultThreadCurrentCulture = culture; + CultureInfo.DefaultThreadCurrentUICulture = culture; + Thread.CurrentThread.CurrentCulture = culture; + Thread.CurrentThread.CurrentUICulture = culture; + CultureChanged?.Invoke(null, EventArgs.Empty); + } + } + + private static ResourceManager GetTranslationResourceManager(string language) + { + if (language == "en" || !EmbeddedLanguages.Contains(language)) + return EnglishResourceManager; + + if (!TranslationResourceManagers.TryGetValue(language, out var resourceManager)) + { + resourceManager = new ResourceManager($"{ResourceBaseName}.{language}", Assembly); + TranslationResourceManagers.Add(language, resourceManager); + } + + return resourceManager; + } + + private static string ResolveLanguage(CultureInfo culture) + { + // Chinese needs a script-specific resource: "zh" alone does not + // distinguish Simplified Chinese from Traditional Chinese. + if (culture.Name.StartsWith("zh-Hans", StringComparison.OrdinalIgnoreCase) + || culture.Name.Equals("zh-CN", StringComparison.OrdinalIgnoreCase) + || culture.Name.Equals("zh-SG", StringComparison.OrdinalIgnoreCase)) + { + return "zh-Hans"; + } + + return culture.TwoLetterISOLanguageName; + } + } + + [MarkupExtensionReturnType(typeof(string))] + public sealed class LocExtension : MarkupExtension + { + public LocExtension(string key) => Key = key; + public string Key { get; } + + public override object ProvideValue(IServiceProvider serviceProvider) => + new System.Windows.Data.Binding($"[{Key}]") + { + Source = LocalizationBindingSource.Instance, + Mode = BindingMode.OneWay + }.ProvideValue(serviceProvider); + } + + public sealed class LocalizationBindingSource : INotifyPropertyChanged + { + public static LocalizationBindingSource Instance { get; } = new(); + + private LocalizationBindingSource() + { + Localizer.CultureChanged += (_, _) => + PropertyChanged?.Invoke(this, new PropertyChangedEventArgs("Item[]")); + } + + public string this[string key] => Localizer.Get(key); + + public event PropertyChangedEventHandler? PropertyChanged; + } +} diff --git a/Battify/MainWindow.xaml.cs b/Battify/MainWindow.xaml.cs index 8c34617..cbc2406 100644 --- a/Battify/MainWindow.xaml.cs +++ b/Battify/MainWindow.xaml.cs @@ -172,20 +172,13 @@ private void InitBattTimer() // 트레이 아이콘 툴팁 텍스트 설정 if (percentage < 0 || percentage > 100) { - trayControl.trayIcon.Text = "배터리 없음"; + trayControl.trayIcon.Text = Localizer.Get("Tray.NoBattery"); } else { - trayControl.trayIcon.Text = percentage.ToString() + "%"; - - if (plugged) - { - trayControl.trayIcon.Text += ", 충전중"; - } - else - { - trayControl.trayIcon.Text += " 남음"; - } + trayControl.trayIcon.Text = plugged + ? Localizer.Format("Tray.Charging", percentage) + : Localizer.Format("Tray.Remaining", percentage); } }; @@ -193,6 +186,16 @@ private void InitBattTimer() timer.Start(); } + public void RefreshLocalizedTexts() + { + trayControl.RefreshLocalizedTexts(); + trayControl.trayIcon.Text = percentage < 0 || percentage > 100 + ? Localizer.Get("Tray.NoBattery") + : plugged + ? Localizer.Format("Tray.Charging", percentage) + : Localizer.Format("Tray.Remaining", percentage); + } + // 팝업 표시 public void ShowPopup() { @@ -463,4 +466,4 @@ public void UpdateIcon(int percentage) } -} \ No newline at end of file +} diff --git a/Battify/MsixStartupSetter.cs b/Battify/MsixStartupSetter.cs index fe090e6..ddf2df6 100644 --- a/Battify/MsixStartupSetter.cs +++ b/Battify/MsixStartupSetter.cs @@ -39,7 +39,7 @@ public static async Task IsStartupEnabledAsync() } catch (Exception ex) { - LastError = $"MSIX 시작 프로그램 상태를 확인하지 못했습니다: {ex.Message}"; + LastError = Localizer.Format("Startup.StatusCheckFailed", ex.Message); return false; } } @@ -57,7 +57,7 @@ public static async Task SetStartupAsync(bool enable) } catch (Exception ex) { - LastError = $"시작 프로그램 레지스트리를 변경하지 못했습니다: {ex.Message}"; + LastError = Localizer.Format("Startup.RegistryChangeFailed", ex.Message); return false; } } @@ -81,19 +81,19 @@ public static async Task SetStartupAsync(bool enable) case StartupTaskState.Disabled: return await startupTask.RequestEnableAsync() == StartupTaskState.Enabled; case StartupTaskState.DisabledByUser: - LastError = "작업 관리자에서 사용자가 시작 프로그램을 해제했습니다. 작업 관리자의 시작 앱 탭에서 Battify를 다시 활성화해주세요."; + LastError = Localizer.Get("Startup.DisabledByUser"); return false; case StartupTaskState.DisabledByPolicy: - LastError = "조직 또는 Windows 정책에 의해 시작 프로그램이 비활성화되어 있습니다."; + LastError = Localizer.Get("Startup.DisabledByPolicy"); return false; default: - LastError = $"알 수 없는 시작 프로그램 상태입니다: {startupTask.State}"; + LastError = Localizer.Format("Startup.UnknownState", startupTask.State); return false; } } catch (Exception ex) { - LastError = $"MSIX 시작 프로그램을 변경하지 못했습니다: {ex.Message}"; + LastError = Localizer.Format("Startup.MsixChangeFailed", ex.Message); return false; } } diff --git a/Battify/Settings.Designer.cs b/Battify/Settings.Designer.cs index c1dfd08..f3219b1 100644 --- a/Battify/Settings.Designer.cs +++ b/Battify/Settings.Designer.cs @@ -14,7 +14,7 @@ namespace Battify { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "17.14.0.0")] internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase { - + private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); public static Settings Default { @@ -22,7 +22,7 @@ public static Settings Default { return defaultInstance; } } - + [global::System.Configuration.UserScopedSettingAttribute()] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Configuration.DefaultSettingValueAttribute("False")] @@ -34,7 +34,6 @@ public bool mute { this["mute"] = value; } } - [global::System.Configuration.UserScopedSettingAttribute()] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Configuration.DefaultSettingValueAttribute("False")] @@ -82,5 +81,16 @@ public string traytheme { this["traytheme"] = value; } } + [global::System.Configuration.UserScopedSettingAttribute()] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Configuration.DefaultSettingValueAttribute("system")] + public string language { + get { + return ((string)(this["language"])); + } + set { + this["language"] = value; + } + } } } diff --git a/Battify/Settings.settings b/Battify/Settings.settings index f548625..b15e4af 100644 --- a/Battify/Settings.settings +++ b/Battify/Settings.settings @@ -17,5 +17,8 @@ auto + + system + - \ No newline at end of file + diff --git a/Battify/StartupSetter.cs b/Battify/StartupSetter.cs index 76af8e4..6a8f710 100644 --- a/Battify/StartupSetter.cs +++ b/Battify/StartupSetter.cs @@ -11,7 +11,7 @@ internal static class StartupSetter public static bool SetStartup(bool enable) { using var key = Registry.CurrentUser.OpenSubKey(RunKeyPath, writable: true) - ?? throw new InvalidOperationException("시작 프로그램 레지스트리 키를 열 수 없습니다."); + ?? throw new InvalidOperationException(Localizer.Get("Startup.RegistryKeyFailed")); if (enable) key.SetValue(ValueName, QuoteExecutablePath(GetExecutablePath()), RegistryValueKind.String); diff --git a/Battify/TrayControl.cs b/Battify/TrayControl.cs index 49b1880..6f5e6a6 100644 --- a/Battify/TrayControl.cs +++ b/Battify/TrayControl.cs @@ -11,6 +11,7 @@ public TrayControl(MainWindow w) { InitializeComponent(); mainWindow = w; + ApplyLocalizedTexts(); // 커스텀 렌더러 적용 contextMenuStrip1.Renderer = new DarkMenuRenderer(); @@ -71,11 +72,11 @@ private async void TrayIcon_BalloonTipClicked(object? sender, EventArgs e) bool success = await MsixStartupSetter.SetStartupAsync(true); if (success) { - trayIcon.ShowBalloonTip(2000, "설정 완료", "시작 프로그램으로 설정되었습니다.", ToolTipIcon.Info); + trayIcon.ShowBalloonTip(2000, Localizer.Get("Tray.StartupCompleted"), Localizer.Get("Tray.StartupCompletedMessage"), ToolTipIcon.Info); } else { - trayIcon.ShowBalloonTip(2000, "설정 실패", "시작 프로그램 설정에 실패했습니다.", ToolTipIcon.Error); + trayIcon.ShowBalloonTip(2000, Localizer.Get("Tray.StartupFailed"), Localizer.Get("Tray.StartupFailedMessage"), ToolTipIcon.Error); } } finally @@ -160,8 +161,8 @@ private void showBattInfoToolStripMenuItem_Click(object sender, EventArgs e) public void StartupSuggestBalloonShow() { - trayIcon.BalloonTipTitle = "시작 프로그램 설정 안됨"; - trayIcon.BalloonTipText = "여기를 눌러 시작프로그램으로 설정하세요."; + trayIcon.BalloonTipTitle = Localizer.Get("Tray.StartupNotConfigured"); + trayIcon.BalloonTipText = Localizer.Get("Tray.StartupSuggestion"); trayIcon.BalloonTipIcon = ToolTipIcon.Info; trayIcon.ShowBalloonTip(3000); @@ -182,30 +183,44 @@ private void togglePopupToolStripMenuItem_Click(object sender, EventArgs e) private void contextMenuStrip1_Opening(object sender, System.ComponentModel.CancelEventArgs e) { // 알림음 메뉴 텍스트 업데이트 - muteToolStripMenuItem.Text = Settings.Default.mute ? "알림음 켜기" : "알림음 끄기"; + muteToolStripMenuItem.Text = Settings.Default.mute ? Localizer.Get("Tray.EnableSound") : Localizer.Get("Tray.DisableSound"); // 팝업 메뉴 텍스트 업데이트 - togglePopupToolStripMenuItem.Text = Settings.Default.nopopup ? "팝업 켜기" : "팝업 끄기"; + togglePopupToolStripMenuItem.Text = Settings.Default.nopopup ? Localizer.Get("Tray.EnablePopup") : Localizer.Get("Tray.DisablePopup"); // 팝업 색상 메뉴 텍스트 업데이트 string popupThemeText = Settings.Default.theme switch { - "auto" => "팝업 색: 자동", - "light" => "팝업 색: 라이트", - "dark" => "팝업 색: 다크", - _ => "팝업 색: 자동" + "auto" => Localizer.Get("Tray.PopupThemeAuto"), + "light" => Localizer.Get("Tray.PopupThemeLight"), + "dark" => Localizer.Get("Tray.PopupThemeDark"), + _ => Localizer.Get("Tray.PopupThemeAuto") }; changeThemeToolStripMenuItem.Text = popupThemeText; // 아이콘 색상 메뉴 텍스트 업데이트 string iconThemeText = Settings.Default.traytheme switch { - "auto" => "아이콘 색: 자동", - "white" => "아이콘 색: 라이트", - "black" => "아이콘 색: 다크", - _ => "아이콘 색: 자동" + "auto" => Localizer.Get("Tray.IconThemeAuto"), + "white" => Localizer.Get("Tray.IconThemeLight"), + "black" => Localizer.Get("Tray.IconThemeDark"), + _ => Localizer.Get("Tray.IconThemeAuto") }; changeTrayToolStripMenuItem.Text = iconThemeText; } + + private void ApplyLocalizedTexts() + { + closeAppToolStripMenuItem.Text = Localizer.Get("Tray.Exit"); + appearanceToolStripMenuItem.Text = Localizer.Get("Tray.Appearance"); + notificationToolStripMenuItem.Text = Localizer.Get("Tray.Notifications"); + showBattInfoToolStripMenuItem.Text = Localizer.Get("Tray.InformationSettings"); + } + + public void RefreshLocalizedTexts() + { + ApplyLocalizedTexts(); + contextMenuStrip1_Opening(this, new System.ComponentModel.CancelEventArgs()); + } } } diff --git a/Battify/TrayGuideWindow.xaml b/Battify/TrayGuideWindow.xaml index 6455fdf..b86cd42 100644 --- a/Battify/TrayGuideWindow.xaml +++ b/Battify/TrayGuideWindow.xaml @@ -1,7 +1,8 @@ - + - + - + @@ -98,7 +99,7 @@