From abb6f729e4b52b0d56245b5706b8cc8dad69d4f8246e309803e1dff59059e637 Mon Sep 17 00:00:00 2001 From: copecone Date: Wed, 14 Oct 2026 22:55:15 +0900 Subject: [PATCH] Localize FFmpeg Download And Driver Warning Dialogs --- Core/FirstUpdateHook.cs | 11 ++++++----- Localization/Locale/en.json | 24 +++++++++++++++++++++++- Localization/Locale/ko.json | 24 +++++++++++++++++++++++- UI/FFmpegDownloadUI.cs | 33 +++++++++++++++++---------------- 4 files changed, 69 insertions(+), 23 deletions(-) diff --git a/Core/FirstUpdateHook.cs b/Core/FirstUpdateHook.cs index 14a85ab..1f1debb 100644 --- a/Core/FirstUpdateHook.cs +++ b/Core/FirstUpdateHook.cs @@ -1,3 +1,4 @@ +using ADOFAIRenderer.Localization; using ADOFAIRenderer.UI; using UnityEngine; @@ -45,18 +46,18 @@ internal class FirstUpdateHook : MonoBehaviour var currentVersion = driverVer.Value.ToString("F2"); CommonWarningDialogUI.ShowDialog( - "NVIDIA Graphics Driver Update Recommended", - $"Currently detected NVIDIA graphics driver version: {currentVersion}\n\nDriver version 610.00 or higher is required to render video using hardware acceleration (NVENC).\n\nIf the driver version is lower, encoding may fail or fallback to software (CPU) encoding, significantly slowing down rendering. Please update your graphics driver.", - new DialogButton("Update Driver", () => + LocalizationManager.Get("ui.driver_warning.title"), + LocalizationManager.Get("ui.driver_warning.body", currentVersion), + new DialogButton(LocalizationManager.Get("ui.driver_warning.btn_update"), () => { Application.OpenURL("https://www.nvidia.com/Download/index.aspx"); Application.Quit(); }, new Color(0.0f, 0.8f, 1.0f, 1.0f)), - new DialogButton("Disable Feature", () => + new DialogButton(LocalizationManager.Get("ui.driver_warning.btn_disable"), () => { RenderMod.IsFeatureDisabled = true; }), - new DialogButton("Continue Anyway", () => + new DialogButton(LocalizationManager.Get("ui.driver_warning.btn_continue"), () => { // ignored }) diff --git a/Localization/Locale/en.json b/Localization/Locale/en.json index f40182b..9a126f7 100644 --- a/Localization/Locale/en.json +++ b/Localization/Locale/en.json @@ -51,5 +51,27 @@ "ui.render_config.fire_planet": "Fire Planet", "ui.render_config.ice_planet": "Ice Planet", "ui.render_config.wind_planet": "Wind Planet", - "ui.render_config.expired": "(Expired)" + "ui.render_config.expired": "(Expired)", + "ui.ffmpeg_download.title": "FFmpeg Library Installation Required", + "ui.ffmpeg_download.desc_required": "FFmpeg shared libraries are required to render video.", + "ui.ffmpeg_download.desc_mac_build": "For macOS, reliable public builds are unavailable, so FFmpeg 8.1 must be built manually.", + "ui.ffmpeg_download.desc_mac_open": "Click the button below to open the official FFmpeg website.", + "ui.ffmpeg_download.desc_download": "Click the button below to automatically download and install from the internet.", + "ui.ffmpeg_download.desc_size": "(Download size: ~70MB, extracted to UserLibs folder)", + "ui.ffmpeg_download.btn_download": "Download & Install", + "ui.ffmpeg_download.btn_open_site": "Open Website", + "ui.ffmpeg_download.btn_cancel": "Cancel", + "ui.ffmpeg_download.btn_retry": "Retry", + "ui.ffmpeg_download.status_starting": "Starting download...", + "ui.ffmpeg_download.status_downloading": "Downloading... ({0}%)", + "ui.ffmpeg_download.status_extracting": "Extracting and copying library files...", + "ui.ffmpeg_download.progress_extracting": "Extracting...", + "ui.ffmpeg_download.status_complete": "FFmpeg installation complete!", + "ui.ffmpeg_download.status_cancelled": "Download was cancelled.", + "ui.ffmpeg_download.status_failed": "Installation failed: {0}", + "ui.driver_warning.title": "NVIDIA Graphics Driver Update Recommended", + "ui.driver_warning.body": "Currently detected NVIDIA graphics driver version: {0}\n\nDriver version 610.00 or higher is required to render video using hardware acceleration (NVENC).\n\nIf the driver version is lower, encoding may fail or fallback to software (CPU) encoding, significantly slowing down rendering. Please update your graphics driver.", + "ui.driver_warning.btn_update": "Update Driver", + "ui.driver_warning.btn_disable": "Disable Feature", + "ui.driver_warning.btn_continue": "Continue Anyway" } diff --git a/Localization/Locale/ko.json b/Localization/Locale/ko.json index a201e08..d42bb03 100644 --- a/Localization/Locale/ko.json +++ b/Localization/Locale/ko.json @@ -51,5 +51,27 @@ "ui.render_config.fire_planet": "불 행성", "ui.render_config.ice_planet": "얼음 행성", "ui.render_config.wind_planet": "바람 행성", - "ui.render_config.expired": "(만료됨)" + "ui.render_config.expired": "(만료됨)", + "ui.ffmpeg_download.title": "FFmpeg 라이브러리 설치 필요", + "ui.ffmpeg_download.desc_required": "영상을 렌더링하려면 FFmpeg 공유 라이브러리가 필요해요.", + "ui.ffmpeg_download.desc_mac_build": "macOS는 신뢰할 수 있는 공개 빌드가 없어서 FFmpeg 8.1을 직접 빌드해야 해요.", + "ui.ffmpeg_download.desc_mac_open": "아래 버튼을 누르면 FFmpeg 공식 웹사이트가 열려요.", + "ui.ffmpeg_download.desc_download": "아래 버튼을 누르면 인터넷에서 자동으로 내려받아 설치해요.", + "ui.ffmpeg_download.desc_size": "(다운로드 크기: 약 70MB, UserLibs 폴더에 압축 해제)", + "ui.ffmpeg_download.btn_download": "다운로드 및 설치", + "ui.ffmpeg_download.btn_open_site": "웹사이트 열기", + "ui.ffmpeg_download.btn_cancel": "취소", + "ui.ffmpeg_download.btn_retry": "다시 시도", + "ui.ffmpeg_download.status_starting": "다운로드를 시작하는 중...", + "ui.ffmpeg_download.status_downloading": "다운로드 중... ({0}%)", + "ui.ffmpeg_download.status_extracting": "라이브러리 파일을 압축 해제하고 복사하는 중...", + "ui.ffmpeg_download.progress_extracting": "압축 해제 중...", + "ui.ffmpeg_download.status_complete": "FFmpeg 설치가 끝났어요!", + "ui.ffmpeg_download.status_cancelled": "다운로드가 취소되었어요.", + "ui.ffmpeg_download.status_failed": "설치에 실패했어요: {0}", + "ui.driver_warning.title": "NVIDIA 그래픽 드라이버 업데이트 권장", + "ui.driver_warning.body": "현재 감지된 NVIDIA 그래픽 드라이버 버전: {0}\n\n하드웨어 가속(NVENC)으로 영상을 렌더링하려면 드라이버 버전 610.00 이상이 필요해요.\n\n드라이버 버전이 더 낮으면 인코딩이 실패하거나 소프트웨어(CPU) 인코딩으로 바뀌어 렌더링이 훨씬 느려질 수 있어요. 그래픽 드라이버를 업데이트해 주세요.", + "ui.driver_warning.btn_update": "드라이버 업데이트", + "ui.driver_warning.btn_disable": "기능 끄기", + "ui.driver_warning.btn_continue": "그래도 계속" } diff --git a/UI/FFmpegDownloadUI.cs b/UI/FFmpegDownloadUI.cs index 99ef36c..440198a 100644 --- a/UI/FFmpegDownloadUI.cs +++ b/UI/FFmpegDownloadUI.cs @@ -1,4 +1,5 @@ using System; +using ADOFAIRenderer.Localization; using System.IO; using System.IO.Compression; using System.Net.Http; @@ -128,7 +129,7 @@ internal class FFmpegDownloadUI : MonoBehaviour _window = O5Window.Create(ctx, bgPanelObj.transform, new O5WindowOptions { Id = "RendererMod_FFmpegDownloadDialog", - Title = "FFmpeg Library Installation Required", + Title = LocalizationManager.Get("ui.ffmpeg_download.title"), Size = new Vector2(580, 270), Draggable = true, Resizable = false, @@ -150,16 +151,16 @@ internal class FFmpegDownloadUI : MonoBehaviour // 3. Description text var descText = O5Factory.ControlText(ctx, content, 18f, noPad: true); var descStrBuilder = new StringBuilder(); - descStrBuilder.AppendLine("FFmpeg shared libraries are required to render video."); + descStrBuilder.AppendLine(LocalizationManager.Get("ui.ffmpeg_download.desc_required")); if (Application.platform == RuntimePlatform.OSXPlayer) { - descStrBuilder.AppendLine("For macOS, reliable public builds are unavailable, so FFmpeg 8.1 must be built manually."); - descStrBuilder.AppendLine("Click the button below to open the official FFmpeg website."); + descStrBuilder.AppendLine(LocalizationManager.Get("ui.ffmpeg_download.desc_mac_build")); + descStrBuilder.AppendLine(LocalizationManager.Get("ui.ffmpeg_download.desc_mac_open")); } else { - descStrBuilder.AppendLine("Click the button below to automatically download and install from the internet."); - descStrBuilder.AppendLine("(Download size: ~70MB, extracted to UserLibs folder)"); + descStrBuilder.AppendLine(LocalizationManager.Get("ui.ffmpeg_download.desc_download")); + descStrBuilder.AppendLine(LocalizationManager.Get("ui.ffmpeg_download.desc_size")); } descText.text = descStrBuilder.ToString(); descText.alignment = TextAlignmentOptions.Center; @@ -196,7 +197,7 @@ internal class FFmpegDownloadUI : MonoBehaviour ctx: ctx, parent: _buttonContainerObj.transform, onClick: onDownloadClick, - text: Application.platform != RuntimePlatform.OSXPlayer ? "Download & Install" : "Open Website", + text: LocalizationManager.Get(Application.platform != RuntimePlatform.OSXPlayer ? "ui.ffmpeg_download.btn_download" : "ui.ffmpeg_download.btn_open_site"), id: "btn_ffmpeg_download", height: 40f ); @@ -211,7 +212,7 @@ internal class FFmpegDownloadUI : MonoBehaviour ctx: ctx, parent: _buttonContainerObj.transform, onClick: CancelProcess, - text: "Cancel", + text: LocalizationManager.Get("ui.ffmpeg_download.btn_cancel"), id: "btn_ffmpeg_cancel", height: 40f ); @@ -341,7 +342,7 @@ internal class FFmpegDownloadUI : MonoBehaviour string tempZipPath = ""; try { - UpdateStatus("Starting download...", new Color(0.8f, 0.8f, 0.8f)); + UpdateStatus(LocalizationManager.Get("ui.ffmpeg_download.status_starting"), new Color(0.8f, 0.8f, 0.8f)); UpdateProgress(0f, "0%"); var userLibsDir = MelonEnvironment.UserLibsDirectory; @@ -361,19 +362,19 @@ internal class FFmpegDownloadUI : MonoBehaviour var progressReporter = new Progress(percent => { UpdateProgress(percent, $"{percent * 100f:F1}%"); - UpdateStatus($"Downloading... ({(percent * 100f):F1}%)", new Color(0f, 0.8f, 1f)); + UpdateStatus(LocalizationManager.Get("ui.ffmpeg_download.status_downloading", $"{percent * 100f:F1}"), new Color(0f, 0.8f, 1f)); }); await DownloadFileAsync(DownloadUrl, tempZipPath, progressReporter, _cts.Token); // Extract after download complete - UpdateStatus("Extracting and copying library files...", new Color(0.9f, 0.9f, 0.2f)); - UpdateProgress(0.99f, "Extracting..."); + UpdateStatus(LocalizationManager.Get("ui.ffmpeg_download.status_extracting"), new Color(0.9f, 0.9f, 0.2f)); + UpdateProgress(0.99f, LocalizationManager.Get("ui.ffmpeg_download.progress_extracting")); await ExtractDllsAsync(tempZipPath, userLibsDir); // Update completion status - UpdateStatus("FFmpeg installation complete!", new Color(0.2f, 0.9f, 0.2f)); + UpdateStatus(LocalizationManager.Get("ui.ffmpeg_download.status_complete"), new Color(0.2f, 0.9f, 0.2f)); UpdateProgress(1f, "100%"); await Task.Delay(1000); @@ -395,12 +396,12 @@ internal class FFmpegDownloadUI : MonoBehaviour // ignored } } - UpdateStatus("Download was cancelled.", new Color(0.9f, 0.5f, 0.2f)); + UpdateStatus(LocalizationManager.Get("ui.ffmpeg_download.status_cancelled"), new Color(0.9f, 0.5f, 0.2f)); } catch (Exception ex) { Melon.Logger.Error($"Error during FFmpeg download/installation: {ex}"); - UpdateStatus($"Installation failed: {ex.Message}", new Color(1f, 0.3f, 0.3f)); + UpdateStatus(LocalizationManager.Get("ui.ffmpeg_download.status_failed", ex.Message), new Color(1f, 0.3f, 0.3f)); // Reset buttons on failure ExecuteOnMainThread(() => @@ -410,7 +411,7 @@ internal class FFmpegDownloadUI : MonoBehaviour var downloadBtnText = _buttonContainerObj.transform.Find("DownloadButton/DownloadText")?.GetComponent(); if (downloadBtnText) { - downloadBtnText.text = "Retry"; + downloadBtnText.text = LocalizationManager.Get("ui.ffmpeg_download.btn_retry"); } }); }