5.0 KiB
source_files, generated_at, model, schema_version, sha256
| source_files | generated_at | model | schema_version | sha256 | ||
|---|---|---|---|---|---|---|
|
2026-04-16T11:03:12.267125+00:00 | zai-org/GLM-5-FP8 | 1 | 01cf0d845cbc5765 |
Documentation: DTS.Viewer.PSDReport.Resources
1. Purpose
This module provides localization infrastructure for the DTS.Viewer.PSDReport namespace. It consists of a strongly-typed resource accessor class (StringResources) generated from a .resx file, and a WPF XAML markup extension (TranslateExtension) that allows UI elements to bind directly to localized strings using a key. The module ensures that the report module can present user-facing text in different languages without hardcoding strings in the UI logic.
2. Public Interface
Class: TranslateExtension
Namespace: DTS.Viewer.PSDReport
Inheritance: System.Windows.Markup.MarkupExtension
This class allows XAML bindings to retrieve localized strings declaratively.
- Constructor:
TranslateExtension(string key)- Initializes the extension with the resource key to be looked up.
- Method:
ProvideValue(IServiceProvider serviceProvider)- Return Type:
object(attributed to returnstring) - Behavior: Looks up the provided
_keyviaStringResources.ResourceManager. Returns the localized string if found. If the key is null or empty, it returns the constant"#stringnotfound#". If the lookup fails (returns null), it returns"#stringnotfound# "appended with the missing key name.
- Return Type:
Class: StringResources
Namespace: DTS.Viewer.PSDReport.Resources
Accessibility: internal
This is a strongly-typed, auto-generated resource class for looking up culture-specific strings.
- Property:
ResourceManager(static,System.Resources.ResourceManager)- Returns the cached
ResourceManagerinstance for this assembly. It is lazily initialized upon first access.
- Returns the cached
- Property:
Culture(static,System.Globalization.CultureInfo)- Gets or sets the current UI culture used for resource lookups. This overrides the current thread's
CurrentUICulturefor resource lookups via this class.
- Gets or sets the current UI culture used for resource lookups. This overrides the current thread's
- Resource Accessors (static,
string)- The following properties return localized strings corresponding to their keys:
DataHeader("Data")DataSelectionHeader("Data selection")GraphsDefaultTitle("Graphs ")ModificationsHeader("Modify")PSDHeader("PSD")PSDResultsHeader("Results")PSDSettingsHeader("PSD Settings")SettingsTitle("Settings")TestsDefaultTitle("Tests ")
- The following properties return localized strings corresponding to their keys:
3. Invariants
- Fallback Behavior:
TranslateExtension.ProvideValuewill never returnnull. It guarantees a string return, defaulting to the literal"#stringnotfound#"(with optional key suffix) for missing or invalid keys. - Auto-generation:
StringResourcesis auto-generated. Manual modifications toStringResources.Designer.cswill be lost upon regeneration. The source of truth is the corresponding.resxfile. - Internal Visibility:
StringResourcesis markedinternal, restricting access to within theDTS.Viewer.PSDReportassembly. - Thread Safety: The
ResourceManagerproperty inStringResourcesuses a standard lazy initialization check (object.ReferenceEquals(resourceMan, null)). While standard for generated code, it is not strictly thread-safe in a race condition scenario (though usually harmless for resource managers).
4. Dependencies
- Internal Dependencies:
TranslateExtensiondepends onStringResources(specificallyStringResources.ResourceManager) to perform lookups.
- External Framework Dependencies:
System.Windows.Markup: Required forMarkupExtensionandMarkupExtensionReturnTypeAttribute(implies a dependency on WPF/WindowsBase).System.Resources: Required forResourceManager.System.Globalization: Required forCultureInfo.
5. Gotchas
- Dynamic vs. Strongly-typed Access:
TranslateExtensionusesResourceManager.GetString(dynamic lookup by string) rather than the strongly-typed properties (e.g.,StringResources.DataHeader). This means typos in XAML keys will not cause compile-time errors but will result in the"#stringnotfound#"fallback string appearing in the UI at runtime. - Missing Source File: The actual translation values (key-value pairs) reside in a
.resxfile (e.g.,StringResources.resx) which is not included in the provided source. The default English values shown in the XML comments (e.g., "Data", "Graphs ") are the only insight into the actual content. - Trailing Spaces: The default values for
GraphsDefaultTitle("Graphs ") andTestsDefaultTitle("Tests ") appear to contain trailing spaces in the auto-generated comments. It is unclear if this is intentional or a data artifact without seeing the.resxfile.