6.0 KiB
source_files, generated_at, model, schema_version, sha256
| source_files | generated_at | model | schema_version | sha256 | ||
|---|---|---|---|---|---|---|
|
2026-04-16T11:13:28.138314+00:00 | zai-org/GLM-5-FP8 | 1 | ea967aac84c55893 |
Documentation: DTS.Viewer.Graph.Resources
1. Purpose
This module provides localization infrastructure for the DTS.Viewer.Graph namespace. It enables XAML-based string localization through a WPF markup extension (TranslateExtension) backed by a strongly-typed resource class (StringResources). The resources defined here support user-facing messaging for chart operations, data filtering validation, and file export functionality (PDF/CSV).
2. Public Interface
TranslateExtension (class)
Namespace: DTS.Viewer.Graph
Inheritance: System.Windows.Markup.MarkupExtension
Attribute: [MarkupExtensionReturnType(typeof(string))]
A XAML markup extension that resolves localized strings from the resource manager at runtime.
| Member | Signature | Description |
|---|---|---|
| Constructor | TranslateExtension(string key) |
Initializes the extension with the resource key to look up. The key parameter is stored in a readonly field _key. |
| Method | override object ProvideValue(IServiceProvider serviceProvider) |
Returns the localized string for _key via StringResources.ResourceManager.GetString(_key). Returns NotFound if _key is null or empty. Returns NotFound + " " + _key if the key is not found in resources. |
Constants:
private const string NotFound = "#stringnotfound#"— Sentinel value returned when a resource key cannot be resolved.
StringResources (class)
Namespace: DTS.Viewer.Graph.Resources
Accessibility: internal
Attribute: [GeneratedCode], [DebuggerNonUserCode], [CompilerGenerated]
An auto-generated strongly-typed resource class. Do not edit manually; regenerate from .resx file.
| Member | Signature | Description |
|---|---|---|
| Property | static ResourceManager ResourceManager |
Lazily initializes and returns a cached ResourceManager instance bound to "DTS.Viewer.Graph.Resources.StringResources". |
| Property | static CultureInfo Culture |
Gets or sets the culture used for resource lookups. Defaults to null (uses current thread's CurrentUICulture). |
Resource String Properties (all internal static string):
| Property Name | Purpose |
|---|---|
BadDataFromCustomFilter |
Error message for filter frequency causing out-of-bounds data. Format placeholders: {0} (frequency), {1} (additional info). |
BadDataFromTestSetupDefaultFilter |
Error message for test setup default filter issues. Format placeholder: {0}. |
BadDataUnfilteredUnknown |
Error message for unviewable channel data. Format placeholder: {0}. |
ReadingChannelData |
Status message: "Reading channel data...." |
SavePDFError |
Error message for chart PDF save failure. |
SavePDFSuccess |
Success message for chart PDF save. Format placeholders: {0}, {1}, {2}, {3}. |
SaveReportCSVError |
Error message for report CSV save failure. |
SaveReportCSVSuccess |
Success message for report CSV save. Format placeholder: {0} (path). |
SaveReportPDFError |
Error message for report PDF save failure. |
SaveReportPDFSuccess |
Success message for report PDF save. Format placeholder: {0} (path). |
3. Invariants
- Key immutability:
_keyinTranslateExtensionisreadonlyand set only at construction. - Non-null return:
TranslateExtension.ProvideValuenever returnsnull. It always returns either a valid localized string or aNotFoundsentinel (with optional key suffix). - Fallback behavior: If
StringResources.ResourceManager.GetString(_key)returnsnull, the extension returns"#stringnotfound# " + _key. - Empty key handling: If
_keyisnullor empty string,ProvideValuereturns exactly"#stringnotfound#"without a trailing space or key. - Auto-generation constraint:
StringResourcesclass is tool-generated. Manual edits will be lost upon regeneration.
4. Dependencies
This module depends on:
System(core types)System.Windows.Markup(MarkupExtensionbase class,MarkupExtensionReturnTypeAttribute)System.Resources(ResourceManager)System.Globalization(CultureInfo)System.CodeDom.Compiler(GeneratedCodeAttribute)System.Diagnostics(DebuggerNonUserCodeAttribute)System.Runtime.CompilerServices(CompilerGeneratedAttribute)
Dependents (inferred):
- XAML files within
DTS.Viewer.Graphthat use{x:Static}or{local:Translate}markup extensions for localized strings. - Code within
DTS.Viewer.Graphthat directly referencesStringResourcesproperties for message formatting.
5. Gotchas
-
Sentinel value is private: The
NotFoundconstant isprivate, so consuming code cannot programmatically check if a lookup failed by comparing against the sentinel. The sentinel string"#stringnotfound#"is effectively hardcoded in behavior. -
Key leakage in fallback: When a key is not found, the returned string includes the key name (
"#stringnotfound# " + _key). This could expose internal resource key names to end users in production if keys are missing. -
Inconsistent fallback format: Empty/null keys return
"#stringnotfound#"(no trailing space), while missing keys return"#stringnotfound# " + _key(with space and key). This inconsistency may complicate string comparison or testing. -
Internal visibility:
StringResourcesisinternal, so it cannot be accessed from outside theDTS.Viewer.Graphassembly. External assemblies must useTranslateExtensionin XAML or have no access to these resources. -
Designer file coupling: The
.resxfile backingStringResourcesis not included in the provided source. The actual string values and any additional resources are defined elsewhere and regenerated into this designer file.