Files
DP44/docs/ai/DTS Viewer/DTS.Viewer.Modules/DTS.Viewer.Navigation/View.md
2026-04-17 14:55:32 -04:00

39 lines
2.1 KiB
Markdown

---
source_files:
- DTS Viewer/DTS.Viewer.Modules/DTS.Viewer.Navigation/View/NavigationItem.xaml.cs
- DTS Viewer/DTS.Viewer.Modules/DTS.Viewer.Navigation/View/NavigationView.xaml.cs
generated_at: "2026-04-17T16:11:50.604475+00:00"
model: "zai-org/GLM-5-FP8"
schema_version: 1
sha256: "6747a61a8fe21d2c"
---
# View
### Purpose
This module provides localization/internationalization support for the DTS.Viewer.Filter module. It enables XAML-based string resource lookup through a markup extension pattern, allowing UI elements to display localized strings at design-time and runtime without code-behind resource lookups.
### Public Interface
**`TranslateExtension` class** (inherits `MarkupExtension`)
- `TranslateExtension(string key)` - Constructor accepting the resource key to look up.
- `object ProvideValue(IServiceProvider serviceProvider)` - Returns the localized string for `_key`, or a fallback error string if not found.
- Constant: `NotFound = "#stringnotfound#"` - Fallback prefix used when resource lookup fails.
**`StringResources` class** (internal, auto-generated)
- `static ResourceManager ResourceManager { get; }` - Lazily-initialized, cached ResourceManager for the `DTS.Viewer.Filter.Resources.StringResources` resource bundle.
- `static CultureInfo Culture { get; set; }` - Overrides the current thread's CurrentUICulture for resource lookups.
- `static string Search { get; }` - Localized string resource for "Search".
### Invariants
- `ProvideValue` always returns a non-null string.
- If `_key` is null or empty, `ProvideValue` returns exactly `NotFound` ("#stringnotfound#").
- If the resource key does not exist in the resource bundle, `ProvideValue` returns `NotFound + " " + _key` (e.g., "#stringnotfound# MissingKey").
- `ResourceManager` is lazily instantiated on first access and cached thereafter.
### Dependencies
- **Depends on**: `System`, `System.Windows.Markup`, `System.Resources`, `System.Globalization`.
- **Depended on by**: XAML views within the DTS.Viewer.Filter module that use `{local:Translate KeyName}` syntax.
### Gotchas
- `StringResources`