5.2 KiB
source_files, generated_at, model, schema_version, sha256
| source_files | generated_at | model | schema_version | sha256 | ||
|---|---|---|---|---|---|---|
|
2026-04-16T13:38:43.337295+00:00 | zai-org/GLM-5-FP8 | 1 | 5a446a4aa0389800 |
Documentation: DTS.Viewer.PSDReportSettings.Resources
1. Purpose
This module provides localization infrastructure for the PSD Report Settings UI within the DTS Viewer application. It bridges strongly-typed resource management with WPF XAML data binding. The StringResources class auto-generates access to localized strings (defaulting to English values such as "Envelope" and "Butterworth") for signal processing and export settings, while the TranslateExtension class exposes these resources directly in XAML markup.
2. Public Interface
TranslateExtension (Class)
Namespace: DTS.Viewer.PSDReportSettings
Inheritance: System.Windows.Markup.MarkupExtension
This class allows XAML bindings to retrieve localized strings dynamically.
TranslateExtension(string key)(Constructor)- Initializes the extension with a specific resource key to look up.
ProvideValue(IServiceProvider serviceProvider)(Method)- Returns
object(specifically astring). - Looks up the string value using
StringResources.ResourceManager.GetString(_key). - Returns the localized string if found.
- Returns
#stringnotfound#if the key is null or empty. - Returns
#stringnotfound# [key](appending the key name) if the lookup fails (returns null).
- Returns
StringResources (Class)
Namespace: DTS.Viewer.PSDReportSettings.Resources
Visibility: internal
This is a strongly-typed resource class generated by Visual Studio. It provides static properties to access localized strings.
ResourceManager(Property)- Returns the cached
global::System.Resources.ResourceManagerinstance for this assembly.
- Returns the cached
Culture(Property)- Gets or sets the
global::System.Globalization.CultureInfoused for resource lookups.
- Gets or sets the
- Resource String Properties (Static, read-only)
EnvelopeHeader: "Envelope"ExportPSDHeader: "Export"ExportPSDtoCSV: "Export PSD to CSV"ExportPSDtoPDF: "Export PSD to PDF"FilterCenterFrequency: "Center frequency"FilterOrder: "Filter order"FilterSettingsHeader: "Filters"FilterType: "Filter type"FilterType_Bessel: "Bessel"FilterType_Butterworth: "Butterworth"FilterType_LinkwitzRiley: "Linkwitz-Riley"HighPassFilter: "High pass filter"Hz: "Hz"LowPassFilter: "Low pass filter"PSDSettingsHeader: "PSD settings"ShowEnvelope: "Show Envelope"WindowAveragingType: "Averaging type"WindowOverlappingPercent: "Overlapping %"WindowSettingsHeader: "Window"WindowType: "Window type"WindowWidth: "Window width"
3. Invariants
- Return Type:
TranslateExtension.ProvideValueis decorated with[MarkupExtensionReturnType(typeof(string))], guaranteeing the return object is a string. - Null Safety:
TranslateExtension.ProvideValuewill never return null. It guarantees a string return, defaulting to specific error constants if the key is missing. - Key Requirement:
TranslateExtensionrequires a non-null, non-emptykeyargument in its constructor to function correctly. - Singleton Manager:
StringResources.ResourceManageruses a lazy-initialization pattern to ensure only one instance of the resource manager exists.
4. Dependencies
- Internal Dependencies:
TranslateExtensiondepends entirely onStringResources.ResourceManagerto perform lookups.
- External Frameworks:
System.Windows.Markup: Required forMarkupExtensionandIServiceProvider(WPF).System.Resources: Required forResourceManager.System.Globalization: Required forCultureInfo.
- Build Dependencies:
StringResources.Designer.csis auto-generated. It depends on a corresponding.resxfile (likelyStringResources.resx) existing in the project directory.
5. Gotchas
- Error String Format: If a resource key is passed to
TranslateExtensionbut not found in the.resxfile, the UI will display#stringnotfound# [key]. This differs from the behavior when the key argument itself is null/empty (which returns just#stringnotfound#). - Auto-Generated Code:
StringResources.Designer.cscontains a header warning that manual changes will be lost. Developers must edit the underlying.resxfile to add or modify strings; editing this C# file directly is futile. - Visibility Mismatch:
StringResourcesisinternal, whileTranslateExtensionispublic. Code outside theDTS.Viewer.PSDReportSettingsassembly cannot access the resource strings directly via the class properties, but they can access them via the XAML extension. - Namespace Split:
TranslateExtensionresides inDTS.Viewer.PSDReportSettings, while the resources reside inDTS.Viewer.PSDReportSettings.Resources. This requires theusingdirective present in the source file.