5.2 KiB
5.2 KiB
source_files, generated_at, model, schema_version, sha256
| source_files | generated_at | model | schema_version | sha256 | ||
|---|---|---|---|---|---|---|
|
2026-04-16T13:41:18.748200+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 XAML markup extension (TranslateExtension) that allows UI elements to bind directly to localized strings declaratively. Its role is to centralize string management and support UI globalization within the PSD Report component.
2. Public Interface
TranslateExtension
A MarkupExtension implementation for use in XAML binding.
- Constructor
public TranslateExtension(string key)— Initializes the extension with the resource key to be looked up.
- Methods
public override object ProvideValue(IServiceProvider serviceProvider)— Looks up the string resource identified by_key. Returns the localized string if found; otherwise, returns an error string.
StringResources (Internal)
A strongly-typed resource class auto-generated by StronglyTypedResourceBuilder. It provides static properties to access localized strings.
- Properties
internal static global::System.Resources.ResourceManager ResourceManager— Returns the cachedResourceManagerinstance for this assembly.internal static global::System.Globalization.CultureInfo Culture— Gets or sets the currentCultureInfoused for resource lookups.internal static string DataHeader— Looks up a localized string (default: "Data").internal static string DataSelectionHeader— Looks up a localized string (default: "Data selection").internal static string GraphsDefaultTitle— Looks up a localized string (default: "Graphs ").internal static string ModificationsHeader— Looks up a localized string (default: "Modify").internal static string PSDHeader— Looks up a localized string (default: "PSD").internal static string PSDResultsHeader— Looks up a localized string (default: "Results").internal static string PSDSettingsHeader— Looks up a localized string (default: "PSD Settings").internal static string SettingsTitle— Looks up a localized string (default: "Settings").internal static string TestsDefaultTitle— Looks up a localized string (default: "Tests ").
3. Invariants
- Error Handling:
TranslateExtension.ProvideValuewill never returnnull. It guarantees a string return, either the resource value or a specific error constant. - Error Format: If a resource key is not found, the return value follows the format
#stringnotfound# [key]. - Empty Key: If
TranslateExtensionis initialized with anullor emptykey,ProvideValuereturns exactly#stringnotfound#(without the key appended). - Resource Manager:
StringResources.ResourceManageruses a lazy initialization pattern (singleton) and is thread-safe regarding the initial check (viaReferenceEqualscheck). - Code Generation:
StringResourcesis markedinternaland is auto-generated; manual modifications to the designer file will be overwritten by tooling.
4. Dependencies
Imports (This module depends on)
System(Core runtime)System.Windows.Markup(ForMarkupExtensionandIServiceProvider— implies a dependency on WPF core assemblies)System.Resources(ForResourceManager)System.Globalization(ForCultureInfo)System.CodeDom.Compiler,System.Diagnostics,System.ComponentModel(Used for attributes on the designer class)
Consumers (What depends on this)
- XAML Files: Any XAML views within the
DTS.Viewer.PSDReportnamespace (or referencing it) that use the{local:Translate KeyName}syntax. - C# Logic: Any code-behind within the
DTS.Viewer.PSDReportassembly that accessesStringResourcesproperties directly (e.g.,StringResources.PSDHeader).
5. Gotchas
- Silent Failure Mode: The
TranslateExtensiondoes not throw exceptions for missing keys. Instead, it renders#stringnotfound#into the UI. Developers must visually inspect the UI or write specific tests to detect missing translations. - Designer File Editing:
StringResources.Designer.csis auto-generated. To add or modify strings, the underlying.resxfile must be edited, and the project regenerated. Direct edits to this file will be lost. - Trailing Spaces: The default values for
GraphsDefaultTitle("Graphs ") andTestsDefaultTitle("Tests ") contain trailing spaces. This may be intentional for UI padding but could cause issues if trimmed or compared strictly. - Internal Visibility:
StringResourcesisinternal. External assemblies cannot access the resource properties directly; they must rely on theTranslateExtension(if the XAML context allows) or theResourceManagerproperty if exposed.