32 lines
1.6 KiB
Markdown
32 lines
1.6 KiB
Markdown
---
|
|
source_files:
|
|
- DTS Viewer/DTS.Viewer.Modules/DTS.Viewer.TestModification/Resources/TranslateExtension.cs
|
|
- DTS Viewer/DTS.Viewer.Modules/DTS.Viewer.TestModification/Resources/StringResources.Designer.cs
|
|
generated_at: "2026-04-17T15:55:56.221210+00:00"
|
|
model: "zai-org/GLM-5-FP8"
|
|
schema_version: 1
|
|
sha256: "9f4954f34f258eac"
|
|
---
|
|
|
|
# Documentation: DTS.Viewer.TestModification.Resources
|
|
|
|
## 1. Purpose
|
|
|
|
This module provides localization infrastructure for the DTS Viewer TestModification feature. It combines a WPF XAML markup extension (`TranslateExtension`) with an auto-generated strongly-typed resource accessor (`StringResources`) to enable declarative string localization in XAML views. The module abstracts .NET resource management behind a simple key-based lookup system that gracefully handles missing resources by returning visible error indicators rather than throwing exceptions.
|
|
|
|
---
|
|
|
|
## 2. Public Interface
|
|
|
|
### TranslateExtension (class)
|
|
|
|
**Namespace:** `DTS.Viewer.TestModification`
|
|
|
|
A WPF markup extension for use in XAML bindings to retrieve localized strings at runtime.
|
|
|
|
| Member | Signature | Description |
|
|
|--------|-----------|-------------|
|
|
| Constructor | `TranslateExtension(string key)` | Initializes the extension with the resource key to look up. The `key` parameter is stored in a readonly field. |
|
|
| ProvideValue | `override object ProvideValue(IServiceProvider serviceProvider)` | Returns the localized string for the stored key. Returns `#stringnotfound#` if key is null or empty. Returns `#stringnotfound# <key>` if the resource lookup returns null. |
|
|
|
|
### StringResources (internal |