--- source_files: - DTS Viewer/DTS.Viewer.Modules/DTS.Viewer.Graph/Resources/TranslateExtension.cs - DTS Viewer/DTS.Viewer.Modules/DTS.Viewer.Graph/Resources/StringResources.Designer.cs generated_at: "2026-04-16T13:51:30.707906+00:00" model: "zai-org/GLM-5-FP8" schema_version: 1 sha256: "ea967aac84c55893" --- # Documentation: DTS.Viewer.Graph Resources ## 1. Purpose This module provides localization support for the `DTS.Viewer.Graph` namespace. It consists of a WPF markup extension (`TranslateExtension`) for declarative XAML binding and an auto-generated resource accessor class (`StringResources`) for retrieving localized strings programmatically. The module centralizes user-facing strings related to graph operations, data filtering errors, and file export statuses (PDF/CSV). ## 2. Public Interface ### Class: `TranslateExtension` **Namespace:** `DTS.Viewer.Graph` **Inheritance:** `System.Windows.Markup.MarkupExtension` This class allows XAML bindings to localized resources. * **Constructor** * `public TranslateExtension(string key)`: Initializes the extension with the resource key to look up. * **Method** * `public override object ProvideValue(IServiceProvider serviceProvider)`: Returns the localized string associated with `_key`. If the key is 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 name. ### Class: `StringResources` **Namespace:** `DTS.Viewer.Graph.Resources` **Visibility:** `internal` A strongly-typed resource class generated by Visual Studio tools. * **Property: `ResourceManager`** (static) * Returns the cached `System.Resources.ResourceManager` instance for this assembly. * **Property: `Culture`** (static) * Gets or sets the `System.Globalization.CultureInfo` used for resource lookups. * **Resource String Properties** (static, read-only): * `BadDataFromCustomFilter`: Warning regarding filter class frequency exceeding sample rate bounds. * `BadDataFromTestSetupDefaultFilter`: Warning regarding test filter results causing out-of-bounds data. * `BadDataUnfilteredUnknown`: Error message for unviewable channel data. * `ReadingChannelData`: Status message indicating channel data is being read. * `SavePDFError`: Error message for PDF chart save failure. * `SavePDFSuccess`: Success message for PDF chart save (includes format placeholders `{0}`, `{1}`, etc.). * `SaveReportCSVError`: Error message for CSV report save failure. * `SaveReportCSVSuccess`: Success message for CSV report save. * `SaveReportPDFError`: Error message for PDF report save failure. * `SaveReportPDFSuccess`: Success message for PDF report save. ## 3. Invariants * **Null Safety:** `TranslateExtension.ProvideValue` will never return null. It guarantees a string return, defaulting to specific error constants if lookup fails. * **Error Differentiation:** The return value distinguishes between a missing key argument (returns `#stringnotfound#`) and a valid key argument with no matching resource (returns `#stringnotfound# [key]`). * **Resource Availability:** `StringResources` assumes the existence of a corresponding `.resx` file embedded in the assembly manifest named `"DTS.Viewer.Graph.Resources.StringResources"`. ## 4. Dependencies * **Internal Dependencies:** * `TranslateExtension` depends entirely on `DTS.Viewer.Graph.Resources.StringResources` for data retrieval. * **External Dependencies:** * `System`: Core base library. * `System.Windows.Markup`: Required for `MarkupExtension` and `MarkupExtensionReturnTypeAttribute` (WPF specific). * `System.Resources`: Used for `ResourceManager`. * `System.Globalization`: Used for `CultureInfo`. * **Dependents:** * Unknown from source alone. However, the `MarkupExtensionReturnType` attribute implies consumption by WPF XAML parsers within the `DTS.Viewer.Graph` module. ## 5. Gotchas * **Auto-Generated Code:** `StringResources` is a designer file (`StringResources.Designer.cs`). Manual edits to this file will be overwritten by the tooling (Visual Studio/ResGen). Changes must be made to the underlying `.resx` file. * **Internal Visibility:** The `StringResources` class is marked `internal`. It is not accessible outside the `DTS.Viewer.Graph` assembly. * **Silent Failure Mode:** `TranslateExtension` does not throw exceptions for missing keys. Instead, it returns the literal string `#stringnotfound#`. Developers debugging missing UI text must search for this specific string or check the output for the appended key name. * **Hardcoded Fallback:** The fallback string `#stringnotfound#` is hardcoded in `TranslateExtension.cs` rather than being localized itself.