init
This commit is contained in:
@@ -0,0 +1,48 @@
|
||||
---
|
||||
source_files:
|
||||
- DTS Viewer/DTS.Viewer.Reports/DTS.Viewer.PSDReportResults/Resources/TranslateExtension.cs
|
||||
- DTS Viewer/DTS.Viewer.Reports/DTS.Viewer.PSDReportResults/Resources/StringResources.Designer.cs
|
||||
generated_at: "2026-04-17T16:12:01.658855+00:00"
|
||||
model: "zai-org/GLM-5-FP8"
|
||||
schema_version: 1
|
||||
sha256: "fda3169cc98a4753"
|
||||
---
|
||||
|
||||
# Resources
|
||||
|
||||
### Purpose
|
||||
This module provides localization support for the PSD (Power Spectral Density) Report Results component within the DTS Viewer application. It exists to enable XAML-based string lookup for UI elements, allowing the report results 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 results.
|
||||
|
||||
### 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.PSDReportResults.Resources.StringResources` resource bundle.
|
||||
- `static CultureInfo Culture { get; set; }` - Gets or sets the current thread's `CurrentUICulture` for resource lookups.
|
||||
- `static string ChannelName { get; }` - Localized string "Name".
|
||||
- `static string ExportPSDHeader { get; }` - Localized string "Export".
|
||||
- `static string ExportPSDtoCSV { get; }` - Localized string "Export PSD to CSV".
|
||||
- `static string ExportPSDtoPDF { get; }` - Localized string "Export PSD to PDF".
|
||||
- `static string GRMS { get; }` - Localized string "GRMS".
|
||||
- `static string PSDResultsHeader { get; }` - Localized string "Results".
|
||||
- `static string SampleRate { get; }` - Localized string "Sample Rate".
|
||||
|
||||
### 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.PSDReportResults` 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.PSDReportResults` but references `DTS.Viewer.PSDReportResults.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.
|
||||
|
||||
---
|
||||
Reference in New Issue
Block a user