49 lines
3.9 KiB
Markdown
49 lines
3.9 KiB
Markdown
|
|
---
|
||
|
|
source_files:
|
||
|
|
- DTS Viewer/DTS.Viewer.Reports/DTS.Viewer.PSDReport/Resources/TranslateExtension.cs
|
||
|
|
- DTS Viewer/DTS.Viewer.Reports/DTS.Viewer.PSDReport/Resources/StringResources.Designer.cs
|
||
|
|
generated_at: "2026-04-17T16:12:01.659566+00:00"
|
||
|
|
model: "zai-org/GLM-5-FP8"
|
||
|
|
schema_version: 1
|
||
|
|
sha256: "e841c5ffb3f98572"
|
||
|
|
---
|
||
|
|
|
||
|
|
# Resources
|
||
|
|
|
||
|
|
### Purpose
|
||
|
|
This module provides localization support for the PSD (Power Spectral Density) Report component within the DTS Viewer application. It exists to enable XAML-based string lookup for UI elements, allowing the report configuration interface to be localized. The module contains a WPF markup extension for direct XAML binding and a strongly-typed resource class with strings specific to PSD report settings, data selection, and modifications.
|
||
|
|
|
||
|
|
### Public Interface
|
||
|
|
|
||
|
|
**`TranslateExtension` class** (public, inherits `MarkupExtension`)
|
||
|
|
- `TranslateExtension(string key)` - Constructor accepting the resource key to look up.
|
||
|
|
- `override object ProvideValue(IServiceProvider serviceProvider)` - Returns the localized string for the given `_key`. Returns `#stringnotfound#` if the key is null or empty, or `#stringnotfound# <key>` if the resource lookup fails.
|
||
|
|
|
||
|
|
**`StringResources` class** (internal sealed)
|
||
|
|
- `static ResourceManager ResourceManager { get; }` - Returns the cached `ResourceManager` instance for the `DTS.Viewer.PSDReport.Resources.StringResources` resource bundle.
|
||
|
|
- `static CultureInfo Culture { get; set; }` - Gets or sets the current thread's `CurrentUICulture` for resource lookups.
|
||
|
|
- `static string DataHeader { get; }` - Localized string "Data".
|
||
|
|
- `static string DataSelectionHeader { get; }` - Localized string "Data selection".
|
||
|
|
- `static string GraphsDefaultTitle { get; }` - Localized string "Graphs".
|
||
|
|
- `static string ModificationsHeader { get; }` - Localized string "Modify".
|
||
|
|
- `static string PSDHeader { get; }` - Localized string "PSD".
|
||
|
|
- `static string PSDResultsHeader { get; }` - Localized string "Results".
|
||
|
|
- `static string PSDSettingsHeader { get; }` - Localized string "PSD Settings".
|
||
|
|
- `static string SettingsTitle { get; }` - Localized string "Settings".
|
||
|
|
- `static string TestsDefaultTitle { get; }` - Localized string "Tests".
|
||
|
|
|
||
|
|
### Invariants
|
||
|
|
- The `TranslateExtension` class is decorated with `[MarkupExtensionReturnType(typeof(string))]`, guaranteeing it returns a string when used in XAML.
|
||
|
|
- The `ProvideValue` method never returns `null`; it returns a fallback string beginning with `#stringnotfound#` on lookup failure.
|
||
|
|
- The `StringResources.ResourceManager` property lazily initializes exactly once.
|
||
|
|
- All resource string properties in `StringResources` are `internal` and return non-null values if the `.resx` file is properly configured.
|
||
|
|
|
||
|
|
### Dependencies
|
||
|
|
- **Depends on**: `System` (for `IServiceProvider`, `String`), `System.Windows.Markup` (for `MarkupExtension`, `MarkupExtensionReturnTypeAttribute`), `System.Resources` (for `ResourceManager`), `System.Globalization` (for `CultureInfo`).
|
||
|
|
- **Depended on by**: XAML files within `DTS.Viewer.PSDReport` that use `{local:Translate KeyName}` syntax, and any code in that assembly requiring localized strings.
|
||
|
|
|
||
|
|
### Gotchas
|
||
|
|
- The `TranslateExtension` class is defined in namespace `DTS.Viewer.PSDReport` but references `DTS.Viewer.PSDReport.Resources.StringResources`. This namespace structure must be accounted for in XAML namespace declarations.
|
||
|
|
- The `NotFound` constant value `#stringnotfound#` is hardcoded and will appear in the UI if a resource key is missing, which may be visible to end users during development.
|
||
|
|
- The `StringResources.Designer.cs` file is auto-generated; manual changes will be overwritten. Edit the corresponding `.resx` file instead.
|
||
|
|
- The `PSDResultsHeader` resource exists in both `DTS.Viewer.PSDReport.Resources` and `DTS.Viewer.PSDReportResults.Resources` with the same default value "Results". This duplication may indicate shared terminology but could lead to inconsistency if localized differently.
|