5.3 KiB
source_files, generated_at, model, schema_version, sha256
| source_files | generated_at | model | schema_version | sha256 | ||
|---|---|---|---|---|---|---|
|
2026-04-16T13:40:10.219585+00:00 | zai-org/GLM-5-FP8 | 1 | 154eee0c947eb6d0 |
Documentation: DTS.Viewer.PSDReportResults.Resources
1. Purpose
This module provides localization infrastructure for the PSD Report Results viewer within the DTS application. It bridges the gap between XAML UI definitions and localized string resources via a custom TranslateExtension markup extension. It allows developers to bind UI elements to resource keys declaratively, while relying on the auto-generated StringResources class to perform culture-aware string lookups for report-specific terminology such as "Channel Name," "Sample Rate," and export options.
2. Public Interface
Class: TranslateExtension
Namespace: DTS.Viewer.PSDReportResults
Inheritance: System.Windows.Markup.MarkupExtension
This class is a XAML markup extension used to look up localized strings at runtime.
-
Constructor
public TranslateExtension(string key): Initializes the extension with the resource key to be translated. The key is stored in a private readonly field_key.
-
Methods
public override object ProvideValue(IServiceProvider serviceProvider): Returns the localized string corresponding to the_key.- If
_keyis null or empty, it returns the constant"#stringnotfound#". - If the key is valid but no resource is found, it returns
"#stringnotfound# "appended with the_key.
- If
Class: StringResources
Namespace: DTS.Viewer.PSDReportResults.Resources
Accessibility: internal
A strongly-typed resource class auto-generated by Visual Studio/ResGen. It provides access to localized strings defined in the corresponding .resx file.
- Properties
internal static global::System.Resources.ResourceManager ResourceManager: Returns the cachedResourceManagerinstance responsible for looking up resources. The resource base name is"DTS.Viewer.PSDReportResults.Resources.StringResources".internal static global::System.Globalization.CultureInfo Culture: Gets or sets the currentCultureInfoused for resource lookups.internal static string ChannelName: Looks up a localized string (default: "Name").internal static string ExportPSDHeader: Looks up a localized string (default: "Export").internal static string ExportPSDtoCSV: Looks up a localized string (default: "Export PSD to CSV").internal static string ExportPSDtoPDF: Looks up a localized string (default: "Export PSD to PDF").internal static string GRMS: Looks up a localized string (default: "GRMS").internal static string PSDResultsHeader: Looks up a localized string (default: "Results").internal static string SampleRate: Looks up a localized string (default: "Sample Rate").
3. Invariants
- Return Type Guarantee: The
TranslateExtensionclass is decorated with[MarkupExtensionReturnType(typeof(string))], guaranteeing thatProvideValuereturns astring(despite the method signature returningobject). - Non-Null Return:
TranslateExtension.ProvideValuenever returns null. It guarantees a string return, falling back to error indicators if the key is missing or empty. - Resource Manager Singleton: The
ResourceManagerproperty inStringResourcesimplements a lazy-loading singleton pattern; it will only instantiate theResourceManageronce. - Auto-Generated Constraint:
StringResourcesis marked withDebuggerNonUserCodeAttributeandCompilerGeneratedAttribute, indicating it should not be manually edited and must be regenerated when the.resxsource changes.
4. Dependencies
- Internal Dependencies:
TranslateExtensiondepends directly onStringResources.ResourceManagerto perform lookups.
- External Dependencies:
System.Windows.Markup: Required forMarkupExtensionandMarkupExtensionReturnTypeAttribute(implies this is a WPF or related XAML-based UI project).System.Resources: Required forResourceManager.System.Globalization: Required forCultureInfo.
- Dependents:
- XAML files within the
DTS.Viewer.PSDReportResultsassembly are the intended consumers ofTranslateExtension.
- XAML files within the
5. Gotchas
- Differentiated Error States: The
ProvideValuemethod handles errors differently depending on the cause.- A null/empty key returns exactly
"#stringnotfound#". - A valid key that is missing from resources returns
"#stringnotfound# "(note the trailing space) followed by the key name. Developers parsing logs or UI output should be aware of this format difference.
- A null/empty key returns exactly
- Internal Visibility: The
StringResourcesclass isinternal. It cannot be accessed directly from outside theDTS.Viewer.PSDReportResultsassembly. External assemblies must rely on theTranslateExtension(if public) or other public wrappers to access these strings. - Hardcoded Fallback Strings: The error strings
"#stringnotfound#"are hardcoded inTranslateExtension.cs. They are not localized themselves (i.e., if the system language changes, these error messages remain in English/code-form).