39 lines
2.1 KiB
Markdown
39 lines
2.1 KiB
Markdown
---
|
|
source_files:
|
|
- DTS Viewer/DTS.Viewer.Modules/DTS.Viewer.ChartOptions/Resources/TranslateExtension.cs
|
|
- DTS Viewer/DTS.Viewer.Modules/DTS.Viewer.ChartOptions/Resources/StringResources.Designer.cs
|
|
generated_at: "2026-04-17T16:11:50.603414+00:00"
|
|
model: "zai-org/GLM-5-FP8"
|
|
schema_version: 1
|
|
sha256: "b9710c66f9ec0c0d"
|
|
---
|
|
|
|
# Resources
|
|
|
|
### 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` |