6.8 KiB
source_files, generated_at, model, schema_version, sha256
| source_files | generated_at | model | schema_version | sha256 | ||
|---|---|---|---|---|---|---|
|
2026-04-16T11:00:37.156668+00:00 | zai-org/GLM-5-FP8 | 1 | 5a446a4aa0389800 |
Documentation: DTS.Viewer.PSDReportSettings.Resources
1. Purpose
This module provides localization/translation infrastructure for the PSD (Power Spectral Density) Report Settings UI within the DTS Viewer application. It consists of a WPF XAML markup extension (TranslateExtension) that enables declarative resource binding in XAML, and a strongly-typed auto-generated resource accessor class (StringResources) containing localized strings for filter configurations, window settings, envelope display options, and export functionality.
2. Public Interface
TranslateExtension (class)
Namespace: DTS.Viewer.PSDReportSettings
Inheritance: MarkupExtension
Attribute: [MarkupExtensionReturnType(typeof(string))]
A WPF markup extension that resolves localization keys to localized strings at XAML parse time.
| Member | Signature | Description |
|---|---|---|
| Constructor | TranslateExtension(string key) |
Initializes the extension with the resource key to look up. The key is stored in a readonly field _key. |
| Method | object ProvideValue(IServiceProvider serviceProvider) |
Returns the localized string for _key from StringResources.ResourceManager. Returns #stringnotfound# if _key is null or empty. Returns #stringnotfound# <key> if the key does not exist in the resource file. |
StringResources (class)
Namespace: DTS.Viewer.PSDReportSettings.Resources
Access: internal
Attribute: [GeneratedCode], [DebuggerNonUserCode], [CompilerGenerated]
An auto-generated strongly-typed resource accessor class. Not publicly accessible outside the assembly.
| Member | Signature | Description |
|---|---|---|
| Property | static ResourceManager ResourceManager |
Lazily-initialized cached ResourceManager instance for the DTS.Viewer.PSDReportSettings.Resources.StringResources resource bundle. |
| Property | static CultureInfo Culture |
Gets or sets the current UI culture for resource lookups. Overrides Thread.CurrentUICulture for this resource class. |
Localized String Properties (all internal static string):
| Property Name | Default Value (English) | Context |
|---|---|---|
EnvelopeHeader |
"Envelope" | UI header |
ExportPSDHeader |
"Export" | UI header |
ExportPSDtoCSV |
"Export PSD to CSV" | Export action |
ExportPSDtoPDF |
"Export PSD to PDF" | Export action |
FilterCenterFrequency |
"Center frequency" | Filter setting label |
FilterOrder |
"Filter order" | Filter setting label |
FilterSettingsHeader |
"Filters" | UI header |
FilterType |
"Filter type" | Filter setting label |
FilterType_Bessel |
"Bessel" | Filter type enum value |
FilterType_Butterworth |
"Butterworth" | Filter type enum value |
FilterType_LinkwitzRiley |
"Linkwitz-Riley" | Filter type enum value |
HighPassFilter |
"High pass filter" | Filter type |
Hz |
"Hz" | Unit label |
LowPassFilter |
"Low pass filter" | Filter type |
PSDSettingsHeader |
"PSD settings" | UI header |
ShowEnvelope |
"Show Envelope" | Checkbox/toggle label |
WindowAveragingType |
"Averaging type" | Window setting label |
WindowOverlappingPercent |
"Overlapping %" | Window setting label |
WindowSettingsHeader |
"Window" | UI header |
WindowType |
"Window type" | Window setting label |
WindowWidth |
"Window width" | Window setting label |
3. Invariants
-
Key immutability: The
_keyfield inTranslateExtensionisreadonlyand set only at construction time. -
Fallback behavior:
ProvideValuewill never returnnull. It returns the constant"#stringnotfound#"for null/empty keys, or"#stringnotfound# <key>"for missing resource entries. -
ResourceManager singleton: The
ResourceManagerproperty uses lazy initialization with a null-check pattern; once initialized, the same instance is returned for all subsequent calls. -
Thread-safety of ResourceManager: The lazy initialization in
StringResources.ResourceManageris not thread-safe (uses simple null check without locking). Concurrent access during first initialization could potentially create multiple ResourceManager instances. -
Internal visibility:
StringResourcesis markedinternal, restricting access to within theDTS.Viewer.PSDReportSettingsassembly.
4. Dependencies
This module depends on:
System(core types)System.Windows.Markup(MarkupExtension,MarkupExtensionReturnTypeAttribute)System.Resources(ResourceManager)System.Globalization(CultureInfo)System.CodeDom.Compiler(GeneratedCodeAttribute)System.Diagnostics(DebuggerNonUserCodeAttribute)System.Runtime.CompilerServices(CompilerGeneratedAttribute)
External resource dependency:
- A
.resxfile (not shown in source) namedStringResources.resxmust exist in theDTS.Viewer.PSDReportSettings.Resourcesnamespace to provide the actual localized values.
What depends on this module:
- Unclear from source alone. The
TranslateExtensionis designed for XAML consumption within the PSD Report Settings UI, but the specific XAML files or controls using it are not present in the provided source.
5. Gotchas
-
Auto-generated code warning:
StringResources.Designer.csis tool-generated. Manual edits will be overwritten when the resource file is regenerated. The source explicitly warns: "Changes to this file may cause incorrect behavior and will be lost if the code is regenerated." -
Missing key visibility: Missing localization keys result in visible error strings (
#stringnotfound#) appearing in the UI rather than silent failures or exceptions. This is intentional for debugging but could leak into production if resource files are incomplete. -
Thread-safety gap: The
ResourceManagerproperty getter performs a non-atomic check-then-assign pattern (if (object.ReferenceEquals(resourceMan, null))). Under concurrent access, multipleResourceManagerinstances could be created, though the functional impact is likely minimal. -
Culture must be set explicitly: The
StringResources.Cultureproperty allows overriding the current thread's UI culture, but it must be set manually. If never set,resourceCultureremainsnullandResourceManager.GetStringusesThread.CurrentUICulture. -
No design-time validation: The
TranslateExtensionconstructor accepts any string key without validation. Typos in XAML will only manifest as#stringnotfound#at runtime.