Free, open-source Windows optimization tool for performance, privacy, and simplicity.
C# csharpdebloatdotnetgamingopen-sourceoptimizationoptimizeroptimizerduckperformanceprivacytweakertweakswindowswinui
docs(contributing): centralize language source and document runtime LegalDialog best practices
fatDuck321afd716f76
diff --git a/.github/contributing/CONTRIBUTING.ja-JP.md b/.github/contributing/CONTRIBUTING.ja-JP.mdindex a6bc027..7898dcd 100644--- a/.github/contributing/CONTRIBUTING.ja-JP.md+++ b/.github/contributing/CONTRIBUTING.ja-JP.md@@ -149,14 +149,14 @@ optimizerDuck.slnx # ソリューションファイル│ │ ├── Revert/ # RevertData, RevertResult, リバートステップ型│ │ │ └── Steps/ # RegistryRevertStep, ServiceRevertStep,│ │ │ # ScheduledTaskRevertStep, ShellRevertStep, UsbPowerRevertStep-│ │ └── UI/ # 列挙型: OptimizationRisk, OptimizationTags,+│ │ └── UI/ # Enums & helpers: OptimizationRisk, OptimizationTags,│ │ # OptimizationCategoryOrder, CustomizeOrder,-│ │ # LanguageOption, OptimizationState, RiskVisual,-│ │ # ProcessingProgress など+│ │ # LanguageOption, SupportedLanguages (single source of truth, 17 locales),+│ │ # OptimizationState, RiskVisual, ProcessingProgress, ...│ │-│ ├── Common/ # 共有ヘルパー、拡張、コンバーター-│ │ ├── Converters/ # WPF 値コンバーター(BooleanToVisibility, MBToGB など)-│ │ ├── Extensions/ # StringExtensions, ページレジストリ拡張,+│ ├── Common/ # Shared helpers, extensions, converters+│ │ ├── Converters/ # WPF value converters (BooleanToVisibility, MBToGB, ThemeToIndexConverter, ThemeToGitHubIconConverter, ...)+│ │ ├── Extensions/ # StringExtensions, page-registry extensions,│ │ │ # LanguageExtensions│ │ └── Helpers/ # Shared.cs, ReflectionHelper.cs, SystemRefreshService.cs,│ │ # EmbeddedResourceHelper.cs, WmiHelper.cs,@@ -178,16 +178,18 @@ optimizerDuck.slnx # ソリューションファイル│ │ ├── Behaviors/ # SmoothScrollBehavior│ │ ├── Controls/ # FilledNavigationViewItem, EmptyBadge│ │ ├── Dialogs/ # ProcessingDialog, OptimizationDetailsDialog,-│ │ │ # OptimizationResultDialog, RestorePointDialog, LegalDialog,-│ │ │ # BloatwareConfirmationDialog, ScheduledTask ダイアログなど+│ │ │ # OptimizationResultDialog, RestorePointDialog, LegalDialog (+ ViewModel),+│ │ │ # BloatwareConfirmationDialog, ScheduledTask dialogs, ...│ │ ├── Pages/ # Dashboard, Optimize, Customize, Settings, Bloatware,-│ │ │ ├── Customize/ # CustomizePage + Categories/(自動登録ページ)-│ │ │ ├── Optimize/ # OptimizePage + Categories/(自動登録ページ)+│ │ │ ├── Customize/ # CustomizePage + Categories/ (auto-registered pages)+│ │ │ ├── Optimize/ # OptimizePage + Categories/ (auto-registered pages)│ │ │ ├── DiskCleanupPage│ │ │ ├── StartupManagerPage│ │ │ └── ScheduledTasksPage│ │ ├── Styles/ # FluentDesign.xaml, NavigationViewOverride.xaml, ToolTipOverride.xaml-│ │ ├── ViewModels/ # ページ、ダイアログ、ウィンドウの ViewModel+│ │ ├── ViewModels/ # Page, dialog and window ViewModels+│ │ │ ├── Dialogs/ # LegalDialogViewModel (transient, runtime language/theme)+│ │ │ ├── Pages/ # DashboardViewModel, SettingsViewModel, ...│ │ └── Windows/ # MainWindow│ ││ └── Resources/ # 画像、埋め込みアセット、ローカライズ@@ -856,27 +858,30 @@ public sealed class MyCondition : ConditionBase2. **実装順序**:```csharp-// 1. サービス層: Services/UI または Services/System/YourService.cs+// 1. Service layer in Services/UI or Services/System/YourService.cspublic class YourService(ILogger<YourService> logger) { ... }-// 2. ViewModel: UI/ViewModels/Pages/YourViewModel.cs-// ViewModel(ObservableValidator + INavigationAware を継承)を拡張+// 2. ViewModel in UI/ViewModels/Pages/YourViewModel.cs+// Extends ViewModel (which extends ObservableValidator + INavigationAware)-// 3. XAML ページ: UI/Pages/YourPage.xaml(+ コードビハインド)+// 3. XAML Page in UI/Pages/YourPage.xaml (+ code-behind)-// 4. App.xaml.cs にシングルトン登録+// 4. Register as singletons in App.xaml.csservices.AddSingleton<YourViewModel>();services.AddSingleton<YourPage>();++// 4b. Dialogs are transient (fresh instance per show, supports runtime language/theme)+services.AddTransient<YourDialogViewModel>();+services.AddTransient<YourDialog>();```-- ViewModel とページは `App.xaml.cs` に**シングルトンとして登録する必要があります**。-- ナビゲーションは WPF UI(`INavigationService`)が処理します。-- 既存のパターンに従ってください — `DashboardPage`、`OptimizePage`、`BloatwarePage`、`DiskCleanupPage`、`ScheduledTasksPage`、`StartupManagerPage` などを参照。+- ViewModel とページは `App.xaml.cs` にシングルトンとして登録する必要があり、ダイアログはトランジェント(`AddTransient`)で登録する必要があります。シングルトンとトランジェントの使い分けに注意し、`App.AppHost` 経由で解決されることに留意してください。+- ナビゲーションは WPF UI(`INavigationService`)が処理します。ダイアログは `App.AppHost.Services.GetRequiredService<T>()` で解決されます(`MainWindow.xaml.cs` → `LegalDialog` を参照)。+- 既存のパターンに従ってください — `DashboardPage`、`OptimizePage`、`BloatwarePage`、`DiskCleanupPage`、`ScheduledTasksPage`、`StartupManagerPage`、および `LegalDialog`(ViewModel + トランジェント登録)などを参照。<h3 id="di-registration-pattern">DI 登録パターン(App.xaml.cs より)</h3>-```csharp-// ページ + ViewModel — 機能ごとに 1 ペア+// ページ + ViewModel — 機能ごとに 1 ペア(シングルトン)services.AddSingleton<DashboardViewModel>();services.AddSingleton<DashboardPage>();@@ -898,6 +903,10 @@ services.AddSingleton<StartupManagerPage>();services.AddSingleton<ScheduledTasksViewModel>();services.AddSingleton<ScheduledTasksPage>();+// Dialogs — transient (fresh instance per show)+services.AddTransient<LegalDialogViewModel>();+services.AddTransient<LegalDialog>();+// Customizeservices.AddSingleton<CustomizeViewModel>();services.AddSingleton<CustomizePage>();@@ -923,7 +932,7 @@ services.AddSingleton<UpdaterService>();services.AddSingleton<IRegistryWatcher, RegistryWatcher>();```-> これは把握のためのスナップショットです — 現在の登録は `App.xaml.cs` が正です。また、起動時の呼び出し `ShellService.Init(appOptionsMonitor)` と `WmiHelper.Initialize()` にも注意してください。+> これは把握のためのスナップショットです — 現在の登録は `App.xaml.cs` が正です。また、起動時の呼び出し `ShellService.Init(appOptionsMonitor)` と `WmiHelper.Initialize()`、およびトランジェントなダイアログの解決に使われる公開プロパティ `App.AppHost` にも注意してください。<h3 id="system-services">システムサービスリファレンス</h3>@@ -1202,20 +1211,44 @@ public class MyOptimizationTests<h3 id="available-locales-jp">利用可能なロケール</h3>-アプリは**15 を超える言語**を同梱しており、その数は増え続けています。ここに列挙すると古くなってしまうため、代わりに次を確認してください:+アプリは**17言語**を同梱しており、その数は増え続けています。ここに列挙すると古くなってしまうため、代わりに次を確認してください:- **ロケールファイル自体**:`optimizerDuck/Resources/Languages/` — 言語ごとに `Translations.{locale}.resx` が 1 つ、英語のデフォルトとして `Translations.resx` があります。-- **登録リスト**:`UI/ViewModels/Pages/SettingsViewModel.cs` の `Languages` — UI に表示される言語の正式なリストです。+- **単一の真実の情報源**:`Domain/UI/SupportedLanguages.cs` — `SupportedLanguages.All` が UI に表示される言語の正式なリストです(`SettingsViewModel` と `LegalDialogViewModel` が使用)。リストを重複させないでください。<h3 id="adding-a-new-language-jp">新しい言語の追加</h3>1. `Translations.{locale}.resx`(例:`Translations.de-DE.resx`)を `Translations.resx` と同じすべてのキーで作成します。-2. `UI/ViewModels/Pages/SettingsViewModel.cs` に言語を登録します:+2. 言語を `Domain/UI/SupportedLanguages.cs` に登録します:```csharpnew() { DisplayName = "Deutsch", Culture = new CultureInfo("de-DE") },```+Settings とダイアログは `SupportedLanguages.All` 経由で自動的に反映されます — 他のファイルを更新する必要はありません。++<h3 id="runtime-language-switching-jp">ランタイム言語切り替え</h3>++アプリは再起動なしで言語を切り替えできます(`Loc.Instance.ChangeCulture`)。ベストプラクティス:++- ランタイムで更新すべき C# 文字列には `Loc.Instance["Key"]` または `Loc.Instance["Key", arg0, arg1]`(内部で `string.Format`)を使用します。+- 選択を `ConfigManager.SetAsync(x => x.App.Language, cultureName)` で永続化し、fire-and-forget + 失敗時リバートパターンを使います(`SettingsViewModel` と `LegalDialogViewModel` を参照)。+- 開いたまま言語が変わるダイアログでは、`ContentDialog` のプロパティを `Loc.Instance` にバインドしてタイトル/ボタンがライブ更新されるようにします:++```csharp+dialog.SetBinding(ContentDialog.TitleProperty,+ new Binding("[LegalDialog.Title]") { Source = Loc.Instance, Mode = BindingMode.OneWay });+dialog.SetBinding(ContentDialog.PrimaryButtonTextProperty,+ new Binding("[Button.Accept]") { Source = Loc.Instance, Mode = BindingMode.OneWay });+```++- 言語ピッカーには `SupportedLanguages.All` を再利用します(`ComboBox` で `DisplayMemberPath="DisplayName"`、`SelectedValuePath="Culture.Name"`、`SelectedValue="{Binding SelectedCultureName}"`)。+- 英語が最も正確である旨のヒントを表示します:`LegalDialog.Language.Tip` / `LegalDialog.Theme.Tip` — `Caption` + `Italic` + `TextFillColorTertiaryBrush`。++<h3 id="dialog-localization-jp">ダイアログのローカライズ</h3>++`LegalDialog` のようなダイアログは `Transient` で、表示ごとに `ViewModel` が再生成されます。`InitializeOnceAsync` で現在の `App.Language`/`App.Theme` を読み込み、`SelectedCultureName`/`CurrentApplicationTheme` を双方向バインディングで公開します。テーマは `ApplicationThemeManager.Apply` + `ThemeToIndexConverter`、GitHub アイコンは `ThemeToGitHubIconConverter` でライト/ダークを切り替えます。+<h3 id="hardcoded-string-rule-jp">文字列ハードコードの禁止</h3>**文字列をハードコードしないでください**。常に次を使用します:@@ -1224,8 +1257,8 @@ new() { DisplayName = "Deutsch", Culture = new CultureInfo("de-DE") },// 型付き(推奨)string title = Translations.Features_Desktop_Name;-// フォーマット引数付き-string msg = string.Format(Translations.Dashboard_SystemInfo_Storage_DiskInfo, used, total, percent);+// フォーマット引数付き — string.Format より Loc インデクサを推奨+string msg = Loc.Instance["Dashboard.SystemInfo.Storage.DiskInfo", used, total, percent];// 動的キールックアップ(規則ベースのキー用)string title = Loc.Instance[$"Optimizer.{category}.{key}.Name"];@@ -1239,6 +1272,9 @@ XAML:<!-- バインドされた引数付き --><ui:TextBlock Text="{ext:Loc Dashboard.UpdateInfoBar.Message, {Binding ViewModel.LatestVersion}}" />++<!-- ライブダイアログバインディング(Loc 変更時に更新) -->+<ui:TextBlock Text="{ext:Loc LegalDialog.Intro.Title}" />```---diff --git a/.github/contributing/CONTRIBUTING.tr-TR.md b/.github/contributing/CONTRIBUTING.tr-TR.mdindex fafa2d8..ae5c528 100644--- a/.github/contributing/CONTRIBUTING.tr-TR.md+++ b/.github/contributing/CONTRIBUTING.tr-TR.md@@ -110,92 +110,94 @@ publish.bat portable --no-pause # Sonunda duraklamaz (CI dostu)<h3 id="solution-structure">Çözüm Yapısı</h3>```-optimizerDuck.slnx # Çözüm dosyası (.slnx formatı)-├── optimizerDuck/ # Ana WPF uygulaması (net10.0-windows)-│ ├── App.xaml.cs # DI kaydı, başlangıç, tema, loglama+optimizerDuck.slnx # Solution file (.slnx format)+├── optimizerDuck/ # Main WPF app (net10.0-windows)+│ ├── App.xaml.cs # DI registration, startup, theme, logging│ ├── optimizerDuck.csproj # TFM: net10.0-windows10.0.17763.0, UseWPF=true-│ ├── app.manifest # requireAdministrator UAC seviyesi+│ ├── app.manifest # requireAdministrator UAC level│ │-│ ├── Domain/ # Saf modeller, arayüzler, özellikler (WPF bağımlılığı yok)+│ ├── Domain/ # Pure models, interfaces, attributes (no WPF deps)│ │ ├── Abstractions/ # IOptimization, ICustomizeSetting, IRevertStep, IWindow,│ │ │ # ICustomizeCategory, IOptimizationCategory│ │ ├── Attributes/ # [Optimization], [CustomizeSetting],│ │ │ # [OptimizationCategory], [CustomizeCategory]-│ │ ├── Conditions/ # Uyumluluk koşul sistemi ("Koşul Sistemi" bölümüne bakın)-│ │ │ ├── BuiltIn/ # Hazır koşullar (Windows sürümü, GPU/CPU markası,-│ │ │ │ # minimum RAM, kayıt defteri anahtarı / hizmet varlığı, ...)-│ │ │ ├── ICondition.cs # Koşul sözleşmesi-│ │ │ ├── ConditionBase.cs # Paylaşılan yardımcılar (örn. OS derleme ayrıştırma)-│ │ │ ├── ConditionResult.cs # Available / Unsupported / Error sonucu-│ │ │ ├── ConditionState.cs # Sonuç enum'u-│ │ │ ├── ConditionValidation.cs # Keşif sırasında meta veri doğrulama-│ │ │ └── WindowsBuilds.cs # OS derleme numarası sabitleri-│ │ ├── Configuration/ # AppSettings modeli+│ │ ├── Conditions/ # Compatibility condition system (see "The Condition System")+│ │ │ ├── BuiltIn/ # Ready-made conditions (Windows version, GPU/CPU brand,+│ │ │ │ # min RAM, registry key / service existence, ...)+│ │ │ ├── ICondition.cs # Condition contract+│ │ │ ├── ConditionBase.cs # Shared helpers (e.g. OS build parsing)+│ │ │ ├── ConditionResult.cs # Available / Unsupported / Error outcome+│ │ │ ├── ConditionState.cs # Outcome enum+│ │ │ ├── ConditionValidation.cs # Discovery-time metadata validation+│ │ │ └── WindowsBuilds.cs # OS build number constants+│ │ ├── Configuration/ # AppSettings model│ │ ├── Exceptions/ # StepExecutionException-│ │ ├── Execution/ # ExecutionScope — AsyncLocal ile çevresel adım takibi-│ │ ├── Customize/ # Özelleştirme ayarları-│ │ │ ├── Categories/ # İç içe ayar sınıflarına sahip kategori sınıfları+│ │ ├── Execution/ # ExecutionScope — ambient step tracking via AsyncLocal+│ │ ├── Customize/ # Customize settings+│ │ │ ├── Categories/ # Category classes with nested setting classes│ │ │ └── Models/ # BaseCustomizeSetting, RegistryToggle, RegistryBinding,│ │ │ # CustomizeRefreshScope, SettingOption,│ │ │ # CustomizeControlType, RecommendationState, ...-│ │ ├── Optimizations/ # Optimizasyonlar-│ │ │ ├── Categories/ # İç içe optimizasyon sınıflarına sahip kategori sınıfları+│ │ ├── Optimizations/ # Optimizations+│ │ │ ├── Categories/ # Category classes with nested optimization classes│ │ │ └── Models/ # BaseOptimization, ApplyResult, OptimizationContext,-│ │ │ ├── Bloatware/ # Önceden yüklü uygulamalar için AppXPackage modeli-│ │ │ ├── Cleanup/ # Disk temizliği için CleanupItem+│ │ │ ├── Bloatware/ # AppXPackage model for preinstalled apps+│ │ │ ├── Cleanup/ # CleanupItem for disk cleanup│ │ │ ├── ScheduledTask/ # ScheduledTaskModel│ │ │ ├── Services/ # RegistryItem, ServiceItem, ShellResult, ServiceStartupType-│ │ │ └── StartupManager/ # StartupApp, StartupTask modelleri-│ │ ├── Revert/ # RevertData, RevertResult, geri alma adımı türleri+│ │ │ └── StartupManager/ # StartupApp, StartupTask models+│ │ ├── Revert/ # RevertData, RevertResult, revert step types│ │ │ └── Steps/ # RegistryRevertStep, ServiceRevertStep,│ │ │ # ScheduledTaskRevertStep, ShellRevertStep, UsbPowerRevertStep-│ │ └── UI/ # Enumlar: OptimizationRisk, OptimizationTags,+│ │ └── UI/ # Enums & helpers: OptimizationRisk, OptimizationTags,│ │ # OptimizationCategoryOrder, CustomizeOrder,-│ │ # LanguageOption, OptimizationState, RiskVisual,-│ │ # ProcessingProgress, ...+│ │ # LanguageOption, SupportedLanguages (single source of truth, 17 locales),+│ │ # OptimizationState, RiskVisual, ProcessingProgress, ...│ │-│ ├── Common/ # Ortak yardımcılar, eklentiler, dönüştürücüler-│ │ ├── Converters/ # WPF değer dönüştürücüleri (BooleanToVisibility, MBToGB, ...)-│ │ ├── Extensions/ # StringExtensions, sayfa-kayıt eklentileri,+│ ├── Common/ # Shared helpers, extensions, converters+│ │ ├── Converters/ # WPF value converters (BooleanToVisibility, MBToGB, ThemeToIndexConverter, ThemeToGitHubIconConverter, ...)+│ │ ├── Extensions/ # StringExtensions, page-registry extensions,│ │ │ # LanguageExtensions│ │ └── Helpers/ # Shared.cs, ReflectionHelper.cs, SystemRefreshService.cs,│ │ # EmbeddedResourceHelper.cs, WmiHelper.cs,│ │ # GitHubSourceHelper.cs, ThemeResource.cs, ...│ │-│ ├── Services/ # İş mantığı katmanı-│ │ ├── Conditions/ # ConditionEvaluator (statik değerlendirme giriş noktası)+│ ├── Services/ # Business logic layer+│ │ ├── Conditions/ # ConditionEvaluator (static evaluation entry point)│ │ ├── Configuration/ # ConfigManager, LanguageManager-│ │ ├── Customize/ # CustomizeRegistry (yansıma tabanlı keşif)+│ │ ├── Customize/ # CustomizeRegistry (reflection-based discovery)│ │ ├── Optimization/ # OptimizationRegistry, OptimizationService-│ │ │ └── Providers/ # Statik: RegistryService, ShellService (+ ShellPolicy),+│ │ │ └── Providers/ # Static: RegistryService, ShellService (+ ShellPolicy),│ │ │ # ScheduledTaskService, ServiceProcessService-│ │ ├── Revert/ # RevertManager (geri alma JSON'unun atomik okuma/yazması)+│ │ ├── Revert/ # RevertManager (atomic write/read of revert JSON files)│ │ ├── System/ # RegistryWatcher (+ IRegistryWatcher), SystemInfoService,│ │ │ # StreamService, UpdaterService, CrossPageEventBus│ │ └── UI/ # BloatwareService, DiskCleanupService, StartupManagerService│ │-│ ├── UI/ # WPF sayfaları, ViewModel'ler, kontroller, stiller+│ ├── UI/ # WPF pages, ViewModels, controls, styles│ │ ├── Behaviors/ # SmoothScrollBehavior│ │ ├── Controls/ # FilledNavigationViewItem, EmptyBadge│ │ ├── Dialogs/ # ProcessingDialog, OptimizationDetailsDialog,-│ │ │ # OptimizationResultDialog, RestorePointDialog, LegalDialog,-│ │ │ # BloatwareConfirmationDialog, ScheduledTask diyalogları, ...+│ │ │ # OptimizationResultDialog, RestorePointDialog, LegalDialog (+ ViewModel),+│ │ │ # BloatwareConfirmationDialog, ScheduledTask dialogs, ...│ │ ├── Pages/ # Dashboard, Optimize, Customize, Settings, Bloatware,-│ │ │ ├── Customize/ # CustomizePage + Categories/ (otomatik kayıtlı sayfalar)-│ │ │ ├── Optimize/ # OptimizePage + Categories/ (otomatik kayıtlı sayfalar)+│ │ │ ├── Customize/ # CustomizePage + Categories/ (auto-registered pages)+│ │ │ ├── Optimize/ # OptimizePage + Categories/ (auto-registered pages)│ │ │ ├── DiskCleanupPage│ │ │ ├── StartupManagerPage│ │ │ └── ScheduledTasksPage│ │ ├── Styles/ # FluentDesign.xaml, NavigationViewOverride.xaml, ToolTipOverride.xaml-│ │ ├── ViewModels/ # Sayfa, diyalog ve pencere ViewModel'leri+│ │ ├── ViewModels/ # Page, dialog and window ViewModels+│ │ │ ├── Dialogs/ # LegalDialogViewModel (transient, runtime language/theme)+│ │ │ ├── Pages/ # DashboardViewModel, SettingsViewModel, ...│ │ └── Windows/ # MainWindow│ │-│ └── Resources/ # Resimler, gömülü dosyalar, yerelleştirme-│ ├── Embedded/ # Icons/ ve PowerPlans/ (optimizerDuck.pow)-│ ├── Images/ # Duck.png, GitHub logoları, Discord logosu-│ └── Languages/ # Translations.resx (varsayılan) + yerel ayar sürümleri+│ └── Resources/ # Images, embedded assets, localization+│ ├── Embedded/ # Icons/ and PowerPlans/ (optimizerDuck.pow)+│ ├── Images/ # Duck.png, GitHub logos, Discord logo+│ └── Languages/ # Translations.resx (default) + locale variants│-└── optimizerDuck.Test/ # xUnit v3 test projesi (InternalsVisibleTo)+└── optimizerDuck.Test/ # xUnit v3 test project (InternalsVisibleTo)```> **Yukarıdaki ağacı katı bir referans olarak almayın.** Bu bir haritadır, şartname değildir — klasörler ve dosyalar gelişir. Şüpheye düştüğünüzde gerçek klasörlere bakın. Bu bölümün sonundaki [Proje Yapısı](#project-structure) notuna da bakın.@@ -856,27 +858,31 @@ Yeni bir sayfa veya araç eklemek istiyorsanız (örn. bir "Ağ Monitörü"):2. **Uygulama sırası**:```csharp-// 1. Hizmet katmanı: Services/UI veya Services/System/YourService.cs+// 1. Service layer in Services/UI or Services/System/YourService.cspublic class YourService(ILogger<YourService> logger) { ... }-// 2. ViewModel: UI/ViewModels/Pages/YourViewModel.cs-// ViewModel'i genişletir (ObservableValidator + INavigationAware)+// 2. ViewModel in UI/ViewModels/Pages/YourViewModel.cs+// Extends ViewModel (which extends ObservableValidator + INavigationAware)-// 3. XAML Sayfası: UI/Pages/YourPage.xaml (+ kod arkası)+// 3. XAML Page in UI/Pages/YourPage.xaml (+ code-behind)-// 4. App.xaml.cs'e singleton olarak kaydet+// 4. Register as singletons in App.xaml.csservices.AddSingleton<YourViewModel>();services.AddSingleton<YourPage>();++// 4b. Dialogs are transient (fresh instance per show, supports runtime language/theme)+services.AddTransient<YourDialogViewModel>();+services.AddTransient<YourDialog>();```-- ViewModel'ler ve Sayfalar `App.xaml.cs` içinde **singleton olarak kaydedilmelidir**.-- Gezinme WPF UI (`INavigationService`) tarafından yönetilir.-- Mevcut desenleri izleyin — `DashboardPage`, `OptimizePage`, `BloatwarePage`, `DiskCleanupPage`, `ScheduledTasksPage`, `StartupManagerPage` vb.'ye bakın.+- ViewModel'ler ve Sayfalar `App.xaml.cs` içinde **singleton olarak kaydedilmelidir**. Diyaloglar **transient olmalıdır**.+- Gezinme WPF UI (`INavigationService`) tarafından yönetilir. Diyaloglar `App.AppHost.Services.GetRequiredService<T>()` ile çözülür (`MainWindow.xaml.cs` → `LegalDialog`'a bakın).+- Mevcut desenleri izleyin — `DashboardPage`, `OptimizePage`, `BloatwarePage`, `DiskCleanupPage`, `ScheduledTasksPage`, `StartupManagerPage` ve `LegalDialog` (ViewModel + transient kaydı) vb.'ye bakın.<h3 id="di-registration-pattern">DI Kayıt Deseni (App.xaml.cs'ten)</h3>```csharp-// Sayfalar + ViewModel'ler — özellik başına bir çift+// Sayfalar + ViewModel'ler — özellik başına bir çift (singleton)services.AddSingleton<DashboardViewModel>();services.AddSingleton<DashboardPage>();@@ -898,6 +904,10 @@ services.AddSingleton<StartupManagerPage>();services.AddSingleton<ScheduledTasksViewModel>();services.AddSingleton<ScheduledTasksPage>();+// Diyaloglar — transient (her gösterimde taze örnek)+services.AddTransient<LegalDialogViewModel>();+services.AddTransient<LegalDialog>();+// Customizeservices.AddSingleton<CustomizeViewModel>();services.AddSingleton<CustomizePage>();@@ -923,7 +933,7 @@ services.AddSingleton<UpdaterService>();services.AddSingleton<IRegistryWatcher, RegistryWatcher>();```-> Bu, oryantasyon için bir anlık görüntüdür — güncel kayıtlar için `App.xaml.cs` kaynaktır. Ayrıca başlangıç çağrılarına dikkat edin: `ShellService.Init(appOptionsMonitor)` ve `WmiHelper.Initialize()`.+> Bu, oryantasyon için bir anlık görüntüdür — güncel kayıtlar için `App.xaml.cs` kaynaktır. Ayrıca başlangıç çağrılarına dikkat edin: `ShellService.Init(appOptionsMonitor)` ve `WmiHelper.Initialize()`, ve transient diyalogları çözmek için kullanılan `App.AppHost` özelliği.<h3 id="system-services">Sistem Hizmetleri Referansı</h3>@@ -1202,20 +1212,44 @@ Kullanıcıya dönük tüm dizeler `Resources/Languages/Translations.resx` (İng<h3 id="available-locales-tr">Mevcut Yerel Ayar</h3>-Uygulama **15'ten fazla dil** ile gelir ve liste büyümeye devam eder. Burada listelemek (bayatlayacağı için) yerine şunlara bakın:+Uygulama **17 dil** ile gelir ve liste büyümeye devam eder. Burada listelemek yerine şunlara bakın:- **Yerel ayar dosyalarının kendisi**: `optimizerDuck/Resources/Languages/` — her dil için bir `Translations.{locale}.resx`, İngilizce varsayılan olarak da `Translations.resx`.-- **Kayıt listesi**: `UI/ViewModels/Pages/SettingsViewModel.cs` içindeki `Languages` — UI'da gösterilen dillerin yetkili listesidir.+- **Tek doğruluk kaynağı**: `Domain/UI/SupportedLanguages.cs` — `SupportedLanguages.All` UI'da gösterilen dillerin yetkili listesidir (`SettingsViewModel` ve `LegalDialogViewModel` tarafından kullanılır). Listeyi çoğaltmayın.<h3 id="adding-a-new-language-tr">Yeni Dil Ekleme</h3>1. `Translations.{locale}.resx` (örn. `Translations.de-DE.resx`) dosyasını, `Translations.resx` ile aynı tüm anahtarlarla oluşturun.-2. Dili `UI/ViewModels/Pages/SettingsViewModel.cs` içine kaydedin:+2. Dili `Domain/UI/SupportedLanguages.cs` içine kaydedin:```csharpnew() { DisplayName = "Deutsch", Culture = new CultureInfo("de-DE") },```+Settings ve diyaloglar `SupportedLanguages.All` üzerinden otomatik olarak alır — başka dosyayı güncellemeye gerek yok.++<h3 id="runtime-language-switching-tr">Çalışma Anında Dil Değiştirme</h3>++Uygulama yeniden başlatmadan dil değiştirmeyi destekler (`Loc.Instance.ChangeCulture`). En iyi uygulamalar:++- Çalışma anında güncellenmesi gereken C# dizeleri için `Loc.Instance["Key"]` veya `Loc.Instance["Key", arg0, arg1]` (dahili olarak `string.Format`) kullanın.+- Seçimi `ConfigManager.SetAsync(x => x.App.Language, cultureName)` ile kalıcılaştırın ve fire-and-forget + hata durumunda geri alma desenini kullanın (`SettingsViewModel` ve `LegalDialogViewModel`'e bakın).+- Dil değişirken açık kalan diyaloglar için `ContentDialog` özelliklerini `Loc.Instance`'a bağlayın, böylece başlık/düğmeler canlı güncellenir:++```csharp+dialog.SetBinding(ContentDialog.TitleProperty,+ new Binding("[LegalDialog.Title]") { Source = Loc.Instance, Mode = BindingMode.OneWay });+dialog.SetBinding(ContentDialog.PrimaryButtonTextProperty,+ new Binding("[Button.Accept]") { Source = Loc.Instance, Mode = BindingMode.OneWay });+```++- Dil seçici için `SupportedLanguages.All`'ı yeniden kullanın (`ComboBox` içinde `DisplayMemberPath="DisplayName"`, `SelectedValuePath="Culture.Name"`, `SelectedValue="{Binding SelectedCultureName}"`).+- İngilizcenin en doğru olduğuna dair ipucu gösterin: `LegalDialog.Language.Tip` / `LegalDialog.Theme.Tip` — `Caption` + `Italic` + `TextFillColorTertiaryBrush`.++<h3 id="dialog-localization-tr">Diyalog Yerelleştirmesi</h3>++`LegalDialog` gibi diyaloglar `Transient`'tir ve her gösterimde `ViewModel` yeniden oluşturulur. `InitializeOnceAsync` içinde mevcut `App.Language`/`App.Theme`'i yükler ve `SelectedCultureName`/`CurrentApplicationTheme`'i iki yönlü bağlama için sunar. Tema `ApplicationThemeManager.Apply` + `ThemeToIndexConverter`, GitHub ikonu `ThemeToGitHubIconConverter` ile açık/koyu varlıkları değiştirir.+<h3 id="hardcoded-string-rule-tr">Sabit Dize Kuralı</h3>**Asla dize sabit kodlamayın**. Her zaman şunları kullanın:@@ -1224,8 +1258,8 @@ new() { DisplayName = "Deutsch", Culture = new CultureInfo("de-DE") },// Güçlü tipli (önerilir)string title = Translations.Features_Desktop_Name;-// Biçim argümanlarıyla-string msg = string.Format(Translations.Dashboard_SystemInfo_Storage_DiskInfo, used, total, percent);+// Biçim argümanlarıyla — string.Format yerine Loc indeksini tercih edin+string msg = Loc.Instance["Dashboard.SystemInfo.Storage.DiskInfo", used, total, percent];// Dinamik anahtar arama (kural tabanlı anahtarlar için)string title = Loc.Instance[$"Optimizer.{category}.{key}.Name"];@@ -1239,6 +1273,9 @@ XAML içinde:<!-- Bağlı argümanlarla --><ui:TextBlock Text="{ext:Loc Dashboard.UpdateInfoBar.Message, {Binding ViewModel.LatestVersion}}" />++<!-- Canlı diyalog bağlaması (Loc değiştiğinde güncellenir) -->+<ui:TextBlock Text="{ext:Loc LegalDialog.Intro.Title}" />```---diff --git a/CONTRIBUTING.md b/CONTRIBUTING.mdindex a2072b5..b1bc822 100644--- a/CONTRIBUTING.md+++ b/CONTRIBUTING.md@@ -149,13 +149,13 @@ optimizerDuck.slnx # Solution file (.slnx format)│ │ ├── Revert/ # RevertData, RevertResult, revert step types│ │ │ └── Steps/ # RegistryRevertStep, ServiceRevertStep,│ │ │ # ScheduledTaskRevertStep, ShellRevertStep, UsbPowerRevertStep-│ │ └── UI/ # Enums: OptimizationRisk, OptimizationTags,+│ │ └── UI/ # Enums & helpers: OptimizationRisk, OptimizationTags,│ │ # OptimizationCategoryOrder, CustomizeOrder,-│ │ # LanguageOption, OptimizationState, RiskVisual,-│ │ # ProcessingProgress, ...+│ │ # LanguageOption, SupportedLanguages (single source of truth, 17 locales),+│ │ # OptimizationState, RiskVisual, ProcessingProgress, ...│ ││ ├── Common/ # Shared helpers, extensions, converters-│ │ ├── Converters/ # WPF value converters (BooleanToVisibility, MBToGB, ...)+│ │ ├── Converters/ # WPF value converters (BooleanToVisibility, MBToGB, ThemeToIndexConverter, ThemeToGitHubIconConverter, ...)│ │ ├── Extensions/ # StringExtensions, page-registry extensions,│ │ │ # LanguageExtensions│ │ └── Helpers/ # Shared.cs, ReflectionHelper.cs, SystemRefreshService.cs,@@ -178,7 +178,7 @@ optimizerDuck.slnx # Solution file (.slnx format)│ │ ├── Behaviors/ # SmoothScrollBehavior│ │ ├── Controls/ # FilledNavigationViewItem, EmptyBadge│ │ ├── Dialogs/ # ProcessingDialog, OptimizationDetailsDialog,-│ │ │ # OptimizationResultDialog, RestorePointDialog, LegalDialog,+│ │ │ # OptimizationResultDialog, RestorePointDialog, LegalDialog (+ ViewModel),│ │ │ # BloatwareConfirmationDialog, ScheduledTask dialogs, ...│ │ ├── Pages/ # Dashboard, Optimize, Customize, Settings, Bloatware,│ │ │ ├── Customize/ # CustomizePage + Categories/ (auto-registered pages)@@ -188,6 +188,8 @@ optimizerDuck.slnx # Solution file (.slnx format)│ │ │ └── ScheduledTasksPage│ │ ├── Styles/ # FluentDesign.xaml, NavigationViewOverride.xaml, ToolTipOverride.xaml│ │ ├── ViewModels/ # Page, dialog and window ViewModels+│ │ │ ├── Dialogs/ # LegalDialogViewModel (transient, runtime language/theme)+│ │ │ ├── Pages/ # DashboardViewModel, SettingsViewModel, ...│ │ └── Windows/ # MainWindow│ ││ └── Resources/ # Images, embedded assets, localization@@ -846,8 +848,6 @@ Setting toggle → BaseCustomizeSetting.ApplyAsync(value)If you override `ApplyAsync`, you **must** call `await ExecutePostActionAsync()` yourself (see the examples above). The base class only does this automatically when using the default `RegistryToggles`-based or dropdown-binding-based apply.-----# Building New FeaturesIf you want to add a new page or tool (e.g., a "Network Monitor"):@@ -867,16 +867,20 @@ public class YourService(ILogger<YourService> logger) { ... }// 4. Register as singletons in App.xaml.csservices.AddSingleton<YourViewModel>();services.AddSingleton<YourPage>();++// 4b. Dialogs are transient (fresh instance per show, supports runtime language/theme)+services.AddTransient<YourDialogViewModel>();+services.AddTransient<YourDialog>();```-- ViewModels and Pages **must** be registered as singletons in `App.xaml.cs`.-- Navigation is handled by WPF UI (`INavigationService`).-- Follow the existing patterns — check `DashboardPage`, `OptimizePage`, `BloatwarePage`, `DiskCleanupPage`, `ScheduledTasksPage`, `StartupManagerPage`, etc.+- ViewModels and Pages **must** be registered as singletons in `App.xaml.cs`. Dialogs **must** be transient.+- Navigation is handled by WPF UI (`INavigationService`). Dialogs are resolved via `App.AppHost.Services.GetRequiredService<T>()` (see `MainWindow.xaml.cs` → `LegalDialog`).+- Follow the existing patterns — check `DashboardPage`, `OptimizePage`, `BloatwarePage`, `DiskCleanupPage`, `ScheduledTasksPage`, `StartupManagerPage`, and `LegalDialog` (ViewModel + transient registration) etc.### DI Registration Pattern (from App.xaml.cs)```csharp-// Pages + ViewModels — one pair per feature+// Pages + ViewModels — one pair per feature (singletons)services.AddSingleton<DashboardViewModel>();services.AddSingleton<DashboardPage>();@@ -898,6 +902,10 @@ services.AddSingleton<StartupManagerPage>();services.AddSingleton<ScheduledTasksViewModel>();services.AddSingleton<ScheduledTasksPage>();+// Dialogs — transient (fresh instance per show)+services.AddTransient<LegalDialogViewModel>();+services.AddTransient<LegalDialog>();+// Customizeservices.AddSingleton<CustomizeViewModel>();services.AddSingleton<CustomizePage>();@@ -923,7 +931,7 @@ services.AddSingleton<UpdaterService>();services.AddSingleton<IRegistryWatcher, RegistryWatcher>();```-> This is a snapshot for orientation — `App.xaml.cs` is the source of truth for the current registrations. Also note the startup calls: `ShellService.Init(appOptionsMonitor)` and `WmiHelper.Initialize()`.+> This is a snapshot for orientation — `App.xaml.cs` is the source of truth for the current registrations. Also note the startup calls: `ShellService.Init(appOptionsMonitor)` and `WmiHelper.Initialize()`, and the exposed `App.AppHost` property used to resolve transient dialogs.### System Services Reference@@ -1202,20 +1210,44 @@ All user-facing strings live in `Resources/Languages/Translations.resx` (the Eng### Available Locales-The app ships with **more than 15 languages**, and the list keeps growing. Instead of listing them here (which would go stale), check:+The app ships with **17 languages** and the list keeps growing. Instead of listing them here (which would go stale), check:- **The locale files themselves**: `optimizerDuck/Resources/Languages/` — one `Translations.{locale}.resx` per language, plus `Translations.resx` as the English default.-- **The registration list**: `Languages` in `UI/ViewModels/Pages/SettingsViewModel.cs` — this is the authoritative list of languages shown in the UI.+- **The single source of truth**: `Domain/UI/SupportedLanguages.cs` — `SupportedLanguages.All` is the authoritative list shown in the UI (used by `SettingsViewModel` and `LegalDialogViewModel`). Do not duplicate the list.### Adding a New Language1. Create `Translations.{locale}.resx` (e.g., `Translations.de-DE.resx`) with all the same keys as `Translations.resx`.-2. Register the language in `UI/ViewModels/Pages/SettingsViewModel.cs`:+2. Register the language in `Domain/UI/SupportedLanguages.cs`:```csharpnew() { DisplayName = "Deutsch", Culture = new CultureInfo("de-DE") },```+Settings and dialogs automatically pick it up via `SupportedLanguages.All` — no other file needs updating.++### Runtime Language Switching++The app supports switching language without restart (`Loc.Instance.ChangeCulture`). Best practices:++- Use `Loc.Instance["Key"]` or `Loc.Instance["Key", arg0, arg1]` (which internally does `string.Format`) for C# strings that must update at runtime.+- Persist the choice via `ConfigManager.SetAsync(x => x.App.Language, cultureName)` with a fire-and-forget + revert-on-failure pattern (see `SettingsViewModel` and `LegalDialogViewModel`).+- For dialogs that stay open while language changes, bind `ContentDialog` properties to `Loc.Instance` so the title/buttons update live:++```csharp+dialog.SetBinding(ContentDialog.TitleProperty,+ new Binding("[LegalDialog.Title]") { Source = Loc.Instance, Mode = BindingMode.OneWay });+dialog.SetBinding(ContentDialog.PrimaryButtonTextProperty,+ new Binding("[Button.Accept]") { Source = Loc.Instance, Mode = BindingMode.OneWay });+```++- Reuse `SupportedLanguages.All` for the language picker (`ComboBox` with `DisplayMemberPath="DisplayName"`, `SelectedValuePath="Culture.Name"`, `SelectedValue="{Binding SelectedCultureName}"`).+- Show a subtle tip that English is most accurate: `LegalDialog.Language.Tip` / `LegalDialog.Theme.Tip` — `Caption` + `Italic` + `TextFillColorTertiaryBrush`.++### Dialog Localization++Dialogs like `LegalDialog` are `Transient` and recreate their `ViewModel` per show. They load the current `App.Language`/`App.Theme` in `InitializeOnceAsync` and expose `SelectedCultureName`/`CurrentApplicationTheme` for two-way binding. Theme uses `ApplicationThemeManager.Apply` + `ThemeToIndexConverter`; GitHub icon uses `ThemeToGitHubIconConverter` for light/dark assets.+### Hardcoded String Rule**Never hardcode strings**. Always use:@@ -1224,8 +1256,8 @@ new() { DisplayName = "Deutsch", Culture = new CultureInfo("de-DE") },// Strongly typed (recommended)string title = Translations.Features_Desktop_Name;-// With format args-string msg = string.Format(Translations.Dashboard_SystemInfo_Storage_DiskInfo, used, total, percent);+// With format args — prefer Loc indexer over string.Format+string msg = Loc.Instance["Dashboard.SystemInfo.Storage.DiskInfo", used, total, percent];// Dynamic key lookup (for convention-based keys)string title = Loc.Instance[$"Optimizer.{category}.{key}.Name"];@@ -1239,6 +1271,9 @@ In XAML:<!-- With bound args --><ui:TextBlock Text="{ext:Loc Dashboard.UpdateInfoBar.Message, {Binding ViewModel.LatestVersion}}" />++<!-- Live dialog binding (updates when Loc changes) -->+<ui:TextBlock Text="{ext:Loc LegalDialog.Intro.Title}" />```---